Create a LinkedIn post
Publishes a LinkedIn post. The mediaType field decides what you post. Text (none): send text only, one call with no upload. Image (image): upload via /posts/upload/init, then pass assetUrn (and optional altText). Carousel (image): upload each image, then pass 2 to 9 of them in assetUrns. Video (video): upload, then pass assetUrn and recipes. Document/PDF (document): upload, poll /posts/upload/document-status until READY, then pass assetUrn, recipes, and title. New to the API? The step-by-step guide with cURL, JavaScript, and Python examples for each post type lives at /docs/api/posting.
/posts/createCode Examples
curl -X POST 'https://api.connectsafely.ai/linkedin/posts/create' \ -H 'Authorization: Bearer <your_api_key>' \ -H 'Content-Type: application/json' \ -d '{"text":"Try ConnectSafely.AI Today","title":"Our 2026 Product Roadmap"}'Publishes a LinkedIn post. The mediaType field decides what you post. Text (none): send text only, one call with no upload. Image (image): upload via /posts/upload/init, then pass assetUrn (and optional altText). Carousel (image): upload each image, then pass 2 to 9 of them in assetUrns. Video (video): upload, then pass assetUrn and recipes. Document/PDF (document): upload, poll /posts/upload/document-status until READY, then pass assetUrn, recipes, and title. New to the API? The step-by-step guide with cURL, JavaScript, and Python examples for each post type lives at /docs/api/posting.
Parameters
No parameters.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
accountId | string | No | Which connected account posts. Omit to use the default account. |
text | string | Yes | The post body (max 3,000 characters). |
visibility | string | No | Who can see the post. |
mediaType | string | No | What you are posting. Use "image" for a carousel too (with assetUrns). |
assetUrn | string | No | Single uploaded asset from /posts/upload/init. Required for image / video / document (a single image, video, or PDF). |
assetUrns | array | No | Carousel only: 2–9 uploaded images. Each item is { assetUrn, altText? }. Use instead of assetUrn with mediaType "image". |
recipes | array | No | From /posts/upload/init. Required for video and document. |
altText | string | No | Accessibility alt text for a single image (mediaType "image"). |
title | string | No | Document title shown on the post (mediaType "document"). |
Example
{
"text": "Try ConnectSafely.AI Today",
"title": "Our 2026 Product Roadmap"
}Responses
| Status | Description |
|---|---|
| 200 | Post created |
| 400 | Bad request |
| 401 | Unauthorized |
| 500 | Server error |
200 Response Parameters
| Name | Type | Description |
|---|---|---|
success | boolean | |
postUrn | string | |
shareUrn | string | |
accountId | string |
200 Example
{
"success": true,
"postUrn": "urn:li:share:7012345678901234567",
"shareUrn": "urn:li:example:123456",
"accountId": "acc_12345"
}400 Response Parameters
| Name | Type | Description |
|---|---|---|
error | string |
400 Example
{
"error": "example_value"
}401 Response Parameters
| Name | Type | Description |
|---|---|---|
error | string |
401 Example
{
"error": "example_value"
}500 Response Parameters
| Name | Type | Description |
|---|---|---|
error | string |
500 Example
{
"error": "example_value"
}Check document (PDF) processing status
After PUTting a document to the pre-signed URL from /posts/upload/init, poll this until status is READY. LinkedIn rasterizes each page into preview images first; the document cannot be posted until it is READY. Only needed for mediaType=document.
Reply to a comment
Post a reply to an existing comment on a LinkedIn post. Replies appear threaded under the original comment. Optionally tag a member with a real @mention that notifies them (e.g. the original commenter) by passing `mention`. Useful for continuing conversations and engaging with community discussions.
