openapi: 3.1.0
x-stoplight:
  id: pn6mp524ojnhi
info:
  title: Coinsflow
  version: '1.0'
  contact:
    name: admin
  description: API documentation
servers:
  - url: https://api.coinsflow.ge
    description: Production
  - url: https://api.sandbox.coinsflow.ge
    description: Sandbox
paths:
  /payouts:
    post:
      summary: Payout create
      operationId: post-crypto.payouts
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/PayoutCreate'
        '400':
          $ref: '#/components/responses/BadRequest'
        '500':
          $ref: '#/components/responses/BadRequest'
      description: >-
        This call allows you to create a payout with the desired cryptocurrency
        (asset).
      tags:
        - payout
      requestBody:
        $ref: '#/components/requestBodies/PayoutCreate'
      x-stoplight:
        id: qlwiyxmnvn5ey
      parameters: []
components:
  schemas:
    PayoutCreate:
      type: object
      x-examples:
        Example 1:
          amount: '0.01'
          networkFee: '0.000556532775603'
          status: APPROVED
          asset:
            id: 0b47a85e-a66a-461c-bb1a-e818def2ff82
            name: Ethereum Test (Goerli)
            symbol: ETH_TEST3
            displayName: Ethereum Test
            displaySymbol: ETH_TEST
            exchangeSymbol: ETH
            type: CRYPTO
            subType: BASE_ASSET
            token: false
            contract: null
            nativeAsset: ETH_TEST3
            decimals: 18
            network: 120
          id: ccd57031-cc2c-4ca2-bc73-6b087ce4c0e3
          transaction:
            createdAt: '2023-05-30T11:39:04+00:00'
            updatedAt: null
            id: c6f48ae4-b458-4caf-8875-d1ff06e7ecce
            lease: null
          fee: '0.000424495513613041'
          feePriority: MEDIUM
          destination: '0xb94E056b4931b27D9C2565963D0a34B043217989'
          note: null
          network: 120
          createdAt: '2023-05-30T11:39:04+00:00'
          updatedAt: null
      description: Payout object
      properties:
        amount:
          type: string
          description: >-
            This parameter displays the amount of the crypto currency that will
            be used on the payout operation.
        networkFee:
          type: string
          description: >-
            This parameter displays the amount charged by the network as fee for
            the payout operation.
        status:
          type: string
          enum:
            - APPROVAL
            - APPROVED
            - PROGRESS
            - REJECTED
            - SUCCESS
            - FAILED
          description: This parameter displays the status of the payout operation.
        asset:
          $ref: '#/components/schemas/AssetEntity'
          description: >-
            This parameter displays the crypto currency that will be used on the
            payout operation.
        id:
          type: string
          description: >
            This parameter displays the unique code that identifies the payout
            operation.
        transaction:
          type: object
          description: >-
            This object displays the information on the transaction required for
            the payout operation.
          properties:
            createdAt:
              type: string
              format: date-time
              description: >
                This parameter displays the time and date the transaction was
                created.
            updatedAt:
              type:
                - string
                - 'null'
              format: date-time
              description: >
                This parameter displays the time and date the transaction was
                updated.
            id:
              type: string
              format: uuid
              description: >
                This parameter displays the unique code that identifies the
                transaction.
            lease:
              $ref: '#/components/schemas/WalletLease'
              description: Lease object, can be null
        fee:
          type: string
          description: >-
            This parameter displays the amount charged as fee for the payout
            operation.
        feePriority:
          type: string
          description: >-
            This parameters displays the amount of fee paid for gas (in ETH
            language). Note: more gas = faster transaction processing on the
            blockchain.
        destination:
          type: string
          description: This parameter displays the address for the payout operation.
        note:
          type:
            - string
            - 'null'
          description: This parameters displays the memo related to the transaction.
        tag:
          type:
            - string
            - 'null'
          description: >-
            This parameter allows you to insert the unique numerical code,
            required by some blockchains, to pair with the deposit address, as
            an additional Security measure.
        network:
          type: integer
          description: >-
            This parameter displays the network where the payout operation
            occurred.
        createdAt:
          type: string
          format: date-time
          description: >-
            This parameter displays the time and date the payout operation was
            created.
        updatedAt:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            This parameter displays the time and date the payout operation was
            updated.
      x-stoplight:
        id: ry4oo96xtrdx6
    WalletLease:
      title: WalletLease
      x-stoplight:
        id: i3u8t656jdnds
      type: object
      description: Wallet lease object
      properties:
        id:
          type: string
          format: uuid
          description: This parameter displays the unique code that identifies the lease.
        asset:
          $ref: '#/components/schemas/AssetEntity'
          description: Asset object
        address:
          type: string
          description: >-
            This parameter displays the address of the wallet associated with
            the lease (payout or deposit).
        amount:
          type: string
          description: >-
            This parameter displays the amount of the crypto currency that will
            be used on the lease.
        expired:
          type: boolean
          description: This parameter displays the date and time the lease timed out.
        used:
          type: boolean
          description: This parameter indicares if the lease has been used or not.
        expires:
          type: string
          format: date-time
          description: This parameter displays the date and time the lease times out.
        network:
          type: integer
          description: This parameter displays the network where the lease is available.
        createdAt:
          type: string
          format: date-time
          description: This parameter displays the time and date the lease was created.
        updatedAt:
          type:
            - string
            - 'null'
          format: date-time
          description: This parameter displays the time and date the lease was updated.
    AssetEntity:
      title: AssetEntity
      x-stoplight:
        id: n7wuccfb2f3l4
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: >-
            This parameter displays the unique code that identifies the crypto
            currency.
        name:
          type: string
          description: This parameter displays the name given to the crypto currency.
        symbol:
          type: string
          description: >-
            This parameter displays the symbol associated to the crypto
            currency.
        displayName:
          type: string
          description: This paramater displays the name of the asset.
        displaySymbol:
          type: string
          description: This paramater displays the symbol of the asset.
        type:
          type: string
          description: This paramater displays the type of asset (fiat or crypto).
        exchangeSymbol:
          type: string
          description: >-
            This parameter displays the id that identifies the exchange provider
            asset.
        subType:
          type: string
          description: This paramater displays the subtype of asset (token or based asset).
        token:
          type: string
          description: This paramater displays the if the asset is a token or not.
        contract:
          type: string
          description: >-
            This parameter displays the unique code that identifies the crypto
            currency's contract.
        nativeAsset:
          type: string
          description: >-
            This parameter displays the base asset of the blockchain (e.g.: USDT
            on Ethereum network is USDT asset and ETH base asset).
        decimals:
          type: string
          description: >-
            This parameter displays the amount of decimals acepted by the crypto
            currency.
        network:
          type: string
          description: >-
            This parameter displays the network where the crypto currency is
            available.
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: integer
                description: >-
                  This parameter displays the unique code of the error message
                  produced.
              msg:
                type: string
                description: This parameter describes the message of the error produced.
          examples:
            Example 1:
              value:
                code: -100
                msg: Request data is invalid
  securitySchemes:
    HMAC:
      name: Authorization contains username algorithm headers signature
      type: apiKey
      in: header
      description: >-
        # Example bash script

        ```bash

        #!/bin/bash


        set -e


        METHOD=$(echo "$1" | tr a-z A-Z)

        ENDPOINT=$2

        GATEWAY_HOST=API_HOST

        GATEWAY_URL=API_URL

        HMAC_KEY=

        HMAC_SECRET=


        ENDPOINT_URL=$GATEWAY_URL$ENDPOINT

        DATE=$(LC_ALL=en_US.utf8 date --utc +"%a, %d %b %Y %H:%M:%S UTC")


        if [ -z "$METHOD" ] || [ -z "$ENDPOINT" ]

        then

        echo -e "Usage `basename "$0"` METHOD ENDPOINT\nExample GET /endpoint"

        exit 0

        fi


        SIGN_STRING="date: $DATE\n$METHOD $ENDPOINT HTTP/1.1"

        SIGNATURE=$(echo -en $SIGN_STRING | openssl dgst -sha256 -hmac
        "$HMAC_SECRET" -binary | base64)


        curl -s -X "$METHOD" "$ENDPOINT_URL" -H "Host: $GATEWAY_HOST" -H "Date:
        $DATE" -H "Authorization: hmac username=\"$HMAC_KEY\",
        algorithm=\"hmac-sha256\", headers=\"date request-line\",
        signature=\"$SIGNATURE\"" | jq

        ```
  parameters:
    offset:
      name: offset
      in: query
      required: false
      schema:
        type: integer
        default: 0
        minimum: 0
      description: >-
        This parameter allows you to indicate in what position to start from the
        list.
    limit:
      name: limit
      in: query
      required: false
      schema:
        type: integer
        default: 20
        minimum: 0
        maximum: 50
      description: This parameter allows you to determine the amount of results per page.
    orderId:
      schema:
        type: string
        format: uuid
      name: id
      in: path
      required: true
      description: >-
        This parameter allows you to send request related to specified order by
        it's ID.
  requestBodies:
    PayoutCreate:
      content:
        application/x-www-form-urlencoded:
          schema:
            type: object
            description: Payout create object
            properties:
              amount:
                type: string
                description: >
                  This parameter displays the amount of the selected asset to
                  send to another wallet.
              destination:
                type: string
                description: >
                  this parameter displays the address of the wallet to receive
                  the inserted amount.
              asset:
                type: string
                format: uuid
                description: >
                  This parameter displays the selected crypto currency in which
                  the amount will be sent.
              treatAsGrossAmount:
                type: boolean
                default: false
                description: >-
                  This parameter indicates if the network fee is deducted from
                  the requested amount (set as True) or from your account (set
                  as False, by default). This allows you to define who is
                  charged with the network fee (the payout receiver or you).
              externalId:
                type: string
                description: >-
                  This parameter allows you to insert an Internal ID (from your
                  own system) to better keep track of these operations.
              fromAddress:
                type: string
                description: >-
                  This parameter specifies the dedicated address you want to use
                  for the Payout.
security:
  - HMAC: []
tags:
  - name: payout
