Initialize media upload — get pre-signed URL(s)
Returns pre-signed URL(s) from LinkedIn for direct client upload. For images, documents, 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. Documents (PDF): after PUTting the bytes, poll GET /posts/upload/document-status until ready before calling /posts/create. Company page: to author the post as a company page you administer, pass companyUrn here so the asset is registered to the organization — required, otherwise the company-authored post silently fails to publish.
/posts/upload/initCode 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","companyUrn":"urn:li:fsd_company:107524277"}'Returns pre-signed URL(s) from LinkedIn for direct client upload. For images, documents, 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. Documents (PDF): after PUTting the bytes, poll GET /posts/upload/document-status until ready before calling /posts/create. Company page: to author the post as a company page you administer, pass companyUrn here so the asset is registered to the organization — required, otherwise the company-authored post silently fails to publish.
Parameters
No parameters.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
accountId | string | No | LinkedIn account ID. |
mediaType | string | Yes | image / video / document (PDF). Documents upload as SINGLE and require a processing poll (see /posts/upload/document-status). |
fileSize | number | Yes | File size in bytes. |
filename | string | Yes | Filename with extension. |
companyUrn | string | No | Optional. When the post will be authored by a company page you administer, pass the company URN here so the uploaded asset is registered with the organization as owner. Required for company-page image/video posts — without it LinkedIn accepts the later share (HTTP 200) but silently creates no post (no share URN). Must match the companyUrn passed to /posts/create. |
Example
{
"mediaType": "default",
"fileSize": 0,
"filename": "photo.jpg",
"companyUrn": "urn:li:fsd_company:107524277"
}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).
