GET /affiliates/{id}/conversions

Get affiliate conversions

Affiliates

Description

Retrieve a paginated list of conversions for a specific affiliate business.
Returns conversion data from the analytics database.

Authentication Required: User must be authenticated and have the 'affiliate' role.

Users can only view conversions for their own affiliate businesses.

Parameters

id integer path required
affiliate ID
page integer query
Page number for pagination (defaults to 1)
start_date string query
Start date for filtering conversions (ISO 8601 format). Defaults to 30 days ago.
end_date string query
End date for filtering conversions (ISO 8601 format). Defaults to current time.

Responses

200 Successful response with paginated conversions
application/json
statusstring
Example: success
dataarray
current_pageinteger
Current page number
total_resultsinteger
Total number of conversions
total_pagesinteger
Total number of pages
Example:
{
  "status": "success",
  "data": [
    {
      "id": 45,
      "created_at": "2025-09-29 10:45:00",
      "basket_price": 110.6,
      "merchant_id": 1,
      "basket_items": [
        {
          "id": 1,
          "ean": "0194252096147",
          "price": 110.6,
          "commission_rate": 5.0,
          "status": "accepted"
        }
      ],
      "status": "accepted",
      "total_commission": 5.53,
      "reward": "pending"
    },
    {
      "id": 44,
      "created_at": "2025-09-28 15:30:00",
      "basket_price": 249.99,
      "merchant_id": 2,
      "basket_items": [
        {
          "id": 2,
          "ean": "1234567890123",
          "price": 149.99,
          "commission_rate": 7.5,
          "status": "accepted"
        },
        {
          "id": 3,
          "ean": "9876543210987",
          "price": 100.0,
          "commission_rate": 5.0,
          "status": "pending"
        }
      ],
      "status": "accepted",
      "total_commission": 11.25,
      "reward": "pending"
    }
  ],
  "current_page": 1,
  "total_results": 150,
  "total_pages": 5
}
401 Authentication required
application/json
Example:
{
  "status": "error",
  "message": "Not authenticated or insufficient permissions"
}
404 Affiliate not found or page not found
application/json
Example:
{
  "status": "error",
  "message": "Affiliate not found"
}
500 Internal server error (e.g., database connection failure)
application/json
statusstring
Example: error
messagestring
Example: Failed to fetch conversions
errorstring
Example: Database connection failed