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-postAuthentication 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
| Field | Type | Required | Description |
|---|---|---|---|
accountId | string | No | LinkedIn account ID. If omitted, uses the default account. |
fileUrl | string | Yes | Public URL of the file to download and upload to LinkedIn. Maximum 100MB. |
text | string | Yes | Post text content. |
mediaType | string | Yes | Type of media being uploaded. |
visibility | string | No | Post visibility. |
altText | string | No | Alt text for images. |
Example
{
"fileUrl": "https://example.com/photo.jpg",
"text": "Check out this image!",
"mediaType": "default"
}Responses
| Status | Description |
|---|---|
| 200 | Media uploaded and post created successfully |
| 400 | Bad request - file too large or post creation failed |
| 401 | Unauthorized |
| 500 | Server error - failed to download file, upload to LinkedIn, or create post |
200 Response Parameters
| Name | Type | Description |
|---|---|---|
success | boolean | |
postUrn | string | URN of the created post. |
shareUrn | string | Share URN of the created post. |
accountId | string | LinkedIn account ID used. |
200 Example
{
"success": true,
"postUrn": "urn:li:share:7123456789",
"shareUrn": "urn:li:share:7123456789",
"accountId": "696ce9e780e0483585e4e553"
}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"
}