> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lootbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Top Affiliate Wagers

> Get the top wagers for an affiliate within a specified time period

Base URL: `BASE_URL` (provided upon API key issuance)

Returns a list of top wagers for an affiliate within a specified time period, sorted by total amount wagered.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST ${BASE_URL}/top-affiliate-wagers-by-period \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "startTimestamp": 1733115600,
    "endTimestamp": 1743480000,
    "numUsers": 10
  }'
  ```

  ```javascript Node theme={null}
  fetch('${BASE_URL}/top-affiliate-wagers-by-period', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      startTimestamp: 1733115600,
      endTimestamp: 1743480000,
      numUsers: 10
    })
  });
  ```

  ```python Python theme={null}
  import requests

  url = "${BASE_URL}/top-affiliate-wagers-by-period"
  headers = {
      "Authorization": "Bearer YOUR_API_KEY",
      "Content-Type": "application/json"
  }
  data = {
      "startTimestamp": 1733115600,
      "endTimestamp": 1743480000,
      "numUsers": 10
  }
  response = requests.post(url, headers=headers, json=data)
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init();

  curl_setopt($ch, CURLOPT_URL, "${BASE_URL}/top-affiliate-wagers-by-period");
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
      "startTimestamp" => 1733115600,
      "endTimestamp" => 1743480000,
      "numUsers" => 10
  ]));
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
      "Authorization: Bearer YOUR_API_KEY",
      "Content-Type: application/json"
  ]);

  $response = curl_exec($ch);
  curl_close($ch);
  ?>
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "data": [
      {
        "username": "player123",
        "avatar": "https://example.com/avatar.png",
        "totalWagered": 15000.50
      },
      {
        "username": "player456",
        "avatar": "https://example.com/avatar2.png",
        "totalWagered": 12000.75
      }
    ],
    "errors": null
  }
  ```
</ResponseExample>

## Authentication

<Note>
  This endpoint requires authentication using an API key in the Authorization header.
</Note>

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

## Parameters

<ParamField header="startTimestamp" type="number" required>
  Unix timestamp (in seconds) for the start of the period
</ParamField>

<ParamField header="endTimestamp" type="number" required>
  Unix timestamp (in seconds) for the end of the period
</ParamField>

<ParamField header="numUsers" type="number" required>
  Number of top wagers to return (1-100)
</ParamField>

## Validation Rules

<AccordionGroup>
  <Accordion title="Time Constraints">
    * Start timestamp cannot be older than December 2, 2024 (1733115600)
    * Both timestamps must be valid Unix timestamps
  </Accordion>

  <Accordion title="User Count">
    * Must be a valid integer
    * Must be greater than 0
    * Cannot exceed 100 users
  </Accordion>
</AccordionGroup>

## Error Responses

<ResponseField name="401" type="string">
  Unauthorized - Invalid or missing API key
</ResponseField>

<ResponseField name="400" type="string">
  Bad Request - Invalid parameters or validation errors
</ResponseField>

<ResponseField name="429" type="string">
  Rate Limit Exceeded - Too many requests
</ResponseField>

## Rate Limits

<Note>
  Rate limits are applied per API key. Please contact support for specific limits.
</Note>
