# Search Post Comments by URL

{% tabs %}
{% tab title="Curl" %}

```bash
cURL 'https://api.enrich.so/v1/api/search-comment-by-url?post_url=https://www.linkedin.com/posts/marclouvion_ive-created-a-monster-datafast-realtime-ugcPost-7310642749228085248--KfN/&page=1' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json'
```

{% endtab %}

{% tab title="Javascript" %}

```javascript
const axios = require('axios');

axios.get('https://api.enrich.so/v1/api/search-comment-by-url?post_url=https://www.linkedin.com/posts/marclouvion_ive-created-a-monster-datafast-realtime-ugcPost-7310642749228085248--KfN/&page=1 ', {
    headers: {accept: 'application/json', Authorization: 'Bearer <token>'}
})
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.log(error);
  });// Some code
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
payload = {'post_url': 'https://www.linkedin.com/posts/marclouvion_ive-created-a-monster-datafast-realtime-ugcPost-7310642749228085248--KfN/', 'page': 1}
headers = {'accept': 'application/json', 'authorization': 'Bearer <token>'}
resp = requests.get('https://api.enrich.so/v1/api/search-comment-by-url', params=payload, headers=headers)
print (resp.text)
```

{% endtab %}

{% tab title="Java" %}

```java
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.enrich.so/v1/api/search-comment-by-url?post_url=https://www.linkedin.com/posts/marclouvion_ive-created-a-monster-datafast-realtime-ugcPost-7310642749228085248--KfN/&page=1")
  .get()
  .addHeader("accept", "application/json")
  .addHeader("authorization", "Bearer <token>")
  .build();

Response response = client.newCall(request).execute();
```

{% endtab %}

{% tab title="Ruby" %}

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

url = URI("https://api.enrich.so/v1/api/search-comment-by-url?post_url=https://www.linkedin.com/posts/marclouvion_ive-created-a-monster-datafast-realtime-ugcPost-7310642749228085248--KfN/&page=1")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
request["authorization"] = 'Bearer <token>'

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

{% endtab %}

{% tab title="Php" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.enrich.so/v1/api/search-comment-by-url?post_url=https://www.linkedin.com/posts/marclouvion_ive-created-a-monster-datafast-realtime-ugcPost-7310642749228085248--KfN/&page=1",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "accept: application/json",
    "authorization: Bearer <token>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}

> 💡 **Hint**
>
> Only LinkedIn post URLs in the following formats are accepted:
>
> **UGC Post format:**
>
> ```
> https://www.linkedin.com/posts/{author_slug}_{post-title}-ugcPost-{post_id}-{post_suffix}/
> ```
>
> ✅ Example:
>
> ```
> https://www.linkedin.com/posts/marclouvion_ive-created-a-monster-datafast-realtime-ugcPost-7310642749228085248--KfN/
> ```
>
> **Activity Post format:**
>
> ```
> https://www.linkedin.com/posts/{author_slug}_{post-title}-activity-{post_id}-{post_suffix}/
> ```
>
> ✅ Example:
>
> ```
> https://www.linkedin.com/posts/kgstrivers_javascript-interviewpdf-activity-7321374901855027200-qkvO/
> ```
>
> The key identifiers are either `ugcPost-{post_id}` or `activity-{post_id}`.> \
> Query parameters (like `?utm_source=...`) are allowed and will be ignored during parsing.
> {% endhint %}

## Example response

#### Status code: <mark style="color:green;">200 OK</mark>

```json
{
    "success": true,
    "message": "Comments for post found.",
    "data": {
        "page": 1,
        "total_page": 3,
        "num": 10,
        "data": [
            {
                "activity_id": "urn:li:comment:(ugcPost:7310642749228085248,7311696747326509056)",
                "commentary": "What's the tech stack of this",
                "reaction_breakdown": {
                    "likes": 0,
                    "empathy": 0,
                    "other": 0
                },
                "li_url": "https://www.linkedin.com/feed/update/urn:li:ugcPost:7310642749228085248?commentUrn=urn%3Ali%3Acomment%3A%28ugcPost%3A7310642749228085248%2C7311696747326509056%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287311696747326509056%2Curn%3Ali%3AugcPost%3A7310642749228085248%29",
                "commenter": {
                    "profile_id": "ACoAAERECx0BG5STlmUhZHtSWmYSdiplhaD1tyk",
                    "first_name": "Tushar",
                    "last_name": "kumar",
                    "sub_title": "--",
                    "entity_urn": "ACoAAERECx0BG5STlmUhZHtSWmYSdiplhaD1tyk"
                }
            },
            {
                "activity_id": "urn:li:comment:(ugcPost:7310642749228085248,7311246912408477697)",
                "commentary": "And what will you do with that? Someone will know the potential, but it’s not like you’ll be able to target them with ads.",
                "num_reactions": 1,
                "reaction_breakdown": {
                    "likes": 0,
                    "empathy": 0,
                    "other": 0
                },
                "li_url": "https://www.linkedin.com/feed/update/urn:li:ugcPost:7310642749228085248?commentUrn=urn%3Ali%3Acomment%3A%28ugcPost%3A7310642749228085248%2C7311246912408477697%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287311246912408477697%2Curn%3Ali%3AugcPost%3A7310642749228085248%29",
                "commenter": {
                    "profile_id": "ACoAAAxDXqoBAc-ssHR0mPHgG5veeSZP8U572Cw",
                    "first_name": "Vytis",
                    "last_name": "Bareika",
                    "sub_title": "🚀 $220M+ Generated for Clients | Founder @ Defined Chase (Digital Marketing Agency) | 12+ Yrs Scaling SaaS, B2B, Ecom & App Companies w/ Global Brand + Performance Campaigns, SEO, Creative & Attribution",
                    "profile_picture": "https://media.licdn.com/dms/image/v2/D4D35AQFMwlplI1MUdg/profile-framedphoto-shrink_800_800/B4DZYgR51WHAAg-/0/1744298286755?e=1746532800&v=beta&t=5qanbriBQBnnbXsjH6JPORFfcOv_sAnR_tN6Lh047tc",
                    "entity_urn": "ACoAAAxDXqoBAc-ssHR0mPHgG5veeSZP8U572Cw"
                }
            },
            {
                "activity_id": "urn:li:comment:(ugcPost:7310642749228085248,7310968582039830528)",
                "commentary": "Excited for this 🔥",
                "reaction_breakdown": {
                    "likes": 0,
                    "empathy": 0,
                    "other": 0
                },
                "li_url": "https://www.linkedin.com/feed/update/urn:li:ugcPost:7310642749228085248?commentUrn=urn%3Ali%3Acomment%3A%28ugcPost%3A7310642749228085248%2C7310968582039830528%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287310968582039830528%2Curn%3Ali%3AugcPost%3A7310642749228085248%29",
                "commenter": {
                    "profile_id": "ACoAAEs3kqUBvDFXZiukDkqAZ0LZQvvDxY8eXIY",
                    "first_name": "EMMANUEL",
                    "last_name": "TOBI",
                    "sub_title": "Software Engineer and Digital creator",
                    "profile_picture": "https://media.licdn.com/dms/image/v2/D4E03AQGkQt-qFEmIpA/profile-displayphoto-shrink_800_800/B4EZRQoeKAGYAg-/0/1736519575402?e=1751500800&v=beta&t=dEcoSQmCDMqsEPYrYkOETJ_PvT-BuF8fCaoSpS3eMN8",
                    "entity_urn": "ACoAAEs3kqUBvDFXZiukDkqAZ0LZQvvDxY8eXIY"
                }
            },
            {
                "activity_id": "urn:li:comment:(ugcPost:7310642749228085248,7310955738669953027)",
                "commentary": "That's actually quite amazing - more data is always good",
                "reaction_breakdown": {
                    "likes": 0,
                    "empathy": 0,
                    "other": 0
                },
                "li_url": "https://www.linkedin.com/feed/update/urn:li:ugcPost:7310642749228085248?commentUrn=urn%3Ali%3Acomment%3A%28ugcPost%3A7310642749228085248%2C7310955738669953027%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287310955738669953027%2Curn%3Ali%3AugcPost%3A7310642749228085248%29",
                "commenter": {
                    "profile_id": "ACoAADCrY-4BNO7G3n8re8M7mEvOF0j0PkF2Jdk",
                    "first_name": "Akhil",
                    "last_name": "Mishra",
                    "sub_title": "Daily tips from a Tech Lawyer | Fintech, IT, & SaaS Legal Specialist | Co-Founder @ MTLegal Team | Helping founders stay ahead of legal risks with clear, practical solutions",
                    "profile_picture": "https://media.licdn.com/dms/image/v2/D5603AQG-v_Hy-gKHTA/profile-displayphoto-shrink_800_800/profile-displayphoto-shrink_800_800/0/1723789612097?e=1751500800&v=beta&t=HEZ2OBvQdMQtNjlgxCv11ckAtNQ7-JsNVS66vn3EdVQ",
                    "entity_urn": "ACoAADCrY-4BNO7G3n8re8M7mEvOF0j0PkF2Jdk"
                }
            },
            {
                "activity_id": "urn:li:comment:(ugcPost:7310642749228085248,7310900765261258752)",
                "commentary": "Interesting approach to predicting customer behavior and maximizing conversions.",
                "reaction_breakdown": {
                    "likes": 0,
                    "empathy": 0,
                    "other": 0
                },
                "li_url": "https://www.linkedin.com/feed/update/urn:li:ugcPost:7310642749228085248?commentUrn=urn%3Ali%3Acomment%3A%28ugcPost%3A7310642749228085248%2C7310900765261258752%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287310900765261258752%2Curn%3Ali%3AugcPost%3A7310642749228085248%29",
                "commenter": {
                    "profile_id": "ACoAAAMerfgBfYb0q96tjJCMNqJNoPrKH8LYbw0",
                    "first_name": "Nilson",
                    "last_name": "Ivano",
                    "sub_title": "Founder at Linkmate | Effortless LinkedIn Leads | 7x More Visitors to Your Profile",
                    "profile_picture": "https://media.licdn.com/dms/image/v2/D4E03AQFzmf2Lk0O_ww/profile-displayphoto-shrink_800_800/profile-displayphoto-shrink_800_800/0/1723578606431?e=1751500800&v=beta&t=mV39LPFi0z5uJmSJCiW5kntDElbKZ9MFVGhfGqvMSac",
                    "entity_urn": "ACoAAAMerfgBfYb0q96tjJCMNqJNoPrKH8LYbw0"
                }
            }
        ]
    }
}
```

#### Status code: <mark style="color:red;">404 NOT FOUND</mark>

```
{
    "error": true,
    "message": "No Comments found for provided post"
}
```
