APILinkedIn Posts
Initialize media upload — get pre-signed URL(s)
Returns pre-signed URL(s) from LinkedIn for direct client upload. For images and small videos: returns a single uploadUrl. For large videos: returns partUploadRequests (4MB chunks). The API never touches media bytes — the client uploads directly to LinkedIn.
POST
/posts/upload/initAuthentication requiredPosts
Code Examples
curl -X POST 'https://api.connectsafely.ai/linkedin/posts/upload/init' \ -H 'Authorization: Bearer <your_api_key>' \ -H 'Content-Type: application/json' \ -d '{"mediaType":"default","fileSize":0,"filename":"photo.jpg"}'Parameters
No parameters.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
accountId | string | No | LinkedIn account ID. |
mediaType | string | Yes | |
fileSize | number | Yes | File size in bytes. |
filename | string | Yes | Filename with extension. |
Example
{
"mediaType": "default",
"fileSize": 0,
"filename": "photo.jpg"
}Responses
| Status | Description |
|---|---|
| 200 | Upload initialized. Client should PUT media bytes directly to the returned URL(s). |
| 401 | Unauthorized |
| 500 | Server error |
200 Response Parameters
| Name | Type | Description |
|---|---|---|
success | boolean | |
uploadType | string | |
assetUrn | string | Pass this to /posts/create. |
recipes | array | |
uploadUrl | string | Pre-signed URL for SINGLE uploads. |
uploadHeaders | object | Headers to include in the PUT request. |
mediaArtifactUrn | string | For MULTIPART — pass to /upload/complete. |
partUploadRequests | array | For MULTIPART — chunk upload URLs. |
multipartMetadata | string | For MULTIPART — pass to /upload/complete. |
200 Example
{
"success": true,
"uploadType": "default",
"assetUrn": "urn:li:example:123456",
"recipes": [
"example_value"
],
"uploadUrl": "https://linkedin.com/in/example",
"uploadHeaders": {},
"mediaArtifactUrn": "urn:li:example:123456",
"partUploadRequests": [],
"multipartMetadata": "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"
}Scrape LinkedIn post details
Extract detailed information from a LinkedIn post URL including content, author, engagement metrics, and media. Uses caching to reduce API calls. Supports both authenticated and public scraping with proxy rotation for reliability. Use forceRefresh to bypass cache.
Complete multipart video upload
Call after all video chunks have been PUT to the pre-signed URLs. Only needed for MULTIPART uploads (large videos).
