> ## Documentation Index
> Fetch the complete documentation index at: https://docs.alphapo.net/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`.


## OpenAPI

````yaml POST /addresses/take
openapi: 3.0.0
info:
  title: Merchant Backend V2
  version: '1.0'
  description: Documentation for merchant backend processing endpoints
servers:
  - url: https://app.alphapo.net/api/v2
security:
  - xProcessingKey: []
tags:
  - name: Status
  - name: Balance
  - name: Currencies
  - name: Deposit addresses
  - name: Withdrawal
  - name: Exchange
  - name: Invoices
  - name: Transactions
paths:
  /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 currency to receive. 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'
                amount:
                  type: number
                  description: >
                    Lightning invoice amount.


                    - Required only when `currency` is `BTCLN`.

                    - Specify up to 8 decimal places.

                    - Retrieve the minimum and maximum amounts from the
                    `/currencies/list` endpoint.

                    - The invoice can be paid only for this exact amount.
              required:
                - currency
                - foreign_id
            examples:
              USDC address:
                value:
                  currency: USDC
                  foreign_id: user_12345
                  end_user_reference: user_12345
              USDC address with EUR conversion:
                value:
                  currency: USDC
                  convert_to: EUR
                  foreign_id: user_12345
                  end_user_reference: user_12345
              Lightning invoice (BTCLN):
                value:
                  currency: BTCLN
                  foreign_id: user_12345
                  end_user_reference: user_12345
                  amount: '0.00131239'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      id:
                        type: integer
                        format: int32
                        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:
                        type: string
                        description: >-
                          Destination tag/memo for currencies that require it.
                          `Null` for currencies that do not require 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.
                      expires_at:
                        type: integer
                        format: int64
                        description: >-
                          Lightning invoice expiration time as a Unix timestamp
                          in seconds.
              examples:
                USDC address:
                  value:
                    data:
                      id: 3859599
                      currency: USDC
                      address: '0x35f6005cfA94a1c030B8c4dfcc29D4eB8a6865bF'
                      tag: null
                      foreign_id: user_12345
                      end_user_reference: user_12345
                USDC address with EUR conversion:
                  value:
                    data:
                      id: 3859601
                      currency: USDC
                      convert_to: EUR
                      address: tb1qezlewt2mx36azu5qyx9yff7565z0u9p94vn2ha
                      tag: null
                      foreign_id: user_12345
                      end_user_reference: user_12345
                Lightning invoice (BTCLN):
                  value:
                    data:
                      id: 240407215
                      currency: BTCLN
                      address: >-
                        lnbcrt1312390n1p5uahd8pp5lx66la4mj4a2v4sdurkvvsfw7a5h32z09p0gyg9ld96kls23yj6sdqqcqzysxqzuysp56tlrew4yk2aenxlzatf98fzj83p085yp6t8cncu2jt008gsnxm4s9qxpqysgqkalt2x6js9wz4rw6ymvgmr9343vre3j96cmq9aazmkqfgnk2ctykceen8z9x5f0aalzzh83w8cpytpsxl8mxz7dr9rqwdapcza32q9spefy62j
                      tag: null
                      foreign_id: user_12345
                      end_user_reference: user_12345
                      expires_at: 1775165739
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationOrMalformedJson'
              examples:
                Missing currency:
                  summary: currency field is required
                  value:
                    errors:
                      currency: The currency field is required.
                Missing foreign_id:
                  summary: foreign_id field is required
                  value:
                    errors:
                      foreign_id: The foreign id field is required.
                Currency not enabled:
                  summary: Currency not enabled for client
                  value:
                    errors:
                      currency: The selected currency is not enabled for your account.
                Currency not found:
                  summary: Currency doesn't exist
                  value:
                    errors:
                      currency: Invalid currency
                Currency not allowed without conversion:
                  summary: This currency requires convert_to to be set
                  value:
                    errors:
                      currency: Currency is not allowed without conversion
                Invalid convert_to:
                  summary: convert_to currency doesn't exist
                  value:
                    errors:
                      convert_to: Invalid currency
                convert_to not allowed without conversion:
                  summary: convert_to currency not supported for conversion
                  value:
                    errors:
                      convert_to: Currency is not allowed without conversion
                Invalid end_user_reference:
                  summary: end_user_reference must not contain an email address
                  value:
                    errors:
                      end_user_reference: >-
                        The end user reference must not contain an email
                        address.
                Amount below minimum:
                  summary: Amount below the minimum deposit limit
                  value:
                    errors:
                      amount: The amount is less than the minimum deposit limit.
                Amount exceeds maximum:
                  summary: Amount exceeds maximum deposit limit
                  value:
                    errors:
                      amount: The amount is greater than the maximum deposit limit.
                Amount required for Lightning:
                  summary: Amount is required for Lightning Network addresses
                  value:
                    errors:
                      amount: The amount field is required.
                Amount not supported:
                  summary: Amount field not supported for this currency
                  value:
                    errors:
                      amount: The amount field is not supported for the currency.
                Multiple validation errors:
                  summary: Multiple fields failed validation
                  value:
                    errors:
                      currency: The currency field is required.
                      foreign_id: The foreign id field is required.
                Malformed JSON:
                  summary: Invalid JSON body
                  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.
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: string
                  error_code:
                    type: string
              examples:
                Blockchain error:
                  summary: Infrastructure failure while issuing the address
                  value:
                    errors:
                      - Something went wrong, please try again shortly
                    error_code: blockchain_error
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.
    ValidationOrMalformedJson:
      oneOf:
        - type: object
          title: ValidationError
          description: One or more request parameters failed validation.
          properties:
            errors:
              type: object
              additionalProperties:
                type: string
        - 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. Refer to
              [Errors](/api-reference/errors#403-forbidden) for troubleshooting
              steps.
          examples:
            Bad signature header:
              value:
                error: Bad signature header
                code: bad_header_signature
            No signature header:
              value:
                error: No signature header
                code: required_header_signature
            Bad key header:
              value:
                error: Bad key header
                code: bad_header_key
            No key header:
              value:
                error: No key header
                code: required_header_key
  securitySchemes:
    xProcessingKey:
      type: apiKey
      description: Your [API key](/merchant-administration/generate-and-activate-api-keys).
      in: header
      name: X-Processing-Key

````