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

# Generate a user deposit address

> Generate a deposit address for a user.

Deposits sent to this address are attributed to the user identified by `foreign_id`.

> [!NOTE]
>
> CryptoProcessing is required to collect sender data in compliance with local regulations. For more details, see [User data collection](https://docs.ca.cryptoprocessing.com/user-data-collection.md). The `sender_data` and the `end_user_reference` you provide must be associated with the same customer.

For every error this endpoint returns and what it means, see [API errors: Generate a user deposit address](https://docs.ca.cryptoprocessing.com/api-reference/errors.md#generate-a-user-deposit-address).


## OpenAPI

````yaml POST /v2/addresses/take
openapi: 3.1.0
info:
  title: Merchant Backend V2
  version: '1.0'
  description: Documentation for merchant backend processing endpoints
servers:
  - url: https://app.ca.cryptoprocessing.com/api
security:
  - xProcessingKey: []
tags:
  - name: Status
  - name: Balance
  - name: Currencies
  - name: Deposit addresses
  - name: Withdrawal
  - name: Exchange
  - name: Invoices
  - name: Transactions
paths:
  /v2/addresses/take:
    post:
      tags:
        - Deposit addresses
      summary: Generate a crypto address
      description: Generate a deposit address for a user.
      operationId: post-addresses-take
      parameters:
        - $ref: '#/components/parameters/XProcessingSignatureHeader'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                currency:
                  type: string
                  description: >-
                    The cryptocurrency this deposit address will accept — this
                    is the currency your customer sends. For a list of all
                    available currencies, see [API currency
                    codes](/api-reference/currency-codes).
                convert_to:
                  type: string
                  description: >-
                    Automatically convert all deposits to this currency. If
                    omitted, no automatic conversion is applied.
                foreign_id:
                  type: string
                  description: >-
                    The unique ID of the customer who will be depositing to this
                    address. It will be returned with every callback to make it
                    easy for you to identify the customer within your system.
                    The same `foreign_id` can be reused across multiple
                    addresses that belong to the same customer. This parameter
                    must not include any personal data.
                end_user_reference:
                  $ref: '#/components/schemas/end_user_reference.deposits'
                sender_type:
                  $ref: '#/components/schemas/sender_type.deposits'
                sender_data:
                  $ref: '#/components/schemas/sender_data'
              required:
                - currency
                - foreign_id
                - sender_data
                - sender_type
                - end_user_reference
            examples:
              Get a USDC deposit address:
                value:
                  currency: USDC
                  foreign_id: user_12345
                  end_user_reference: user_12345
                  sender_type: legal
                  sender_data:
                    legal_name: Example Customer
                    country_of_registration: CAN
              Get a USDC address that converts deposits to USD:
                value:
                  currency: USDC
                  convert_to: USD
                  foreign_id: user_12345
                  end_user_reference: user_12345
                  sender_type: legal
                  sender_data:
                    legal_name: Example Customer
                    country_of_registration: CAN
      responses:
        '201':
          description: |
            Created. The deposit address was generated; see `data` below.
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    type: object
                    required:
                      - id
                      - currency
                      - address
                      - tag
                      - foreign_id
                      - end_user_reference
                    properties:
                      id:
                        type: integer
                        description: Address ID.
                      currency:
                        type: string
                        description: Currency code.
                      convert_to:
                        type: string
                        description: >-
                          The currency all deposits to this address will be
                          converted to. It is only returned if you included
                          `convert_to` in the request.
                      address:
                        type: string
                        description: The generated address.
                      tag:
                        oneOf:
                          - type: string
                          - type: integer
                          - type: 'null'
                        description: >-
                          Destination tag/memo for currencies that require it —
                          a string or a number depending on the currency (an XRP
                          tag is a number). Deposit callbacks and
                          `/v2/transactions/info` return the tag as a string.
                          `null` for currencies that don't use tags.
                      foreign_id:
                        type: string
                        description: >-
                          ID of the customer who will be depositing to this
                          address.
                      end_user_reference:
                        type: string
                        description: Permanent ID of the customer in your system.
              examples:
                Get a USDC deposit address:
                  value:
                    data:
                      id: 3859599
                      currency: USDC
                      address: '0x35f6005cfA94a1c030B8c4dfcc29D4eB8a6865bF'
                      tag: null
                      foreign_id: user_12345
                      end_user_reference: user_12345
                Get a USDC address that converts deposits to USD:
                  value:
                    data:
                      id: 3859601
                      currency: USDC
                      convert_to: USD
                      address: '0x360669C460894e27fc875cf674268D81f9e6512c'
                      tag: null
                      foreign_id: user_12345
                      end_user_reference: user_12345
        '400':
          description: >
            Bad Request. See [API
            errors](/api-reference/errors#generate-a-user-deposit-address) for
            the validation messages this endpoint can return.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationOrMalformedJson'
              examples:
                Missing currency:
                  value:
                    errors:
                      currency: The currency field is required.
                Missing foreign_id:
                  value:
                    errors:
                      foreign_id: The foreign id field is required.
                Currency doesn't exist:
                  value:
                    errors:
                      currency: Invalid currency
                Fiat currency:
                  value:
                    errors:
                      currency: Invalid currency
                Currency only allowed with conversion:
                  value:
                    errors:
                      currency: Currency is not allowed without conversion
                Conversion currency doesn't exist:
                  value:
                    errors:
                      convert_to: Invalid currency
                Conversion to the same currency:
                  value:
                    errors:
                      convert_to: Invalid currency
                Conversion not available for the currency:
                  value:
                    errors:
                      convert_to: Invalid currency
                Conversion currency not allowed:
                  value:
                    errors:
                      convert_to: Currency is not allowed without conversion
                Email in the end-user reference:
                  value:
                    errors:
                      end_user_reference: The end user reference must not contain email.
                Sender type not natural or legal:
                  value:
                    errors:
                      sender_type: The selected sender type is invalid.
                KYC data incomplete:
                  value:
                    errors:
                      sender_data.first_name: The sender data.first name field is required.
                      sender_data.last_name: The sender data.last name field is required.
                Missing sender_data:
                  value:
                    errors:
                      sender_data: The sender data field is required.
                      sender_data.first_name: The sender data.first name field is required.
                      sender_data.last_name: The sender data.last name field is required.
                Sender data not an object:
                  value:
                    errors:
                      sender_data: The sender data must be an array.
                      sender_data.first_name: The sender data.first name field is required.
                      sender_data.last_name: The sender data.last name field is required.
                "First name longer than\_255\_characters":
                  value:
                    errors:
                      sender_data.first_name: >-
                        The sender data.first name may not be greater than 255
                        characters.
                "Last name longer than\_255\_characters":
                  value:
                    errors:
                      sender_data.last_name: >-
                        The sender data.last name may not be greater than 255
                        characters.
                Date of birth not in YYYY-MM-DD format:
                  value:
                    errors:
                      sender_data.date_of_birth: >-
                        The sender data.date of birth does not match the format
                        Y-m-d.
                Missing legal_name:
                  value:
                    errors:
                      sender_data.legal_name: The sender data.legal name field is required.
                "Legal name longer than\_255\_characters":
                  value:
                    errors:
                      sender_data.legal_name: >-
                        The sender data.legal name may not be greater than 255
                        characters.
                Missing country_of_registration:
                  value:
                    errors:
                      sender_data.country_of_registration: >-
                        The sender data.country of registration field is
                        required.
                Country of registration not valid:
                  value:
                    errors:
                      sender_data.country_of_registration: >-
                        The selected sender data.country of registration is
                        invalid.
                Missing sender_type:
                  value:
                    errors:
                      sender_type: The sender type field is required.
                Missing end_user_reference:
                  value:
                    errors:
                      end_user_reference: The end user reference field is required.
                Currency not a string:
                  value:
                    errors:
                      currency: The currency must be a string.
                "Foreign ID longer than\_255\_characters":
                  value:
                    errors:
                      foreign_id: The foreign id may not be greater than 255 characters.
                Multiple validation errors:
                  value:
                    errors:
                      currency: The currency field is required.
                      foreign_id: The foreign id field is required.
                Address can't be issued for this end-user reference:
                  value:
                    errors:
                      sender_data: Address cannot be issued for that end_user_reference
                Malformed JSON:
                  value:
                    error: Bad content format
                    code: bad_content_format
        '403':
          $ref: '#/components/responses/HeaderAuthorization'
        '422':
          description: >
            Unprocessable entity. An infrastructure or blockchain-related error
            occurred while issuing the address. See [API
            errors](/api-reference/errors#generate-a-user-deposit-address) for
            the messages this endpoint can return.
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: string
                  error_code:
                    type: string
              examples:
                Temporary error while issuing the address:
                  value:
                    errors:
                      - Something went wrong, please try again shortly
                    error_code: blockchain_error
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  parameters:
    XProcessingSignatureHeader:
      name: X-Processing-Signature
      in: header
      required: true
      description: >-
        Hex-encoded HMAC-SHA512 signature of the request body, [generated using
        your secret key](/api-reference/authentication).
      schema:
        type: string
  schemas:
    end_user_reference.deposits:
      type: string
      description: >
        Permanent ID of the customer in your system. Used to group, track, and
        analyze transactions made by a specific customer. Must not contain
        personal data, such as the user's name or email address.
    sender_type.deposits:
      type: string
      enum:
        - natural
        - legal
      description: >
        Type of the merchant's customer who sends the funds.


        Use `natural` if the sender is an individual person and `legal` if the
        sender is a legal entity. The selected type determines which fields must
        be included in `sender_data`.
    sender_data:
      description: >
        Must contain the details of the merchant's customer who sends the funds.
        Which fields are required depends on `sender_type`.
      oneOf:
        - title: Natural person
          type: object
          required:
            - first_name
            - last_name
          properties:
            first_name:
              type: string
              maxLength: 255
              description: The sender's first name.
            last_name:
              type: string
              maxLength: 255
              description: The sender's last name.
            date_of_birth:
              type: string
              description: >-
                The sender's date of birth, YYYY-MM-DD. Optional for a natural
                person.
        - title: Legal entity
          type: object
          required:
            - legal_name
            - country_of_registration
          properties:
            legal_name:
              type: string
              maxLength: 255
              description: The company's name.
            country_of_registration:
              type: string
              description: >-
                The company's country of registration (ISO alpha-3 format, three
                characters).
    ValidationOrMalformedJson:
      oneOf:
        - type: object
          title: ValidationError
          description: One or more request parameters failed validation.
          properties:
            errors:
              type: object
              description: >
                A map of request field names to a human-readable validation
                error message for that field. The exact set of possible keys and
                messages is endpoint-specific — see [API
                errors](/api-reference/errors#errors-by-endpoint) for the full
                reference.
              additionalProperties:
                type: string
                description: Human-readable validation error message for this field.
        - type: object
          title: MalformedJson
          description: >-
            The request body is not valid JSON or the Content-Type header is not
            set to `application/json`.
          properties:
            error:
              type: string
            code:
              type: string
  responses:
    HeaderAuthorization:
      description: |
        Forbidden
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                description: Human-readable error message.
              code:
                type: string
                description: Error code.
            description: >-
              Invalid or missing headers, or the API key does not have access to
              the endpoint. Refer to
              [Errors](/api-reference/errors#general-errors) for troubleshooting
              steps.
          examples:
            Bad signature header:
              value:
                error: Bad signature header
                code: bad_header_signature
            API key does not have the required ability:
              value:
                error: The API key does not have access to this endpoint.
                code: api_key_ability_required
            No signature header:
              value:
                error: No signature header
                code: required_header_signature
            No key header:
              value:
                error: No key header
                code: required_header_key
    TooManyRequests:
      description: >
        Too Many Requests


        You sent too many requests in a short time. The limit is counted per API
        key, so requests from all your servers that use the same key count
        together. Wait before you send the request again, increasing the delay
        if you get `429` again, and handle this error by its status code, not by
        a particular response body. See [Too many
        requests](/api-reference/errors#too-many-requests-429-too-many-requests).
  securitySchemes:
    xProcessingKey:
      type: apiKey
      description: Your [API key](/merchant-administration/generate-and-activate-api-keys).
      in: header
      name: X-Processing-Key

````

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