# Get Sell Redirect GET https://api-stg.transak.com/ledger/v1/sell-redirect Fetch the Transak widget redirect URL using the parameters supplied in Ledger's format. Use this endpoint after quote generation when you are ready to send the user into the hosted sell flow. Reference: https://docs.transak.com/api/ledger-off-ramp/get-sell-redirect ## OpenAPI Specification ```yaml openapi: 3.1.0 info: title: ledger-off-ramp-api version: 1.0.0 paths: /sell-redirect: get: operationId: get-sell-redirect summary: Get Sell Redirect description: >- Fetch the Transak widget redirect URL using the parameters supplied in Ledger's format. Use this endpoint after quote generation when you are ready to send the user into the hosted sell flow. tags: - '' parameters: - name: accountId in: query description: Ledger account ID. required: true schema: type: string - name: cryptoCurrency in: query description: Ledger ID for the selected crypto currency. required: true schema: type: string - name: fiatCurrency in: query description: Selected fiat currency code. required: true schema: type: string - name: cryptoAmount in: query description: Selected crypto amount. required: true schema: type: string - name: paymentMethod in: query description: Selected Ledger payment method. required: true schema: type: string - name: mode in: query description: Selected mode (`buy` or `sell`). required: true schema: type: string - name: bankResidency in: query description: User country code in ISO 3166-1 alpha-2 format. required: true schema: type: string - name: ledgerTransactionId in: query description: User's Ledger transaction identifier (order ID). required: true schema: type: string - name: x-api-key in: header description: Transak API key available from the Transak Dashboard. required: true schema: type: string responses: '200': description: Redirect URL generated successfully. content: application/json: schema: $ref: '#/components/schemas/SellRedirectResponse' '400': description: Missing or invalid request. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '500': description: Internal server error. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' servers: - url: https://api-stg.transak.com/ledger/v1 - url: https://api.transak.com/ledger/v1 components: schemas: SellRedirectResponse: type: object properties: rampRedirectUrl: type: string format: uri description: Redirect URL for launching the Transak sell flow. required: - rampRedirectUrl title: SellRedirectResponse ErrorResponseError: type: object properties: messageKey: type: string message: type: string required: - messageKey - message title: ErrorResponseError ErrorResponse: type: object properties: error: $ref: '#/components/schemas/ErrorResponseError' required: - error title: ErrorResponse securitySchemes: ApiKeyAuth: type: apiKey in: header name: x-api-key description: Transak API key available from the Transak Dashboard. ``` ## SDK Code Examples ```python success import requests url = "https://api-stg.transak.com/ledger/v1/sell-redirect" querystring = {"accountId":"test-account-id","cryptoCurrency":"polygon_mainnet/erc20/usdc","fiatCurrency":"EUR","cryptoAmount":"20","paymentMethod":"card","mode":"sell","bankResidency":"GB","ledgerTransactionId":"test-order-id"} headers = {"x-api-key": ""} response = requests.get(url, headers=headers, params=querystring) print(response.json()) ``` ```javascript success const url = 'https://api-stg.transak.com/ledger/v1/sell-redirect?accountId=test-account-id&cryptoCurrency=polygon_mainnet%2Ferc20%2Fusdc&fiatCurrency=EUR&cryptoAmount=20&paymentMethod=card&mode=sell&bankResidency=GB&ledgerTransactionId=test-order-id'; const options = {method: 'GET', headers: {'x-api-key': ''}}; 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" "net/http" "io" ) func main() { url := "https://api-stg.transak.com/ledger/v1/sell-redirect?accountId=test-account-id&cryptoCurrency=polygon_mainnet%2Ferc20%2Fusdc&fiatCurrency=EUR&cryptoAmount=20&paymentMethod=card&mode=sell&bankResidency=GB&ledgerTransactionId=test-order-id" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("x-api-key", "") 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-redirect?accountId=test-account-id&cryptoCurrency=polygon_mainnet%2Ferc20%2Fusdc&fiatCurrency=EUR&cryptoAmount=20&paymentMethod=card&mode=sell&bankResidency=GB&ledgerTransactionId=test-order-id") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["x-api-key"] = '' 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.get("https://api-stg.transak.com/ledger/v1/sell-redirect?accountId=test-account-id&cryptoCurrency=polygon_mainnet%2Ferc20%2Fusdc&fiatCurrency=EUR&cryptoAmount=20&paymentMethod=card&mode=sell&bankResidency=GB&ledgerTransactionId=test-order-id") .header("x-api-key", "") .asString(); ``` ```php success request('GET', 'https://api-stg.transak.com/ledger/v1/sell-redirect?accountId=test-account-id&cryptoCurrency=polygon_mainnet%2Ferc20%2Fusdc&fiatCurrency=EUR&cryptoAmount=20&paymentMethod=card&mode=sell&bankResidency=GB&ledgerTransactionId=test-order-id', [ 'headers' => [ 'x-api-key' => '', ], ]); echo $response->getBody(); ``` ```csharp success using RestSharp; var client = new RestClient("https://api-stg.transak.com/ledger/v1/sell-redirect?accountId=test-account-id&cryptoCurrency=polygon_mainnet%2Ferc20%2Fusdc&fiatCurrency=EUR&cryptoAmount=20&paymentMethod=card&mode=sell&bankResidency=GB&ledgerTransactionId=test-order-id"); var request = new RestRequest(Method.GET); request.AddHeader("x-api-key", ""); IRestResponse response = client.Execute(request); ``` ```swift success import Foundation let headers = ["x-api-key": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://api-stg.transak.com/ledger/v1/sell-redirect?accountId=test-account-id&cryptoCurrency=polygon_mainnet%2Ferc20%2Fusdc&fiatCurrency=EUR&cryptoAmount=20&paymentMethod=card&mode=sell&bankResidency=GB&ledgerTransactionId=test-order-id")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers 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() ```