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

# Get Monthly Trades

POST https://sandbox.currenciesdirect.com/v1/affiliates/trades/month
Content-Type: application/json

Retrieve the trades completed by an affiliate's customers during a statement month. Each trade includes the currency pair, turnover, profit and the commission earned.

**Authentication:** [Bearer token required](/api-guide/getting-started/authentication#oauth-20-authentication)


Reference: https://docs.redpincompany.com/api-reference/affiliate-reporting/get-monthly-trades

## Authentication

- `Authorization` header (bearer token, required) — OAuth 2.0 Bearer token authentication. This API uses OAuth 2.0 Client Credentials flow. Please refer to the [Authentication](/api-guide/getting-started/authentication#oauth-20-authentication) section for detailed information on how to obtain and use your OAuth credentials.

## Servers

- `https://sandbox.currenciesdirect.com` (Sandbox, default)
- `https://api.redpincompany.com` (Production)

## Request

### Body (application/json)

This endpoint expects a StatementMonthRequest.

- `affiliate_number` (list of string, required) — List of affiliate numbers to include in the report. Redpin issues an affiliate number to each affiliate partner. Records for all listed affiliate numbers are returned together in a single response.
- `statement_year` (string, required) — Year of the statement period in four-digit format (e.g., 2022). Sent as a string.
- `statement_month` (string, required) — Month of the statement period as a number from 1 to 12 (e.g., 7 for July). Sent as a string.

## Response

### 200

OK. Everything worked as expected. Monthly trades retrieved successfully.

- `trades` (list of MonthlyTrade, required) — Array of trade objects containing details of all trades completed during the statement month.

## Errors

### 400 Bad Request Error

Bad Request. Malformed request. You will receive this error if the request body does not validate with the schema. The error code will help you determine the cause of the issue.

- `code` (string, required) — Machine-readable error code.
- `description` (string, required) — Human-readable error description.

### 401 Unauthorized Error

Unauthorized. You have not included a valid Access token, it has expired, or you entered incorrect credentials.

- `code` (string, required) — Machine-readable error code.
- `description` (string, required) — Human-readable error description.

### 500 Internal Server Error

Internal Server Error. Something has gone wrong on the website's server, but the server could not be more specific on what the exact problem is.

- `code` (string, required) — Machine-readable error code.
- `description` (string, required) — Human-readable error description.

## Types

### MonthlyTrade

A trade completed by a customer referred under one of the requested affiliate numbers.

- `sold` (string, required) — Currency the customer sold, in [ISO 4217 Currency Codes](https://en.wikipedia.org/wiki/ISO_4217) three-letter format (e.g., GBP, USD, EUR).
- `profitcurrency` (string, required) — Currency of `profit`, in [ISO 4217 Currency Codes](https://en.wikipedia.org/wiki/ISO_4217) three-letter format (e.g., GBP, USD, EUR).
- `clientid` (string, required) — Redpin client identifier of the customer who completed the trade. Matches `clientid` in the [Get Monthly Registrations](/api-reference/affiliate-reporting/get-monthly-registrations) response.
- `closeddate` (date, required) — Date the trade closed, in `YYYY-MM-DD` format.
- `bought` (string, required) — Currency the customer bought, in [ISO 4217 Currency Codes](https://en.wikipedia.org/wiki/ISO_4217) three-letter format (e.g., GBP, USD, EUR).
- `type` (string, required) — Type of customer. Possible values are `Personal` or `Business`.
- `dealnumber` (string, required) — Unique identifier of the trade. Use this value to match the trade to its record in the [Get Monthly Commissions](/api-reference/affiliate-reporting/get-monthly-commissions) response.
- `commissioncurrency` (string, required) — Currency of `commission`, in [ISO 4217 Currency Codes](https://en.wikipedia.org/wiki/ISO_4217) three-letter format (e.g., GBP, USD, EUR).
- `uid` (string, required) — Unique identifier of the referral, as supplied by the affiliate. Returns `null` if no identifier was supplied.
- `isfirsttrade` (boolean, required) — Indicates whether this is the customer's first trade. `true` for the first trade, otherwise `false`.
- `commission` (string, required) — Commission earned on the trade, in `commissioncurrency`. Returned as a string representation of a decimal with 2 decimal places.
- `turnover` (string, required) — Value of the trade. Returned as a string representation of a decimal with 8 decimal places.
- `profit` (string, required) — Profit on the trade, in `profitcurrency`. Returned as a string representation of a decimal with 8 decimal places.
- `trackingid` (string, required) — Campaign tracking identifier associated with the customer. Returns `null` if no tracking identifier was supplied.

## Examples

**Request**

```json
{
  "affiliate_number": [
    "A060001"
  ],
  "statement_year": "2022",
  "statement_month": "7"
}
```

**Response**

```json
{
  "trades": [
    {
      "sold": "GBP",
      "profitcurrency": "GBP",
      "clientid": "0201001006802081",
      "closeddate": "2022-07-13",
      "bought": "EUR",
      "type": "Personal",
      "dealnumber": "0201001006802081-000000001",
      "commissioncurrency": "GBP",
      "uid": "7hQwRt2LmX",
      "isfirsttrade": true,
      "commission": "0.00",
      "turnover": "18000.00000000",
      "profit": "203.13000000",
      "trackingid": "TRK10234"
    }
  ]
}
```

**SDK Code**

```python Monthly Trades
import requests

url = "https://sandbox.currenciesdirect.com/v1/affiliates/trades/month"

payload = {
    "affiliate_number": ["A060001"],
    "statement_year": "2022",
    "statement_month": "7"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Monthly Trades
const url = 'https://sandbox.currenciesdirect.com/v1/affiliates/trades/month';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"affiliate_number":["A060001"],"statement_year":"2022","statement_month":"7"}'
};

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

```go Monthly Trades
package main

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

func main() {

	url := "https://sandbox.currenciesdirect.com/v1/affiliates/trades/month"

	payload := strings.NewReader("{\n  \"affiliate_number\": [\n    \"A060001\"\n  ],\n  \"statement_year\": \"2022\",\n  \"statement_month\": \"7\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	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 Monthly Trades
require 'uri'
require 'net/http'

url = URI("https://sandbox.currenciesdirect.com/v1/affiliates/trades/month")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"affiliate_number\": [\n    \"A060001\"\n  ],\n  \"statement_year\": \"2022\",\n  \"statement_month\": \"7\"\n}"

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

```java Monthly Trades
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://sandbox.currenciesdirect.com/v1/affiliates/trades/month")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"affiliate_number\": [\n    \"A060001\"\n  ],\n  \"statement_year\": \"2022\",\n  \"statement_month\": \"7\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://sandbox.currenciesdirect.com/v1/affiliates/trades/month', [
  'body' => '{
  "affiliate_number": [
    "A060001"
  ],
  "statement_year": "2022",
  "statement_month": "7"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Monthly Trades
using RestSharp;

var client = new RestClient("https://sandbox.currenciesdirect.com/v1/affiliates/trades/month");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"affiliate_number\": [\n    \"A060001\"\n  ],\n  \"statement_year\": \"2022\",\n  \"statement_month\": \"7\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Monthly Trades
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "affiliate_number": ["A060001"],
  "statement_year": "2022",
  "statement_month": "7"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://sandbox.currenciesdirect.com/v1/affiliates/trades/month")! 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()
```