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

# Create code

> Create a WhiteBIT code for transferring funds between accounts or to other users via the V4 API.



## OpenAPI

````yaml /openapi/private/main_api_v4.yaml POST /api/v4/main-account/codes
openapi: 3.0.3
info:
  title: WhiteBIT Private HTTP API V4
  description: |
    WhiteBIT Private HTTP API V4 for Main balance changes.

    Base URL: https://whitebit.com

    All endpoints return time in Unix-time format.
    All endpoints return either a JSON object or array.
    For receiving responses from API calls please use http method POST.
  version: 4.0.0
  contact:
    name: WhiteBIT Support
    email: support@whitebit.com
    url: https://whitebit.com
servers:
  - url: https://whitebit.com
    description: WhiteBIT Global Server
  - url: https://whitebit.eu
    description: WhiteBIT EU Server
security:
  - ApiKeyAuth: []
    PayloadAuth: []
    SignatureAuth: []
tags:
  - name: Main Account
    description: Main account balance and operations
  - name: Deposit
    description: Cryptocurrency and fiat deposit operations
  - name: Withdraw
    description: Cryptocurrency and fiat withdrawal operations
  - name: Transfer
    description: Balance transfer operations
  - name: Codes
    description: WhiteBIT codes operations
  - name: Crypto Lending - Fixed
    description: Fixed crypto lending plans
  - name: Crypto Lending - Flex
    description: Flexible crypto lending plans
  - name: Fees
    description: Fee information
  - name: Sub-Account
    description: Sub-account management
  - name: Sub-Account API Keys
    description: Sub-account API key management
  - name: Mining Pool
    description: Mining pool operations
  - name: Credit Line
    description: Credit line information
  - name: JWT
    description: JWT token management
paths:
  /api/v4/main-account/codes:
    post:
      tags:
        - Codes
      summary: Create code
      description: |
        The endpoint creates [WhiteBIT code](/glossary#whitebit-codes).

        <Warning>
        Rate limit: 1000 requests/10 sec.
        </Warning>

        <Note>
        The API does not cache the response.
        </Note>
      operationId: createCode
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - ticker
                - amount
                - request
                - nonce
              properties:
                ticker:
                  type: string
                  description: 'Currency''s [ticker](/glossary#ticker). Example: BTC'
                  example: ETH
                amount:
                  type: string
                  description: >-
                    Amount to transfer. Up to 18 decimal places, value greater
                    than zero and capped at 1e17 (10^17), and not exceeding the
                    [main balance](/glossary#balance-main).
                  example: '0.002'
                passphrase:
                  type: string
                  maxLength: 25
                  description: >-
                    Passphrase for applying [WhiteBIT
                    codes](/glossary#whitebit-codes). Passphrase must contain
                    only latin letters, numbers and symbols (like !@#$%^, no
                    whitespaces). Max: 25 symbols.
                  example: some passphrase
                description:
                  type: string
                  maxLength: 280
                  description: >-
                    Additional text description for
                    [code](/glossary#whitebit-codes). Visible only for creator.
                    Max: 280 symbols.
                  example: some description
                request:
                  type: string
                  description: Request signature
                  example: '{{request}}'
                nonce:
                  type: integer
                  description: Unique request identifier
                  example: 1594297865000
            example:
              ticker: ETH
              amount: '0.002'
              passphrase: some passphrase
              description: some description
              request: '{{request}}'
              nonce: 1594297865000
      responses:
        '201':
          description: All validations succeeded and creating transaction is started
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: Generated WhiteBIT code
                  message:
                    type: string
                    description: Success message
                  external_id:
                    type: string
                    description: External identifier
              example:
                code: WBe11f4fce-2a53-4edc-b195-66b693bd77e3ETH
                message: Code was successfully created
                external_id: be08a482-5faf-11ed-9b6a-0242ac120002
        '400':
          description: Request validation failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                missingFields:
                  summary: Missing required fields
                  value:
                    code: 0
                    message: Validation failed
                    errors:
                      amount:
                        - The amount field is required.
                      ticker:
                        - The ticker field is required.
                invalidTypes:
                  summary: Invalid field types
                  value:
                    code: 0
                    message: Validation failed
                    errors:
                      amount:
                        - The amount must be a number.
                        - Invalid number
                      description:
                        - The description must be a string.
                      passphrase:
                        - The passphrase must be a string.
                      ticker:
                        - The selected ticker is invalid.
                invalidLengths:
                  summary: Invalid field lengths
                  value:
                    code: 0
                    message: Validation failed
                    errors:
                      amount:
                        - The amount must be at least 0.
                      description:
                        - >-
                          The description may not be greater than 280
                          characters.
                      passphrase:
                        - The passphrase may not be greater than 25 characters.
                      ticker:
                        - The selected ticker is invalid.
        '422':
          description: >
            Inner validation failed


            Response error codes:

            - 0 - Fiat are available on the front-end only

            - 1 - currency is not withdrawable

            - 2 - specified address is invalid

            - 3 - amount is too small

            - 4 - amount is too small for the payment system

            - 5 - not enough balance

            - 6 - amount is less than or equals [fee](/glossary#fee)


            Code creation reserves funds through the shared withdraw processor,
            so insufficient

            balance surfaces as code 5. The minimum amount is configured **per
            currency** (there

            is no fixed global value) and a below-minimum amount surfaces as
            code 3.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorInner'
              examples:
                unconfirmedUser:
                  summary: Unconfirmed users (without KYC) - limit exceeded
                  value:
                    code: 0
                    message: Validation failed
                    errors:
                      amount:
                        - >-
                          This currency has no active pairs or it may have been
                          delisted. Its rate cannot be calculated at the moment.
                        - Current limit exceeded
                kycRequired:
                  summary: Fiat currencies require KYC verification
                  value:
                    code: 0
                    message: Validation failed
                    errors:
                      amount:
                        - Your account must be verified
                invalidPassphrase:
                  summary: Invalid passphrase format
                  value:
                    code: 0
                    message: Validation failed
                    errors:
                      passphrase:
                        - The passphrase format is invalid.
                codesDisabled:
                  summary: WhiteBIT codes are disabled for this currency
                  value:
                    code: 0
                    message: Validation failed
                    errors:
                      ticker:
                        - Codes are disabled for this currency
components:
  schemas:
    Error:
      type: object
      properties:
        code:
          type: integer
        message:
          type: string
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
    ErrorInner:
      type: object
      properties:
        code:
          type: integer
        message:
          type: string
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-TXC-APIKEY
      description: The public WhiteBIT API key.
    PayloadAuth:
      type: apiKey
      in: header
      name: X-TXC-PAYLOAD
      description: Base64-encoded JSON request body.
    SignatureAuth:
      type: apiKey
      in: header
      name: X-TXC-SIGNATURE
      description: >-
        HMAC-SHA512 signature of the payload, hex-encoded. Computed as
        hex(HMAC-SHA512(payload, api_secret)).

````