> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://okx-demo.ferndocs.com/api/api-reference/block-trading/create-rfq/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://okx-demo.ferndocs.com/_mcp/server. # Create RFQ POST https://www.okx.com/api/v5/rfq/create-rfq Content-Type: application/json Create a new RFQ (request for quote), broadcasting a set of legs to selected counterparties who may respond with quotes. Reference: https://okx-demo.ferndocs.com/api/api-reference/block-trading/create-rfq ## Authentication - `OK-ACCESS-KEY` header (required) — Your API key. - `OK-ACCESS-SIGN` header (required) — Base64-encoded HMAC-SHA256 signature of the prehash string. - `OK-ACCESS-TIMESTAMP` header (required) — ISO 8601 UTC timestamp, e.g. 2020-12-08T09:08:57.715Z. - `OK-ACCESS-PASSPHRASE` header (required) — The passphrase you set when creating the API key. ## Request ### Body (application/json) This endpoint expects an object. - `counterparties` (list of ApiV5RfqCreateRfqPostRequestBodyContentApplicationJsonSchemaCounterpartiesItems, required) — The trader codes of counterparties this RFQ is sent to. - `legs` (list of ApiV5RfqCreateRfqPostRequestBodyContentApplicationJsonSchemaLegsItems, required) — An array of the legs that make up the RFQ. - `anonymous` (boolean, optional) — Whether the RFQ is anonymous to counterparties. Defaults to false. - `clRfqId` (string, optional) — Client-supplied RFQ ID. Alphanumeric string of up to 32 characters. - `tag` (string, optional) — RFQ tag. Alphanumeric string of up to 16 characters. - `allowPartialExecution` (boolean, optional) — Whether the RFQ allows partial execution of its quotes. Defaults to false. - `acctAlloc` (list of ApiV5RfqCreateRfqPostRequestBodyContentApplicationJsonSchemaAcctAllocItems, optional) — Sub-account allocation details for the RFQ legs. ## Response ### 200 Successful response - `code` (string, optional) — Result code. `0` means success; any other value is an error code. - `msg` (string, optional) — Error message. Empty on success. - `data` (list of ApiV5RfqCreateRfqPostResponsesContentApplicationJsonSchemaDataItems, optional) ## Types ### ApiV5RfqCreateRfqPostRequestBodyContentApplicationJsonSchemaCounterpartiesItems - `counterparty` (string, optional) — Trader code of a counterparty. ### ApiV5RfqCreateRfqPostRequestBodyContentApplicationJsonSchemaLegsItems - `instId` (string, optional) — Instrument ID, e.g. BTC-USDT-SWAP. - `sz` (string, optional) — Size of the leg in the instrument's contract or base currency. - `side` (enum, optional) — Side of the leg from the taker's perspective. - Allowed values: `buy`, `sell` - `tgtCcy` (string, optional) — Quantity type for spot legs: base_ccy or quote_ccy. Only applicable to SPOT. ### ApiV5RfqCreateRfqPostRequestBodyContentApplicationJsonSchemaAcctAllocItems - `acct` (string, optional) — Account to allocate to: main or the sub-account name. - `legs` (list of ApiV5RfqCreateRfqPostRequestBodyContentApplicationJsonSchemaAcctAllocItemsLegsItems, optional) — Allocation legs for this account. ### ApiV5RfqCreateRfqPostResponsesContentApplicationJsonSchemaDataItems - `cTime` (string, optional) — Creation time, Unix timestamp in milliseconds. - `uTime` (string, optional) — Update time, Unix timestamp in milliseconds. - `traderCode` (string, optional) — Trader code of the RFQ creator. - `rfqId` (string, optional) — RFQ ID generated by the system. - `clRfqId` (string, optional) — Client-supplied RFQ ID. - `state` (string, optional) — Status of the RFQ, e.g. active, canceled, filled, expired, traded_away. - `validUntil` (string, optional) — Expiration time of the RFQ, Unix timestamp in milliseconds. - `counterparties` (list of string, optional) — Counterparties this RFQ was sent to. - `legs` (list of ApiV5RfqCreateRfqPostResponsesContentApplicationJsonSchemaDataItemsLegsItems, optional) — Legs of the RFQ. - `groupId` (string, optional) — Group ID grouping related block trades from the same underlying strategy. - `acctAlloc` (list of ApiV5RfqCreateRfqPostResponsesContentApplicationJsonSchemaDataItemsAcctAllocItems, optional) — Sub-account allocation results. ### ApiV5RfqCreateRfqPostRequestBodyContentApplicationJsonSchemaAcctAllocItemsLegsItems - `sz` (string, optional) — Allocation size. - `instId` (string, optional) — Instrument ID. - `tdMode` (string, optional) — Trade mode: cross, isolated or cash. - `ccy` (string, optional) — Margin currency. - `posSide` (string, optional) — Position side: net, long or short. ### ApiV5RfqCreateRfqPostResponsesContentApplicationJsonSchemaDataItemsLegsItems - `instId` (string, optional) — Instrument ID. - `sz` (string, optional) — Leg size. - `side` (string, optional) — Leg side. - `tgtCcy` (string, optional) — Quantity type for spot legs. ### ApiV5RfqCreateRfqPostResponsesContentApplicationJsonSchemaDataItemsAcctAllocItems - `acct` (string, optional) — Account name. - `sCode` (string, optional) — Result code for the allocation. - `sMsg` (string, optional) — Result message for the allocation. - `legs` (list of ApiV5RfqCreateRfqPostResponsesContentApplicationJsonSchemaDataItemsAcctAllocItemsLegsItems, optional) — Allocated legs. ### ApiV5RfqCreateRfqPostResponsesContentApplicationJsonSchemaDataItemsAcctAllocItemsLegsItems - `instId` (string, optional) — Instrument ID. - `sz` (string, optional) — Allocation size. - `tdMode` (string, optional) — Trade mode. - `ccy` (string, optional) — Margin currency. - `posSide` (string, optional) — Position side. ## Examples **Request** ```json { "counterparties": [ {}, {} ], "legs": [ { "instId": "BTC-USDT", "sz": "25", "side": "buy" } ] } ``` **Response** ```json { "code": "0", "msg": "", "data": [ { "cTime": "1611033737572", "uTime": "1611033737572", "traderCode": "SATOSHI", "rfqId": "22534", "clRfqId": "rfq01", "state": "active", "validUntil": "1611033857557", "counterparties": [ "Trader1", "Trader2" ], "legs": [ { "instId": "BTC-USD-221208-100000-C", "sz": "25", "side": "buy", "tgtCcy": "", "ccy": "USDT", "posSide": "long", "tdMode": "cross" }, { "instId": "ETH-USDT", "sz": "150", "side": "buy", "tgtCcy": "base_ccy", "ccy": "USDT", "posSide": "long", "tdMode": "cross", "tradeQuoteCcy": "USDT" } ], "allowPartialExecution": false, "tag": "123456" } ] } ``` **SDK Code** ```python blockTrading_createRfq_example import requests url = "https://www.okx.com/api/v5/rfq/create-rfq" payload = { "counterparties": [{}, {}], "legs": [ { "instId": "BTC-USDT", "sz": "25", "side": "buy" } ] } headers = { "OK-ACCESS-KEY": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript blockTrading_createRfq_example const url = 'https://www.okx.com/api/v5/rfq/create-rfq'; const options = { method: 'POST', headers: {'OK-ACCESS-KEY': '', 'Content-Type': 'application/json'}, body: '{"counterparties":[{},{}],"legs":[{"instId":"BTC-USDT","sz":"25","side":"buy"}]}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go blockTrading_createRfq_example package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://www.okx.com/api/v5/rfq/create-rfq" payload := strings.NewReader("{\n \"counterparties\": [\n {},\n {}\n ],\n \"legs\": [\n {\n \"instId\": \"BTC-USDT\",\n \"sz\": \"25\",\n \"side\": \"buy\"\n }\n ]\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("OK-ACCESS-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 blockTrading_createRfq_example require 'uri' require 'net/http' url = URI("https://www.okx.com/api/v5/rfq/create-rfq") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["OK-ACCESS-KEY"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"counterparties\": [\n {},\n {}\n ],\n \"legs\": [\n {\n \"instId\": \"BTC-USDT\",\n \"sz\": \"25\",\n \"side\": \"buy\"\n }\n ]\n}" response = http.request(request) puts response.read_body ``` ```java blockTrading_createRfq_example import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://www.okx.com/api/v5/rfq/create-rfq") .header("OK-ACCESS-KEY", "") .header("Content-Type", "application/json") .body("{\n \"counterparties\": [\n {},\n {}\n ],\n \"legs\": [\n {\n \"instId\": \"BTC-USDT\",\n \"sz\": \"25\",\n \"side\": \"buy\"\n }\n ]\n}") .asString(); ``` ```php blockTrading_createRfq_example request('POST', 'https://www.okx.com/api/v5/rfq/create-rfq', [ 'body' => '{ "counterparties": [ {}, {} ], "legs": [ { "instId": "BTC-USDT", "sz": "25", "side": "buy" } ] }', 'headers' => [ 'Content-Type' => 'application/json', 'OK-ACCESS-KEY' => '', ], ]); echo $response->getBody(); ``` ```csharp blockTrading_createRfq_example using RestSharp; var client = new RestClient("https://www.okx.com/api/v5/rfq/create-rfq"); var request = new RestRequest(Method.POST); request.AddHeader("OK-ACCESS-KEY", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"counterparties\": [\n {},\n {}\n ],\n \"legs\": [\n {\n \"instId\": \"BTC-USDT\",\n \"sz\": \"25\",\n \"side\": \"buy\"\n }\n ]\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift blockTrading_createRfq_example import Foundation let headers = [ "OK-ACCESS-KEY": "", "Content-Type": "application/json" ] let parameters = [ "counterparties": [[], []], "legs": [ [ "instId": "BTC-USDT", "sz": "25", "side": "buy" ] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://www.okx.com/api/v5/rfq/create-rfq")! 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() ```