APICreating Posts
Creating Posts
Post text, images, carousels, videos, and PDF documents to LinkedIn through the ConnectSafely API. A beginner-friendly guide with cURL, JavaScript, and Python examples.
What you can post
The ConnectSafely API publishes every kind of LinkedIn post:
- Text — words only
- Image — one photo, with optional alt text
- Carousel — 2–9 images people swipe through
- Video — an uploaded video
- Document — a PDF that renders as a swipeable carousel (a "native document")
This guide walks through each one with copy-paste examples. For the raw parameter reference, see POST /posts/create.
The mental model
There are three shapes of request, depending on what you're posting:
- Text only — one call.
POST /posts/createwith your text. Done. - Media (image, carousel, video) — three steps.
POST /posts/upload/init— ask LinkedIn for a one-time upload URL.- You
PUTthe file bytes straight to that URL. POST /posts/create— publish the post, referencing the uploaded file.
- Document (PDF) — four steps. Same as media, plus a poll: after uploading, call
GET /posts/upload/document-statusuntil LinkedIn finishes processing the PDF, then create.
The API never touches your file bytes. Files can be large, so they go directly from your machine to LinkedIn's storage using the pre-signed URL we hand you. ConnectSafely only deals with small JSON — never your raw bytes.
Before you start
Every request is authenticated with your API key:
Authorization: Bearer YOUR_API_KEY- Base URL:
https://api.connectsafely.ai/linkedin accountId(optional) — which connected LinkedIn account should post. Omit it to use your default account.
Which post type?
| I want to post… | mediaType | Steps | Key fields |
|---|---|---|---|
| Just text | none | create | text |
| One image | image | init → upload → create | assetUrn, altText |
| A carousel | image | init ×N → upload ×N → create | assetUrns[] |
| A video | video | init → upload → create | assetUrn, recipes |
| A PDF / document | document | init → upload → poll → create | assetUrn, recipes, title |
