Facebook Pixel
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/init
Authentication 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

FieldTypeRequiredDescription
accountIdstringNoLinkedIn account ID.
mediaTypestringYes
fileSizenumberYesFile size in bytes.
filenamestringYesFilename with extension.

Example

{
  "mediaType": "default",
  "fileSize": 0,
  "filename": "photo.jpg"
}

Responses

StatusDescription
200Upload initialized. Client should PUT media bytes directly to the returned URL(s).
401Unauthorized
500Server error

200 Response Parameters

NameTypeDescription
successboolean
uploadTypestring
assetUrnstringPass this to /posts/create.
recipesarray
uploadUrlstringPre-signed URL for SINGLE uploads.
uploadHeadersobjectHeaders to include in the PUT request.
mediaArtifactUrnstringFor MULTIPART — pass to /upload/complete.
partUploadRequestsarrayFor MULTIPART — chunk upload URLs.
multipartMetadatastringFor 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

NameTypeDescription
errorstring

401 Example

{
  "error": "example_value"
}

500 Response Parameters

NameTypeDescription
errorstring

500 Example

{
  "error": "example_value"
}