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

# Get Leaderboard

GET https://api.customerhub.com/web_api/leaderboard

Return the ranked member leaderboard plus the viewer's own entry.

**Authentication:** Required — Bearer token.

**Feature gate:** Requires both `show_leaderboard` and `directory_enabled`. When either is off, returns `{ data: { period, data: [] } }`.

**Query parameters:**

* `period` (optional, default `all_time`)
* `limit` (optional, default 25, max 250)

**Response:**

* `data.data` — Array of ranked entries (`rank`, `score`, user info, counts, `current_streak`, `top_achievements`, `online`)
* `data.viewer` — The viewer's own entry (always `online: true`)
* `data.period` — The active period

Reference: https://customerhub.com/api/api-reference/leaderboard/get-leaderboard

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Query parameters

- `period` (string, optional) — Leaderboard period (default all_time)
- `limit` (string, optional) — Number of entries (default 25, max 250)

## Response

### 200

OK

## Examples

**Response**

```json
{
  "data": {
    "data": [
      {
        "avatar_url": null,
        "comments_count": 4,
        "current_streak": 7,
        "likes_received_count": 30,
        "name": "Jane",
        "online": false,
        "posts_count": 10,
        "products_completed_count": 2,
        "rank": 1,
        "score": 120,
        "top_achievements": [
          {
            "achievement_type": "posts",
            "badge_url": null,
            "color": "#FFC107",
            "description": "Publish your first post",
            "id": 9,
            "name": "First Post",
            "slug": "first-post",
            "threshold": 1,
            "unlocked_at": "2026-05-01T10:00:00Z"
          }
        ],
        "user_id": 5
      }
    ],
    "period": "all_time",
    "viewer": {
      "avatar_url": null,
      "comments_count": 1,
      "current_streak": 2,
      "likes_received_count": 5,
      "name": "Bob",
      "online": true,
      "posts_count": 3,
      "products_completed_count": 1,
      "rank": 8,
      "score": 42,
      "top_achievements": [],
      "user_id": 7
    }
  }
}
```

**SDK Code**

```python Leaderboard_getLeaderboard_example
import requests

url = "https://api.customerhub.com/web_api/leaderboard"

querystring = {"limit":"25","period":"all_time"}

headers = {"Authorization": "Bearer <token>"}

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

print(response.json())
```

```javascript Leaderboard_getLeaderboard_example
const url = 'https://api.customerhub.com/web_api/leaderboard?limit=25&period=all_time';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

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

```go Leaderboard_getLeaderboard_example
package main

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

func main() {

	url := "https://api.customerhub.com/web_api/leaderboard?limit=25&period=all_time"

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

	req.Header.Add("Authorization", "Bearer <token>")

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

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

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

}
```

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

url = URI("https://api.customerhub.com/web_api/leaderboard?limit=25&period=all_time")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

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

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

HttpResponse<String> response = Unirest.get("https://api.customerhub.com/web_api/leaderboard?limit=25&period=all_time")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.customerhub.com/web_api/leaderboard?limit=25&period=all_time', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp Leaderboard_getLeaderboard_example
using RestSharp;

var client = new RestClient("https://api.customerhub.com/web_api/leaderboard?limit=25&period=all_time");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Leaderboard_getLeaderboard_example
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.customerhub.com/web_api/leaderboard?limit=25&period=all_time")! 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()
```