LinkedIn API: Post to a Profile
How to publish a post to a personal LinkedIn profile via API, with configurable visibility.
To publish a LinkedIn post via API, send one POST /api/posts request with the post body, the member's pro_-prefixed profile ID, and any media as public URLs. Include a stable Idempotency-Key so retries can't duplicate the post, then read the response's targets array to confirm the target reaches the published state.
This is the shortest path from an authorized LinkedIn connection to a live post: one POST /api/posts request, one profile ID, one target to watch. If you need the full connection walkthrough first, see How to Post to LinkedIn via API.
What does the request look like?
Once a member has connected their LinkedIn profile, you have a pro_-prefixed profile ID. Send the post body, that profile ID, and any media as public URLs. A stable Idempotency-Key makes it safe to retry the same logical request without risking a duplicate post — see idempotency & safe retries.
curl -X POST "https://postgate.studio/api/posts?profile_group_id=grp_acme123" \
-H "Authorization: Bearer $POSTGATE_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: linkedin-launch-001" \
-d '{
"post": {
"body": "We just shipped our Q3 roadmap.",
"options": {
"linkedin": { "visibility": "PUBLIC", "disable_reshare": false }
}
},
"profiles": ["pro_linkedin456"],
"media": ["https://cdn.example.com/roadmap.png"]
}'What are the two LinkedIn-specific fields?
visibility is PUBLIC (default) or CONNECTIONS — LinkedIn feed visibility, set per request. disable_reshare maps to LinkedIn's isReshareDisabledByAuthor flag: set it to true and other members can't reshare the post to their own feed. Both are placed under post.options.linkedin, the same envelope PostGate uses for every platform — see Posts.
What does the response tell you?
The initial response is acceptance, not proof of publication. Read the targets array for the LinkedIn target's real state: pending → media_ready → publishing → a terminal published or failed. A published target includes the LinkedIn share URN and a permalink under https://www.linkedin.com/feed/update/…. See the delivery lifecycle for the full state machine.
Frequently asked questions
How do I prevent duplicate LinkedIn posts when retrying an API request?
Send a stable Idempotency-Key header with the request. The key makes it safe to retry the same logical request without risking a duplicate post — if the original attempt already went through, the retry will not publish a second copy to the LinkedIn profile.
What LinkedIn-specific options can I set when posting via the API?
Two fields, both placed under post.options.linkedin: visibility, which is PUBLIC (the default) or CONNECTIONS and controls LinkedIn feed visibility per request, and disable_reshare, which maps to LinkedIn's isReshareDisabledByAuthor flag — set it to true and other members cannot reshare the post to their own feed.
How do I confirm a LinkedIn post was actually published?
The initial API response is acceptance, not proof of publication. Read the targets array for the LinkedIn target's real state: pending, then media_ready, then publishing, then a terminal published or failed. A published target includes the LinkedIn share URN and a permalink under https://www.linkedin.com/feed/update/.
How do I attach an image to a LinkedIn post via the API?
Pass the image as a public URL in the media array of the same POST /api/posts request, alongside the post body and the pro_-prefixed profile ID. To publish more than one image in a single post, see the LinkedIn Carousel API guide.
