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

# List Trending Posts

GET https://api.customerhub.com/web_api/posts/trending

List up to 6 trending posts from the last 30 days, ordered by featured status then engagement (likes + comments) then recency.

**Authentication:** Public with visitor fallback — visitors see public posts when `public_content` is enabled.

**Feature gate:** Requires `posts` feature enabled.

**Response:**
- `data.posts` — Array of post objects (same shape as the feed)
- `data.page` — 1
- `data.paging` — null (trending is not paginated)
- `data.members_count` — 0

Reference: https://customerhub.com/api/api-reference/posts-feed/list-trending-posts

## Authentication

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

## Response

### 200

OK

## Examples

**Response**

```json
{
  "data": {
    "members_count": 0,
    "page": 1,
    "paging": null,
    "paywall": null,
    "posts": [
      {
        "admin": {
          "avatar_url": null,
          "id": "3871650b-9df5-4373-ab19-02f41c3c5a7f",
          "name": "Joe Schmoe",
          "profile_user_id": null
        },
        "allow_comments": true,
        "approved": false,
        "audience": "users",
        "audience_type": "users",
        "body": "Post content",
        "comments_count": 2,
        "cosmic_id": "io-992f",
        "cosmic_tier": 1,
        "created_at": "2026-09-16 15:32:12 UTC",
        "featured": false,
        "id": "b6d25a7f-651e-4d8e-a21d-242f9851a15e",
        "is_following_author": false,
        "is_own": false,
        "liked": false,
        "likes_count": 0,
        "links": [],
        "media": null,
        "published": true,
        "published_at": "2026-09-16 15:32:12 UTC",
        "reposted": false,
        "reposted_post": null,
        "reposts_count": 0,
        "show_title": true,
        "slug": "welcome-post",
        "space_slugs": [],
        "title": "Welcome to the community",
        "unread": false,
        "updated_at": "2026-09-16 15:32:13 UTC",
        "user": null
      }
    ]
  }
}
```

**SDK Code**

```python Posts & Feed_listTrendingPosts_example
import requests

url = "https://api.customerhub.com/web_api/posts/trending"

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

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

print(response.json())
```

```javascript Posts & Feed_listTrendingPosts_example
const url = 'https://api.customerhub.com/web_api/posts/trending';
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 Posts & Feed_listTrendingPosts_example
package main

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

func main() {

	url := "https://api.customerhub.com/web_api/posts/trending"

	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 Posts & Feed_listTrendingPosts_example
require 'uri'
require 'net/http'

url = URI("https://api.customerhub.com/web_api/posts/trending")

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 Posts & Feed_listTrendingPosts_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.customerhub.com/web_api/posts/trending")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php Posts & Feed_listTrendingPosts_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.customerhub.com/web_api/posts/trending', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp Posts & Feed_listTrendingPosts_example
using RestSharp;

var client = new RestClient("https://api.customerhub.com/web_api/posts/trending");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Posts & Feed_listTrendingPosts_example
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.customerhub.com/web_api/posts/trending")! 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()
```