Skip to content
Docs

Posts

A member's or a company's posts, one post, creating a post with mentions, images or a video, and deleting one.

A Profile's Or A Company's Posts#

Shell
curl -sS "https://direct.lempile.com/api/v1/users/me/posts?account_id=$ACCOUNT_ID&limit=10" \
  -H "X-API-KEY: $DIRECT_API_KEY"
JSON
{
  "object": "PostList",
  "items": [
    {
      "object": "Post",
      "provider": "LINKEDIN",
      "id": "7388000000000000000",
      "social_id": "urn:li:activity:7388000000000000000",
      "share_url": "https://www.linkedin.com/posts/ada-sender_hello-activity-7388000000000000000-abcd",
      "text": "Hello\nworld",
      "date": "2d",
      "parsed_datetime": "2025-10-25T23:54:22.402Z",
      "reaction_counter": 12,
      "comment_counter": 3,
      "repost_counter": 1,
      "impressions_counter": 0,
      "author": {
        "public_identifier": "ada-sender",
        "id": "ACoAAAbcdefghijklmnop",
        "name": "Ada Sender",
        "is_company": false,
        "headline": "Founder",
        "profile_picture_url": "https://media.licdn.com/dms/image/x/400.jpg"
      },
      "permissions": { "can_react": true, "can_share": true, "can_post_comments": true },
      "is_repost": false,
      "attachments": [
        {
          "id": "D1",
          "type": "img",
          "url": "https://media.licdn.com/dms/image/x/1280.jpg",
          "url_expires_at": 1900000000000,
          "size": { "width": 1280, "height": 1280 },
          "mimetype": "image/jpeg",
          "unavailable": false,
          "sticker": false
        }
      ],
      "mentions": []
    }
  ],
  "paging": { "page_count": 1 },
  "cursor": "<cursor>"
}
  • {identifier}: me for the account's own posts, or any profile identifier (provider id, public identifier, profile URL).
  • is_company=true: {identifier} is a company page (its id or its universal name, e.g. example-co).
  • limit: 1 to 100 (default 10). LinkedIn gives 20 posts a call.
  • social_id (urn:li:activity:…) is what comments and reactions take as post_id.
  • date is LinkedIn's relative date (2d); parsed_datetime is the exact time, read from the post's id.
  • impressions_counter is 0 unless LinkedIn shows views to the account.
  • user_reacted holds the account's own reaction (LIKE, PRAISE…) when it reacted.
  • mentions: each person or page named in the text, as {start, length, url}.
  • Attachments: images (type: "img") and videos (type: "video", with duration in seconds and file_size). Their url expires at url_expires_at (milliseconds).
  • A plain repost (no words of its own) is the reposted post as LinkedIn shows it: its id, social_id, text, author and counts are the original's, is_repost is true, reposted_by is who reposted, repost_id the repost's own activity id (what POST /posts answered; DELETE /posts/{repost_id} undoes it), repost_parsed_datetime when it was reposted, and repost_content holds the original (id, date, parsed_datetime, text, author, attachments).
  • A repost with words is the reposter's own post (is_repost: false, its words and author), with repost_content the post it shares.

One Post#

Shell
curl -sS "https://direct.lempile.com/api/v1/posts/urn:li:activity:7388000000000000000?account_id=$ACCOUNT_ID" \
  -H "X-API-KEY: $DIRECT_API_KEY"

{post_id} can be the post's id (digits), urn:li:activity:…, a urn:li:ugcPost:… or urn:li:share:…, or the post's URL (URL-encoded). One LinkedIn call. An unknown post answers 404.

Create A Post#

Shell
curl -sS -X POST "https://direct.lempile.com/api/v1/posts" \
  -H "X-API-KEY: $DIRECT_API_KEY" \
  -H "Idempotency-Key: post-2026-10-29-1" \
  -H "Content-Type: application/json" \
  -d '{
    "account_id": "'"$ACCOUNT_ID"'",
    "text": "We shipped it today. Thanks {{0}} for the review!",
    "mentions": [{ "name": "Bob Buyer", "profile_id": "ACoAAAzyxwvutsrqponml" }]
  }'
JSON
{
  "object": "PostCreated",
  "post_id": "7389000000000000000",
  "id": "7389000000000000000",
  "social_id": "urn:li:activity:7389000000000000000",
  "external_post_id": "urn:li:activity:7389000000000000000",
  "share_url": "https://www.linkedin.com/feed/update/urn:li:activity:7389000000000000000/"
}

Status 201. The post is public, with comments open to everyone.

Field
account_id The account that posts (or ?account_id=).
text 3,000 characters at most, mentions' names and an added link included.
mentions [{name, profile_id, is_company?}], placed in text with {{0}}, {{1}}… A person's profile_id is their provider id (ACo…); a page's is its id (digits). Every mention must be placed, and every placeholder must have its mention.
external_link An http(s) link, added at the end of the text unless it's already in it.
as_organization Post as this company page (its id, digits). The account must be an admin of the page.
attachments Up to 20 images (jpg, png, gif, webp; 36 MB each), or one video (75 KB to 5 GB). Not both.
video_thumbnail An image for the video.

Files go in Unipile's multipart form (attachments, attachments[] or attachments[0]…):

Shell
curl -sS -X POST "https://direct.lempile.com/api/v1/posts" \
  -H "X-API-KEY: $DIRECT_API_KEY" \
  -H "Idempotency-Key: post-2026-10-29-2" \
  -F "account_id=$ACCOUNT_ID" \
  -F "text=Two pictures from the meetup" \
  -F "attachments=@one.jpg;type=image/jpeg" \
  -F "attachments=@two.jpg;type=image/jpeg"
  • Each file goes through LinkedIn's own uploader first; several images are grouped (one more call), then the post is created.
  • A video post may take up to 30 seconds more: Direct waits for LinkedIn to give the post its activity id. If it never does, post_id is the post's urn:li:ugcPost:… (or urn:li:share:…) and share_url is left out; if LinkedIn's answer names neither, Direct answers 504 (unknown outcome: check the account's posts before posting again).
  • A refusal LinkedIn names in its answer is 422 errors/invalid_post.
  • repost, include_job_posting and targeted_audience answer 501.
  • Requests reach Direct through Cloudflare, which limits a request body's size (100 MB on most plans) and a request's time (100 seconds). A large video can be refused there (413) or cut (524) before Direct answers; use an Idempotency-Key and see Errors And Limits.

Delete A Post#

Shell
curl -sS -X DELETE "https://direct.lempile.com/api/v1/posts/urn:li:activity:7389000000000000000?account_id=$ACCOUNT_ID" \
  -H "X-API-KEY: $DIRECT_API_KEY"

204 with an empty body, as Unipile. Direct reads the post first: it must be the account's own (or a page's, as an admin); anyone else's answers 403 errors/insufficient_permissions. The account's own plain repost (its repost_id) is undone as LinkedIn's "Delete repost" does: the repost goes, the reposted post stays. A repost with words is the account's own post and is deleted as one.

Both writes take ?dry_run=true and an Idempotency-Key.

Repost#

Shell
curl -sS -X POST "https://direct.lempile.com/api/v1/posts" \
  -H "X-API-KEY: $DIRECT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "account_id": "'"$ACCOUNT_ID"'", "repost": "7388000000000000000", "text": "" }'
JSON
{ "object": "PostCreated", "post_id": "7401000000000000001", "id": "7401000000000000001", "share_url": "https://www.linkedin.com/feed/update/urn:li:activity:7401000000000000001/" }
  • repost is the post's id; with no text (or "") it's LinkedIn's instant repost, as a page with as_organization. With text, a repost with those words (mentions and external_link as for a post; no files: 400).
  • Direct reads the post first (one call) for the share LinkedIn reposts. post_id is the new post's activity id, never the reposted one's; when LinkedIn names a plain repost only by its repost urn, post_id is that urn.

Was this page helpful?