> This page is for API Reference.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://okx-demo.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://okx-demo.ferndocs.com/_mcp/server.

# Get RFQ trades

GET https://www.okx.com/api/v5/rfq/trades

Retrieve the executed block trades that the user has participated in, either as taker or maker.

Reference: https://okx-demo.ferndocs.com/api/api-reference/block-trading/get-trades

## 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

### Query parameters

- `rfqId` (string, optional) — RFQ ID to filter by.
- `clRfqId` (string, optional) — Client-supplied RFQ ID to filter by.
- `quoteId` (string, optional) — Quote ID to filter by.
- `clQuoteId` (string, optional) — Client-supplied quote ID to filter by.
- `state` (string, optional) — State of the block trade to filter by.
- `beginId` (string, optional) — Pagination: request records newer than (but not including) this block trade ID.
- `endId` (string, optional) — Pagination: request records older than (but not including) this block trade ID.
- `beginTs` (string, optional) — Filter with a begin timestamp, Unix timestamp in milliseconds.
- `endTs` (string, optional) — Filter with an end timestamp, Unix timestamp in milliseconds.
- `limit` (string, optional) — Number of results per request. Maximum and default are both 100.

## 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 ApiV5RfqTradesGetResponsesContentApplicationJsonSchemaDataItems, optional)

## Types

### ApiV5RfqTradesGetResponsesContentApplicationJsonSchemaDataItems

- `rfqId` (string, optional) — RFQ ID.
- `clRfqId` (string, optional) — Client-supplied RFQ ID.
- `quoteId` (string, optional) — Quote ID.
- `clQuoteId` (string, optional) — Client-supplied quote ID.
- `blockTdId` (string, optional) — Block trade ID.
- `tag` (string, optional) — RFQ tag.
- `isSuccessful` (boolean, optional) — Whether the block trade was executed successfully.
- `errorCode` (string, optional) — Error code if the block trade failed.
- `cTime` (string, optional) — Creation time, Unix timestamp in milliseconds.
- `tTraderCode` (string, optional) — Trader code of the taker.
- `mTraderCode` (string, optional) — Trader code of the maker.
- `legs` (list of ApiV5RfqTradesGetResponsesContentApplicationJsonSchemaDataItemsLegsItems, optional) — Legs of the block trade.
- `groupId` (string, optional) — Group ID for related block trades.

### ApiV5RfqTradesGetResponsesContentApplicationJsonSchemaDataItemsLegsItems

- `instId` (string, optional) — Instrument ID.
- `side` (string, optional) — Side of the leg.
- `sz` (string, optional) — Size of the leg.
- `px` (string, optional) — Execution price of the leg.
- `tradeId` (string, optional) — Last trade ID.
- `fee` (string, optional) — Fee. Negative means a rebate.
- `feeCcy` (string, optional) — Fee currency.
- `tradeQuoteCcy` (string, optional) — Quote currency used for the trade.

## Examples

**Response**

```json
{
  "code": "0",
  "msg": "",
  "data": [
    {
      "rfqId": "123456",
      "clRfqId": "",
      "quoteId": "0T5342O",
      "clQuoteId": "",
      "blockTdId": "439127542058958848",
      "tag": "123456",
      "isSuccessful": true,
      "errorCode": "",
      "cTime": "1650968164900",
      "tTraderCode": "SATS",
      "mTraderCode": "MIKE",
      "legs": [
        {
          "instId": "BTC-USDT",
          "side": "sell",
          "sz": "0.666",
          "px": "100",
          "tradeId": "439127542058958850",
          "fee": "-0.0333",
          "feeCcy": "USDT",
          "tradeQuoteCcy": "USDT"
        }
      ]
    },
    {
      "rfqId": "1234567",
      "clRfqId": "",
      "quoteId": "0T533T0",
      "clQuoteId": "",
      "blockTdId": "439121886014849024",
      "tag": "123456",
      "isSuccessful": true,
      "errorCode": "",
      "cTime": "1650966816550",
      "tTraderCode": "SATS",
      "mTraderCode": "MIKE",
      "legs": [
        {
          "instId": "BTC-USDT",
          "side": "sell",
          "sz": "0.532",
          "px": "100",
          "tradeId": "439121886014849026",
          "fee": "-0.0266",
          "feeCcy": "USDT",
          "tradeQuoteCcy": "USDT"
        }
      ]
    }
  ]
}
```

**SDK Code**

```python blockTrading_getTrades_example
import requests

url = "https://www.okx.com/api/v5/rfq/trades"

headers = {"OK-ACCESS-KEY": "<apiKey>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript blockTrading_getTrades_example
const url = 'https://www.okx.com/api/v5/rfq/trades';
const options = {method: 'GET', headers: {'OK-ACCESS-KEY': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go blockTrading_getTrades_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://www.okx.com/api/v5/rfq/trades"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("OK-ACCESS-KEY", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby blockTrading_getTrades_example
require 'uri'
require 'net/http'

url = URI("https://www.okx.com/api/v5/rfq/trades")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["OK-ACCESS-KEY"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java blockTrading_getTrades_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://www.okx.com/api/v5/rfq/trades")
  .header("OK-ACCESS-KEY", "<apiKey>")
  .asString();
```

```php blockTrading_getTrades_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://www.okx.com/api/v5/rfq/trades', [
  'headers' => [
    'OK-ACCESS-KEY' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp blockTrading_getTrades_example
using RestSharp;

var client = new RestClient("https://www.okx.com/api/v5/rfq/trades");
var request = new RestRequest(Method.GET);
request.AddHeader("OK-ACCESS-KEY", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift blockTrading_getTrades_example
import Foundation

let headers = ["OK-ACCESS-KEY": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://www.okx.com/api/v5/rfq/trades")! 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()
```