Scrape LinkedIn post details
Extract detailed information from a LinkedIn post URL including content, author, engagement metrics, and media. Uses caching to reduce API calls. Supports both authenticated and public scraping with proxy rotation for reliability. Use forceRefresh to bypass cache.
/posts/scrapeCode Examples
curl -X POST 'https://api.connectsafely.ai/linkedin/posts/scrape' \ -H 'Authorization: Bearer <your_api_key>' \ -H 'Content-Type: application/json' \ -d '{"postUrl":"https://www.linkedin.com/posts/john-doe-123_example-post-activity-7430667226199830528-Cu89"}'Parameters
No parameters.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
postUrl | string | Yes | Full LinkedIn post URL to scrape |
accountId | string | No | LinkedIn account ID for authenticated scraping (gets more data than public) |
useCache | boolean | No | Whether to use cached results if available |
maxCacheAge | number | No | Maximum age of cached data in hours before refresh |
maxProxyRetries | number | No | Number of proxy rotation attempts on failure |
forceRefresh | boolean | No | Force fresh scrape ignoring cache |
Example
{
"postUrl": "https://www.linkedin.com/posts/john-doe-123_example-post-activity-7430667226199830528-Cu89",
"forceRefresh": false
}Responses
| Status | Description |
|---|---|
| 200 | Post details scraped successfully |
| 400 | Bad request - Missing or invalid postUrl |
| 401 | Unauthorized - Invalid or missing API key |
| 500 | Server error - Failed to scrape post after all retry attempts |
200 Response Parameters
| Name | Type | Description |
|---|---|---|
success | boolean | Whether the scrape was successful |
originalUrl | string | Original URL provided in the request |
finalUrl | string | Final URL after any redirects |
scrapeDuration | number | Time taken to scrape in milliseconds |
data | object | Scraped post data |
usingAuthenticatedScraping | boolean | Whether authenticated scraping was used |
message | string | Success message |
200 Example
{
"success": true,
"originalUrl": "https://www.linkedin.com/posts/john-doe-123_example-post-activity-7430667226199830528-Cu89",
"finalUrl": "https://www.linkedin.com/posts/john-doe-123_example-post-activity-7430667226199830528-Cu89",
"scrapeDuration": 4092,
"data": {
"content": "This is an example post content with insights about technology and business...",
"ugcPostUrn": "urn:li:ugcPost:7430667225633550337",
"activityUrn": "urn:li:activity:7430667226199830528",
"shareUrn": null,
"featuredActivityUrn": null,
"author": {
"name": "John Doe",
"headline": "Software Engineer at Tech Company",
"profileUrl": "https://www.linkedin.com/in/john-doe-123"
},
"timestamp": "2d",
"engagement": {
"likes": 86,
"comments": 12,
"shares": 3
},
"media": {
"hasImages": true,
"hasVideo": false,
"hasDocument": false,
"hasArticle": false,
"hasLink": true,
"hasPoll": false
},
"permissions": {
"canComment": true
},
"url": "https://www.linkedin.com/posts/john-doe-123_example-post-activity-7430667226199830528-Cu89",
"scraped": true,
"scrapedAt": "2026-02-24T12:56:58.220Z"
},
"usingAuthenticatedScraping": true,
"message": "Successfully scraped post content"
}400 Response Parameters
| Name | Type | Description |
|---|---|---|
success | boolean | |
error | object |
400 Example
{
"success": false,
"error": {
"issues": [
{
"code": "invalid_type",
"expected": "string",
"received": "undefined",
"path": [
"postUrl"
],
"message": "Required"
}
],
"name": "ZodError"
}
}401 Response Parameters
| Name | Type | Description |
|---|---|---|
error | string |
401 Example
{
"error": "Unauthorized - Invalid credentials"
}500 Response Parameters
| Name | Type | Description |
|---|---|---|
error | string | Error message describing the failure |
success | boolean | |
status | number | |
originalUrl | string | The URL that failed to scrape |
500 Example
{
"error": "Scraping error: Failed to scrape LinkedIn post after all attempts. Errors: Rotating proxy attempt 1: partial/no data; Rotating proxy attempt 2: partial/no data",
"success": false,
"status": 500,
"originalUrl": "https://www.linkedin.com/posts/invalid-post-12345"
}Search posts by keyword
Search LinkedIn posts by keywords with filtering options. Find relevant content for engagement, monitor industry discussions, or discover trending topics. Filter by date posted, sort by relevance or recency, and target posts by author job titles.
Initialize media upload — get pre-signed URL(s)
Returns pre-signed URL(s) from LinkedIn for direct client upload. For images and small videos: returns a single uploadUrl. For large videos: returns partUploadRequests (4MB chunks). The API never touches media bytes — the client uploads directly to LinkedIn.
