Creating the Withdrawal

A withdrawal transaction is created using the Create transaction request endpoint.

Request Breakdown

The details to be sent in this request are detailed below:

FieldDescription
assetPoolIdThe unique identifier of the asset pool.
assetThe type of cryptocurrency asset.
networkThe blockchain network where the asset is hosted.
referenceA unique reference for the transaction.
destinations[]An array containing the destination details for the withdrawal.
destinations.addressThe crypto address where the funds will be sent.
destinations.amountThe amount of cryptocurrency to be sent to the address.
destinations.assetThe type of cryptocurrency asset to be sent to the address, matching the address type.

Example Request

Here is how an example request might look:

curl --location 'https://api.sandbox.layer1.com/digital/v1/transaction-requests' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
  "assetPoolId": "2be1cc9c-a5af-47e2-9dba-b7b82317e600",
  "asset": "ETH",
  "network": "ETHEREUM",
  "reference": "myUniqueRef333",
  "destinations": [
    {
      "address": "0x84A4a239805d06c685219801B82BEA7c76702214",
      "amount": "0.001",
      "asset": "ETH"
    }
  ]
}'

Example Response

Upon successfully submitting the transaction request, you would get the the following responsin in JSON format:

{
    "requestId": "018fef0a-ab15-7afb-966b-7d20c89b5504",
    "asset": "ETH",
    "assetPoolId": "2be1cc9c-a5af-47e2-9dba-b7b82317e600",
    "network": "ETHEREUM",
    "reference": "myUniqueRef333",
    "status": "CREATED",
    "sources": [],
    "destinations": [
        {
            "address": "0x84A4a239805d06c685219801B82BEA7c76702214",
            "amount": "0.001"
        }
    ],
    "type": "WITHDRAWAL",
    "createdAt": "2024-06-06T19:33:24.885Z"
}

The resulting fields in the response are given as:

FieldDescription
requestIdThe unique identifier of the request.
assetThe type of cryptocurrency asset.
assetPoolIdThe unique identifier of the asset pool.
networkThe blockchain network where the asset is hosted.
referenceA unique reference for the transaction.
statusThe current status of the transaction.
sourcesAn array containing the source details for the withdrawal.
destinationsAn array containing the destination details for the withdrawal.
destinations.addressThe crypto address where the funds will be sent.
destinations.amountThe amount of cryptocurrency to be sent to the address.
typeThe type of transaction.
createdAtThe timestamp when the transaction was created in ISO 8601 format.

The withdrawal has now been actioned and will move throughout the flow described previously. the requestId can be used along with the Get transaction request endpoint to poll the withdrawal at any point.

At this point, the layer1 platform will start sending out webhooks related to the withdrwal, which will be covered in the next section.