Withdrawals

The API allows you to trigger immediate withdrawals, as well search for old withdrawals using filters and receive information for a single withdrawal.

The Withdrawal object

The Withdrawal object includes the relevant details about a withdrawal.

This object might contain parameters and values not documented in the API Reference, which should be disregarded.

Properties

  • Name
    id
    Type
    string
    Description

    Unique identifier for the withdrawal.

  • Name
    blockchain
    Type
    string
    Description

    Blockchain network code for this withdrawal.

  • Name
    destinationAddress
    Type
    string
    Description

    The destination address where tokens were transferred to.

  • Name
    amount
    Type
    money
    Description

    The amount withdrawn.

  • Name
    status
    Type
    string
    Description

    The status of the withdrawal, the possible values are the following:

    1. New
    2. Running
    3. Paused
    4. Finished
    5. Cancelled
    6. Error

POST/v1/withdrawals/withdraw-now

Trigger a withdrawal

This endpoint allows you to trigger the immediate withdraw for the currency. All accumulated tokens of this currency will be withdrawn.

Required attributes

  • Name
    merchantId
    Type
    string
    Description

    The identifier of the merchant this payment is related to.

  • Name
    currency
    Type
    string
    Description

    Currency code indicating what type of tokens to withdraw.

Error codes

If something goes wrong during the processing of this request the error code in standard format is returned.

See error codes

Request

POST
/v1/withdrawals/withdraw-now
curl --request POST \
  --url https://partner-api.smartypay.io/v1/withdrawals/withdraw-now \
  --user API_KEY:SECRET \
  --header 'content-type: application/json' \
  --data '{
    "currency": "bUSDT",
    "merchantId": "RgFw2p65CQn3pE8uriL53d"
}'

Response

{
    "intent": {
        "blockchain": "BinanceMainNet",
        "currency": "bUSDT",
        "id": "SxzNzHmWUsESHzYCqdFzw1",
        "processAt": "2023-12-15T20:08:16.640232Z",
        "status": "Pending"
    },
    "merchantId": "9xBoSUdGWeiAzMn5VHBvMB"
}

POST/v1/withdrawals/search

Search for withdrawals

This endpoint allows you to retrieve a paginated list of withdrawals that optionally can be filtered based on the predicates defined below.

Predicates are combined with AND semantics.

Read more about pagination

Optional attributes

  • Name
    page
    Type
    object
    Description

    Defines pagination and sorting options.

  • Name
    predicates.network
    Type
    string
    Description

    Type of blockchain network MainNet or TestNet.

Request

POST
/v1/withdrawals/search
curl --request POST \
  --url https://partner-api.smartypay.io/v1/withdrawals/search \
  --user API_KEY:SECRET \
  --header 'content-type: application/json' \
  --data '{
    "predicates": {
        "network": "TestNet"
    },
    "page": {
        "limit": 5
    }
}'

Response

{
    "list": [
        {
            "id": "BuDXTw3Dse5iRfkwsSpdec",
            "blockchain": "BinanceTestNet",
            "destinationAddress": "0x7aa002968e2B68b4803cbE15DdfdEe1488550180",
            "amount": {
                "currency": "bUSDT",
                "value": "10"
            },
            "status": "Finished"
        },
        {
            "id": "rFI995vUhSIhXBhNe8Xv7x"
            // ...
        }
    ],
    "page": {
        "limit": 5,
        "offset": 0
    },
}

GET/v1/withdrawals/{withdrawalId}

Retrieve a withdrawal

This endpoint allows you to retrieve a withdrawal by providing their unique id.

Refer to the list at the top of this page to see which properties are included with withdrawals objects.

Request

GET
/v1/withdrawals/{withdrawalId}
curl https://partner-api.smartypay.io/v1/withdrawals/BuDXTw3Dse5iRfkwsSpdec \
  --user API_KEY:SECRET

Response

{
    "id": "BuDXTw3Dse5iRfkwsSpdec",
    "blockchain": "BinanceTestNet",
    "destinationAddress": "0x7aa002968e2B68b4803cbE15DdfdEe1488550180",
    "amount": {
        "currency": "bUSDT",
        "value": "10"
    },
    "status": "Finished"
},

Error codes

In case of error, you will receive the standard error object as a response with the following possible error codes. Use this code to handle them in an appropriate way.

The error codes listed below are only related to one-times payments; some generic errors might be also returned.

CodeHTTP CodeDescription
WithdrawalNotFound404Withdrawal Intent not found