LinkedIn Feed Retrieval API

View as Markdown

NOT YET AVAILABLE -- These endpoints are completely disabled and return HTTP 404 (Not Found). The underlying route handlers are commented out in the source code, so the routes do not exist. They require the r_member_social permission, which is RESTRICTED and requires LinkedIn approval. All request/response formats documented below are planned and speculative -- they are not based on a working implementation and may change when the feature is built. Do not attempt to call these endpoints; they will return a 404 error.

Retrieve your LinkedIn posts, comments, and reactions via the Publora API.

Endpoints

Endpoint Method Description
/api/v1/linkedin-posts POST Get posts authored by your account
/api/v1/linkedin-post-comments POST Get comments on a specific post
/api/v1/linkedin-post-reactions POST Get reactions on a specific post

Get LinkedIn Posts

Retrieve posts authored by a connected LinkedIn account.

Request

POST /api/v1/linkedin-posts
x-publora-key: sk_YOUR_API_KEY
Content-Type: application/json
 
{
  "platformId": "linkedin-ABC123",
  "start": 0,
  "count": 10,
  "sortBy": "LAST_MODIFIED"
}

Parameters

Parameter Type Required Default Description
platformId string Yes - LinkedIn connection ID (e.g., linkedin-ABC123)
start number No 0 Starting index for pagination
count number No 10 Number of posts (max: 100)
sortBy string No LAST_MODIFIED Sort order: LAST_MODIFIED or CREATED

Response

{
  "success": true,
  "posts": [
    {
      "id": "urn:li:share:7123456789",
      "commentary": "Excited to share our latest product update!",
      "publishedAt": 1709294400000,
      "visibility": "PUBLIC",
      "lifecycleState": "PUBLISHED",
      "author": "urn:li:person:ABC123",
      "distribution": {
        "feedDistribution": "MAIN_FEED"
      },
      "content": {
        "media": []
      }
    }
  ],
  "pagination": {
    "start": 0,
    "count": 10,
    "total": 45
  },
  "cached": false
}

cURL Example

curl -X POST "https://api.publora.com/api/v1/linkedin-posts" \
  -H "x-publora-key: sk_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "platformId": "linkedin-ABC123",
    "count": 20,
    "sortBy": "LAST_MODIFIED"
  }'

Python Example

import requests
 
response = requests.post(
    "https://api.publora.com/api/v1/linkedin-posts",
    headers={"x-publora-key": "sk_YOUR_API_KEY"},
    json={
        "platformId": "linkedin-ABC123",
        "count": 20,
        "sortBy": "LAST_MODIFIED"
    }
)
 
data = response.json()
for post in data["posts"]:
    print(f"Post: {post['commentary'][:50]}...")
    print(f"Published: {post['publishedAt']}")
    print("---")

Get Post Comments

Retrieve comments on a specific LinkedIn post.

Request

POST /api/v1/linkedin-post-comments
x-publora-key: sk_YOUR_API_KEY
Content-Type: application/json
 
{
  "postedId": "urn:li:share:7123456789",
  "platformId": "linkedin-ABC123",
  "start": 0,
  "count": 20
}

Parameters

Parameter Type Required Default Description
postedId string Yes - LinkedIn post URN
platformId string Yes - LinkedIn connection ID
start number No 0 Starting index for pagination
count number No 20 Number of comments (max: 100)

Response

{
  "success": true,
  "comments": [
    {
      "id": "6636062862760562688",
      "commentUrn": "urn:li:comment:(urn:li:activity:123,6636062862760562688)",
      "actor": "urn:li:person:XYZ789",
      "message": "Great insights! Thanks for sharing.",
      "created": {
        "time": 1582160678569
      },
      "lastModified": {
        "time": 1582160678569
      },
      "likesSummary": {
        "totalLikes": 5
      },
      "commentsCount": 2
    }
  ],
  "pagination": {
    "start": 0,
    "count": 20,
    "total": 89
  },
  "cached": false
}

cURL Example

curl -X POST "https://api.publora.com/api/v1/linkedin-post-comments" \
  -H "x-publora-key: sk_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "postedId": "urn:li:share:7123456789",
    "platformId": "linkedin-ABC123",
    "count": 50
  }'

Python Example

import requests
 
response = requests.post(
    "https://api.publora.com/api/v1/linkedin-post-comments",
    headers={"x-publora-key": "sk_YOUR_API_KEY"},
    json={
        "postedId": "urn:li:share:7123456789",
        "platformId": "linkedin-ABC123",
        "count": 50
    }
)
 
data = response.json()
for comment in data["comments"]:
    print(f"Comment by {comment['actor']}: {comment['message']}")
    print(f"Likes: {comment['likesSummary']['totalLikes']}")
    print("---")

Get Post Reactions

Retrieve reactions on a specific LinkedIn post.

Request

POST /api/v1/linkedin-post-reactions
x-publora-key: sk_YOUR_API_KEY
Content-Type: application/json
 
{
  "postedId": "urn:li:share:7123456789",
  "platformId": "linkedin-ABC123",
  "start": 0,
  "count": 50
}

Parameters

Parameter Type Required Default Description
postedId string Yes - LinkedIn post URN
platformId string Yes - LinkedIn connection ID
start number No 0 Starting index for pagination
count number No 50 Number of reactions (max: 100)

Response

{
  "success": true,
  "reactions": [
    {
      "id": "urn:li:reaction:(urn:li:person:XYZ789,urn:li:activity:123)",
      "reactionType": "LIKE",
      "actor": "urn:li:person:XYZ789",
      "created": {
        "time": 1686183251857
      }
    },
    {
      "id": "urn:li:reaction:(urn:li:person:ABC456,urn:li:activity:123)",
      "reactionType": "PRAISE",
      "actor": "urn:li:person:ABC456",
      "created": {
        "time": 1686183300000
      }
    }
  ],
  "pagination": {
    "start": 0,
    "count": 50,
    "total": 456
  },
  "cached": false
}

Reaction Types

Type Description Emoji
LIKE Thumbs up 👍
PRAISE Celebrate 🔥
EMPATHY Love / Heart ❤️
INTEREST Insightful 💡
APPRECIATION Support 👏
ENTERTAINMENT Funny 😄

cURL Example

curl -X POST "https://api.publora.com/api/v1/linkedin-post-reactions" \
  -H "x-publora-key: sk_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "postedId": "urn:li:share:7123456789",
    "platformId": "linkedin-ABC123",
    "count": 100
  }'

Python Example

import requests
from collections import Counter
 
response = requests.post(
    "https://api.publora.com/api/v1/linkedin-post-reactions",
    headers={"x-publora-key": "sk_YOUR_API_KEY"},
    json={
        "postedId": "urn:li:share:7123456789",
        "platformId": "linkedin-ABC123",
        "count": 100
    }
)
 
data = response.json()
 
# Count reactions by type
reaction_counts = Counter(r["reactionType"] for r in data["reactions"])
print("Reaction breakdown:")
for reaction_type, count in reaction_counts.most_common():
    print(f"  {reaction_type}: {count}")

Caching

All feed retrieval endpoints are cached to reduce API calls:

Endpoint Cache TTL
Posts 15 minutes
Comments 10 minutes
Reactions 10 minutes

The cached field in responses indicates if data was served from cache.


Error Responses

Not Found (404)

All feed retrieval endpoints currently return HTTP 404 Not Found because the route handlers are commented out in the source code and the routes do not exist. Express returns its default HTML 404 response (e.g., Cannot POST /api/v1/linkedin-posts), not a JSON body.

Connection Not Found (404)

{
  "error": "LinkedIn connection not found"
}

Verify the platformId matches a connected LinkedIn account.

Invalid URN (400)

{
  "error": "postedId must be a valid LinkedIn URN"
}

Ensure the post URN format is correct (e.g., urn:li:share:123456 or urn:li:ugcPost:123456).


Complete Workflow Example

import requests
 
API_KEY = "sk_YOUR_API_KEY"
BASE_URL = "https://api.publora.com/api/v1"
HEADERS = {"x-publora-key": API_KEY}
 
def get_linkedin_platform_id():
    """Get the LinkedIn platform connection ID."""
    response = requests.get(
        f"{BASE_URL}/platform-connections",
        headers=HEADERS
    )
    connections = response.json()["connections"]
 
    for conn in connections:
        if conn["platformId"].startswith("linkedin-"):
            return conn["platformId"]
 
    raise ValueError("No LinkedIn connection found")
 
def analyze_post_engagement(platform_id, post_id):
    """Analyze engagement on a specific post."""
    # Get comments
    comments_response = requests.post(
        f"{BASE_URL}/linkedin-post-comments",
        headers=HEADERS,
        json={"postedId": post_id, "platformId": platform_id, "count": 100}
    )
    comments = comments_response.json()
 
    # Get reactions
    reactions_response = requests.post(
        f"{BASE_URL}/linkedin-post-reactions",
        headers=HEADERS,
        json={"postedId": post_id, "platformId": platform_id, "count": 100}
    )
    reactions = reactions_response.json()
 
    return {
        "total_comments": comments["pagination"]["total"],
        "total_reactions": reactions["pagination"]["total"],
        "reaction_breakdown": Counter(r["reactionType"] for r in reactions["reactions"])
    }
 
# Main workflow
platform_id = get_linkedin_platform_id()
 
# Get recent posts
posts_response = requests.post(
    f"{BASE_URL}/linkedin-posts",
    headers=HEADERS,
    json={"platformId": platform_id, "count": 5}
)
 
for post in posts_response.json()["posts"]:
    print(f"\nPost: {post['commentary'][:50]}...")
    engagement = analyze_post_engagement(platform_id, post["id"])
    print(f"  Comments: {engagement['total_comments']}")
    print(f"  Reactions: {engagement['total_reactions']}")
    print(f"  Breakdown: {dict(engagement['reaction_breakdown'])}")

MCP Integration

NOT AVAILABLE: The MCP tools listed below (linkedin_posts, linkedin_post_comments, linkedin_post_reactions) are commented out in the source code and are not registered. They will not appear in MCP tool listings and cannot be invoked. They are listed here for reference only and will become available if/when the feed retrieval feature is implemented.

  • linkedin_posts - Retrieve your posts
  • linkedin_post_comments - Retrieve comments on a post
  • linkedin_post_reactions - Retrieve reactions on a post