Create Automatic Tokens Forwarding

Through this endpoint customers can set up an automatic forwarding function specifically for tokens (not coins). They can have a toAddress which is essentially the main address and the destination for the automatic tokens forwarding.

There is also a minimumTransferAmount which only when reached will then trigger the forwarding. Through this the customer can save from fees.

Moreover, feePriority can be also set, which defines how quickly to move the tokens once they are received. The higher priority, the larger the fee will be. It can be "SLOW", "STANDARD" or "FAST".

The response of this endpoint contains an attribute fromAddress which can be used as a deposit address. Any funds received by this address will be automatically forwarded to toAddress based on what the customer has set for the automation.

For this automatic forwarding the customer can set a callback subscription.

The subscription will work for all incoming transactions until it is deleted. There is no need to do that for every transaction.

POST /blockchain-automations/{blockchain}/{network}/tokens-forwarding/automations

Path Parameters

  • Required
    blockchain string

    Represents the specific blockchain protocol name, e.g. Ethereum, Bitcoin, etc.

    Example : bitcoin
    Possible Values : bitcoin ethereum
  • Required
    network string

    Represents the name of the blockchain network used; blockchain networks are usually identical as technology and software, but they differ in data, e.g. - "mainnet" is the live network with actual data while networks like "testnet", "ropsten", "rinkeby" are test networks.

    Example : testnet

Request body schema application/json

  • Optional
    context string

    In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. context is specified by the user.

  • Required
    data object
    • Required
      item object
      • Optional
        callbackSecretKey string

        Represents the Secret Key value provided by the customer. This field is used for security purposes during the callback notification, in order to prove the sender of the callback as Crypto APIs.

        Example : yourSecretString
      • Required
        callbackUrl string

        Represents the URL that is set by the customer where the callback will be received at. The callback notification will be received only if and when the event occurs.

        Example : https://example.com
      • Required
        confirmationsCount string

        Represents the number of confirmations, i.e. the amount of blocks that have been built on top of this block.

        Example : 3
      • Required
        feePriority string

        Represents the fee priority of the automation, whether it is "SLOW", "STANDARD" or "FAST".

        Default : STANDARD
        Example : SLOW
        Possible Values : SLOW STANDARD FAST
      • Required
        minimumTransferAmount string

        Represents the minimum transfer amount of the currency in the fromAddress that can be allowed for an automatic forwarding.

        Example : 0.00002
      • Required
        toAddress string

        Represents the hash of the address the currency is forwarded to.

        Example : tb1q54j7qcu7kgsrx87yn0r9zjdvsxrnvxg4qua2z6
      • Required
        tokenData object One Of
        object
        • Required
          propertyId integer

          Represents the specific propertyId of the token data that will be forwarded.

          Example : 31

Response schema

201 400 401 402 403 404 409 415 422 429 500
HTTP Status Code: 201
Content-Type: application/json

The resource has been successfully created.

  • Object :

  • Required
    apiVersion string

    Specifies the version of the API that incorporates this endpoint.

    Example : 2.0
  • Required
    requestId string

    Defines the ID of the request. The requestId is generated by Crypto APIs and it's unique for every request.

    Example : 601c1710034ed6d407996b30
  • Optional
    context string

    In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. context is specified by the user.

    Example : You can add any text here
  • Required
    data object
    • Required
      item object
      • Required
        callbackUrl string

        Represents the URL that is set by the customer where the callback will be received at. The callback notification will be received only if and when the event occurs.

        Example : https://example.com
      • Required
        confirmationsCount integer

        Represents the number of confirmations, i.e. the amount of blocks that have been built on top of this block.

        Example : 2
      • Required
        createdTimestamp integer

        Defines the specific time/date when the automatic forwarding was created in Unix Timestamp.

        Example : 1611238648
      • Required
        feeAddress string

        Represents the specific fee address, which is always automatically generated. Users must fund it.

        Example : mojjR51gMXLJ4B3SBPhEXXRFDX7U5UWXNQ
      • Required
        feePriority string

        Represents the fee priority of the automation, whether it is "SLOW", "STANDARD" or "FAST".

        Example : STANDARD
        Possible Values : SLOW STANDARD FAST
      • Required
        fromAddress string

        Represents the hash of the address that forwards the tokens.

        Example : ms4KNsbNpoU8g424pzmEjbkFbfAHae1msB
      • Required
        minimumTransferAmount string

        Represents the minimum transfer amount of the tokens in the fromAddress that can be allowed for an automatic forwarding.

        Example : 0.5
      • Required
        referenceId string

        Represents a unique ID used to reference the specific callback subscription.

        Example : 6017dd02a309213863be9e55
      • Required
        toAddress string

        Represents the hash of the address the tokens are forwarded to.

        Example : tb1q54j7qcu7kgsrx87yn0r9zjdvsxrnvxg4qua2z6
      • Required
        tokenData object One Of
        object
        • Required
          propertyId integer

          Defines the propertyId of the Omni Layer token.

          Example : 31

Callback parameters Method : POST

TOKENS_FORWARDING_SUCCESS TOKENS_FORWARDING_FAIL

Content-Type : application/json

  • Object :

  • Required
    apiVersion string

    Specifies the version of the API that incorporates this endpoint.

    Example : 2.0
  • Required
    referenceId string

    Represents a unique identifier that serves as reference to the specific request which prompts a callback, e.g. Blockchain Events Subscription, Blockchain Automation, etc.

    Example : 6038d09050653d1f0e40584c
  • Required
    idempotencyKey string

    Specifies a unique ID generated by the system and attached to each callback. It is used by the server to recognize consecutive requests with the same data with the purpose not to perform the same operation twice.

    Example : e55bf7a4a7188855f1c27541a6c387d04cc3b22ee34d1304b0e6ecad61c9906c
  • Required
    data object

    Specifies all data, as attributes, included into the callback notification, which depends on the event.

    • Required
      product string

      Represents the Crypto APIs 2.0 product which sends the callback.

      Example : Blockchain Automations
    • Required
      event string

      Defines the specific event, for which a callback subscription is set.

      Example : TOKENS_FORWARDING_SUCCESS
    • Required
      item object

      Defines an item as one result.

      • Required
        blockchain string

        Represents the specific blockchain protocol name, e.g. Ethereum, Bitcoin, etc.

        Example : bitcoin
      • Required
        network string

        Represents the name of the blockchain network used; blockchain networks are usually identical as technology and software, but they differ in data, e.g. - "mainnet" is the live network with actual data while networks like "testnet", "ropsten", "rinkeby" are test networks.

        Example : testnet
      • Required
        fromAddress string

        Represents the hash of the address that provides the tokens.

        Example : mh8E9c2YDQvn8uRf47Wy4zCv2zHQzcdgkk
      • Required
        toAddress string

        Represents the hash of the address to forward the tokens to.

        Example : ms4KNsbNpoU8g424pzmEjbkFbfAHae1msB
      • Required
        spentFeesAmount string

        Represents the amount of the fee spent for the tokens to be forwarded.

        Example : 0.00013601
      • Required
        spentFeesUnit string

        Represents the unit of the fee spent for the tokens to be forwarded, e.g. BTC.

        Example : BTC
      • Required
        triggerTransactionId string

        Defines the unique Transaction ID that triggered the token forwarding.

        Example : 6ed1f1c8f2887a78ee8c45a975d928ca63eafc7b63def56324606ddd3cc9854f
      • Required
        forwardingTransactionId string

        Defines the unique Transaction ID that forwarded the tokens.

        Example : b15ab5bbaf5107d551ae1b50181f4c55959205c4ff843e3c10d86d00e690fc72
      • Required
        tokenType string

        Defines the type of token sent with the transaction, e.g. ERC 20.

        Example : omniLayerToken
        Possible Values : ethereumERC20Token ethereumERC721Token omniLayerToken
      • Required
        token object One Of
        object
        • Required
          name string

          Specifies the name of the token.

          Example : Tether USD
        • Required
          symbol string

          Specifies an identifier of the token, where up to five alphanumeric characters can be used for it.

          Example : USDT
        • Optional
          decimals string

          Defines how many decimals can be used to break the token.

          Example : 7
        • Required
          amount string

          Defines the amount of tokens sent with the confirmed transaction.

          Example : 9.5
        • Required
          contractAddress string

          Defines the address of the contract.

          Example : 0xdaF17f958d2ee523a2206206994597c13t831ec6
Try it out

Request Example

POST
https://rest.cryptoapis.io/v2/blockchain-automations/bitcoin/testnet/tokens-forwarding/automations
Headers
Host: https://rest.cryptoapis.io/v2
Content-Type: application/json
X-API-Key: my-api-key

Request Body
{
    "context": "",
    "data": {
        "item": {
            "callbackSecretKey": "yourSecretString",
            "callbackUrl": "https://example.com",
            "confirmationsCount": "3",
            "feePriority": "SLOW",
            "minimumTransferAmount": "0.00002",
            "toAddress": "tb1q54j7qcu7kgsrx87yn0r9zjdvsxrnvxg4qua2z6",
            "tokenData": {
                "propertyId": 31
            }
        }
    }
}

Response Example

{
    "apiVersion": "2.0",
    "requestId": "601c1710034ed6d407996b30",
    "context": "You can add any text here",
    "data": {
        "item": {
            "callbackUrl": "https://example.com",
            "confirmationsCount": 2,
            "createdTimestamp": 1611238648,
            "feeAddress": "mojjR51gMXLJ4B3SBPhEXXRFDX7U5UWXNQ",
            "feePriority": "STANDARD",
            "fromAddress": "ms4KNsbNpoU8g424pzmEjbkFbfAHae1msB",
            "minimumTransferAmount": "0.5",
            "referenceId": "6017dd02a309213863be9e55",
            "toAddress": "tb1q54j7qcu7kgsrx87yn0r9zjdvsxrnvxg4qua2z6",
            "tokenData": {
                "propertyId": 31
            }
        }
    }
}

Callback Example

{
    "apiVersion": "2.0",
    "referenceId": "6038d09050653d1f0e40584c",
    "idempotencyKey": "e55bf7a4a7188855f1c27541a6c387d04cc3b22ee34d1304b0e6ecad61c9906c",
    "data": {
        "product": "Blockchain Automations",
        "event": "TOKENS_FORWARDING_SUCCESS",
        "item": {
            "blockchain": "bitcoin",
            "network": "testnet",
            "fromAddress": "mh8E9c2YDQvn8uRf47Wy4zCv2zHQzcdgkk",
            "toAddress": "ms4KNsbNpoU8g424pzmEjbkFbfAHae1msB",
            "spentFeesAmount": "0.00013601",
            "spentFeesUnit": "BTC",
            "triggerTransactionId": "6ed1f1c8f2887a78ee8c45a975d928ca63eafc7b63def56324606ddd3cc9854f",
            "forwardingTransactionId": "b15ab5bbaf5107d551ae1b50181f4c55959205c4ff843e3c10d86d00e690fc72",
            "tokenType": "omniLayerToken",
            "token": {
                "name": "Tether USD",
                "symbol": "USDT",
                "decimals": "7",
                "amount": "9.5",
                "contractAddress": "0xdaF17f958d2ee523a2206206994597c13t831ec6"
            }
        }
    }
}