> For a complete page index, fetch https://docs.transak.com/llms.txt # Create Sell Order POST https://api-stg.transak.com/ledger/v1/sell Content-Type: application/json Create a sell order for the selected quote. The API also generates the payload and signature used by the Ledger device to verify transaction data with the corresponding private/public key pair. Reference: https://docs.transak.com/api/ledger-off-ramp/create-sell-order ## Servers - `https://api-stg.transak.com/ledger/v1` (Staging, default) - `https://api.transak.com/ledger/v1` (Production) ## Request ### Headers - `x-api-key` (string, required) — Transak API key available from the Transak Dashboard. ### Body (application/json) This endpoint expects a SellRequest. - `quoteId` (string, required) — Quote identifier returned from the quote endpoint. - `amount` (string, required) — Sell amount in crypto units. - `refundAddress` (string, required) — Refund wallet address. - `fromCryptoCurrency` (string, required) — Ledger-formatted crypto currency identifier. - `toFiatCurrency` (string, required) — Fiat currency code. - `payloadCryptoCurrency` (string, required) — Asset identifier used in the signed Ledger payload. - `nonce` (string, required) — Nonce used for device-side verification. ## Response ### 200 Sell order created successfully. - `sellId` (string, required) — Sell order identifier generated by the wrapper. - `amount` (string, required) — Confirmed sell amount. - `payinAddress` (string, required) — Deposit address where the user must send crypto. - `createdAt` (datetime, required) — Sell order creation timestamp. - `providerFees` (string, required) — Provider fee charged for the sell order. - `referralFees` (string, required) — Referral fee charged for the sell order. - `providerSig` (ProviderSignature, required) ## Errors ### 400 Bad Request Error Missing or invalid request. - `error` (ErrorResponseError, required) ### 500 Internal Server Error Internal server error. - `error` (ErrorResponseError, required) ## Types ### ProviderSignature - `payload` (string, required) — Encoded payload to be verified by the Ledger device. - `signature` (string, required) — Signature corresponding to the generated payload. ### ErrorResponseError - `messageKey` (string, required) - `message` (string, required) ## Examples **Request** ```json { "quoteId": "e8720a2a-2b19-4674-a68f-f4fc3d065c64", "amount": "68.99", "refundAddress": "tb1qrefundaddressexample", "fromCryptoCurrency": "bitcoin_testnet", "toFiatCurrency": "GBP", "payloadCryptoCurrency": "BTC", "nonce": "123456" } ``` **Response** ```json { "sellId": "44a353ce-0a3c-4e3e-95f7-2b34e07f63ba", "amount": "68.99", "payinAddress": "tb1qdm6wxntlp4xh4rydmqy3reweu6l6y25c7p7yx2", "createdAt": "2025-04-03T06:59:33.834Z", "providerFees": "3", "referralFees": "2.26", "providerSig": { "payload": "ChdhbnNodWwuZ2FyZ0B0cmFuc2FrLmNvbRIPYml0Y29pbl90ZXN0bmV0GgMBhqAiKnRiMXFkbTZ3eG50bHA0eGg0cnlkbXF5M3Jld2V1Nmw2eTI1YzdwN3l4MioDQlRDMgwKCAAAAAAAABrzEAI6IN5GF9rzEZhScN_z-jOZ42j6o3mC7I4QWZW0rx_ApcNV", "signature": "Qyfpgt_d4p_wEsbELNRYZ1KHc7TAvEuPfnjzW8JXryPMoVjOZk8NVpHtKJcLXMr5LvFrsKhHUdgJ9qwJpsN65g" } } ``` **SDK Code** ```python Success import requests url = "https://api-stg.transak.com/ledger/v1/sell" payload = { "quoteId": "e8720a2a-2b19-4674-a68f-f4fc3d065c64", "amount": "68.99", "refundAddress": "tb1qrefundaddressexample", "fromCryptoCurrency": "bitcoin_testnet", "toFiatCurrency": "GBP", "payloadCryptoCurrency": "BTC", "nonce": "123456" } headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Success const url = 'https://api-stg.transak.com/ledger/v1/sell'; const options = { method: 'POST', headers: {'x-api-key': '', 'Content-Type': 'application/json'}, body: '{"quoteId":"e8720a2a-2b19-4674-a68f-f4fc3d065c64","amount":"68.99","refundAddress":"tb1qrefundaddressexample","fromCryptoCurrency":"bitcoin_testnet","toFiatCurrency":"GBP","payloadCryptoCurrency":"BTC","nonce":"123456"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Success package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api-stg.transak.com/ledger/v1/sell" payload := strings.NewReader("{\n \"quoteId\": \"e8720a2a-2b19-4674-a68f-f4fc3d065c64\",\n \"amount\": \"68.99\",\n \"refundAddress\": \"tb1qrefundaddressexample\",\n \"fromCryptoCurrency\": \"bitcoin_testnet\",\n \"toFiatCurrency\": \"GBP\",\n \"payloadCryptoCurrency\": \"BTC\",\n \"nonce\": \"123456\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Success require 'uri' require 'net/http' url = URI("https://api-stg.transak.com/ledger/v1/sell") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"quoteId\": \"e8720a2a-2b19-4674-a68f-f4fc3d065c64\",\n \"amount\": \"68.99\",\n \"refundAddress\": \"tb1qrefundaddressexample\",\n \"fromCryptoCurrency\": \"bitcoin_testnet\",\n \"toFiatCurrency\": \"GBP\",\n \"payloadCryptoCurrency\": \"BTC\",\n \"nonce\": \"123456\"\n}" response = http.request(request) puts response.read_body ``` ```java Success import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api-stg.transak.com/ledger/v1/sell") .header("x-api-key", "") .header("Content-Type", "application/json") .body("{\n \"quoteId\": \"e8720a2a-2b19-4674-a68f-f4fc3d065c64\",\n \"amount\": \"68.99\",\n \"refundAddress\": \"tb1qrefundaddressexample\",\n \"fromCryptoCurrency\": \"bitcoin_testnet\",\n \"toFiatCurrency\": \"GBP\",\n \"payloadCryptoCurrency\": \"BTC\",\n \"nonce\": \"123456\"\n}") .asString(); ``` ```php Success request('POST', 'https://api-stg.transak.com/ledger/v1/sell', [ 'body' => '{ "quoteId": "e8720a2a-2b19-4674-a68f-f4fc3d065c64", "amount": "68.99", "refundAddress": "tb1qrefundaddressexample", "fromCryptoCurrency": "bitcoin_testnet", "toFiatCurrency": "GBP", "payloadCryptoCurrency": "BTC", "nonce": "123456" }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Success using RestSharp; var client = new RestClient("https://api-stg.transak.com/ledger/v1/sell"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"quoteId\": \"e8720a2a-2b19-4674-a68f-f4fc3d065c64\",\n \"amount\": \"68.99\",\n \"refundAddress\": \"tb1qrefundaddressexample\",\n \"fromCryptoCurrency\": \"bitcoin_testnet\",\n \"toFiatCurrency\": \"GBP\",\n \"payloadCryptoCurrency\": \"BTC\",\n \"nonce\": \"123456\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Success import Foundation let headers = [ "x-api-key": "", "Content-Type": "application/json" ] let parameters = [ "quoteId": "e8720a2a-2b19-4674-a68f-f4fc3d065c64", "amount": "68.99", "refundAddress": "tb1qrefundaddressexample", "fromCryptoCurrency": "bitcoin_testnet", "toFiatCurrency": "GBP", "payloadCryptoCurrency": "BTC", "nonce": "123456" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api-stg.transak.com/ledger/v1/sell")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```