Facebook Pixel
ApiLinkedin posts

Upload media and create a LinkedIn post (server-side)

Downloads a file from the provided URL, uploads it to LinkedIn server-side, and creates a post. This is a single-step alternative to the multi-step upload/init + upload + create flow. Maximum file size is 100MB. Designed for MCP and API clients that cannot perform direct pre-signed URL uploads.

POST/posts/upload-and-post
Authentication requiredPosts

Code Examples

curl -X POST 'https://api.connectsafely.ai/linkedin/posts/upload-and-post' \
-H 'Authorization: Bearer <your_api_key>' \
-H 'Content-Type: application/json' \
-d '{"fileUrl":"https://example.com/photo.jpg","text":"Check out this image!","mediaType":"default"}'

Parameters

No parameters.

Request Body

FieldTypeRequiredDescription
accountIdstringNoLinkedIn account ID. If omitted, uses the default account.
fileUrlstringYesPublic URL of the file to download and upload to LinkedIn. Maximum 100MB.
textstringYesPost text content.
mediaTypestringYesType of media being uploaded.
visibilitystringNoPost visibility.
altTextstringNoAlt text for images.

Example

{
  "fileUrl": "https://example.com/photo.jpg",
  "text": "Check out this image!",
  "mediaType": "default"
}

Responses

StatusDescription
200Media uploaded and post created successfully
400Bad request - file too large or post creation failed
401Unauthorized
500Server error - failed to download file, upload to LinkedIn, or create post

200 Response Parameters

NameTypeDescription
successboolean
postUrnstringURN of the created post.
shareUrnstringShare URN of the created post.
accountIdstringLinkedIn account ID used.

200 Example

{
  "success": true,
  "postUrn": "urn:li:share:7123456789",
  "shareUrn": "urn:li:share:7123456789",
  "accountId": "696ce9e780e0483585e4e553"
}

400 Response Parameters

NameTypeDescription
errorstring

400 Example

{
  "error": "example_value"
}

401 Response Parameters

NameTypeDescription
errorstring

401 Example

{
  "error": "example_value"
}

500 Response Parameters

NameTypeDescription
errorstring

500 Example

{
  "error": "example_value"
}