Facebook Pixel
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:

  1. Text only — one call. POST /posts/create with your text. Done.
  2. Media (image, carousel, video) — three steps.
    1. POST /posts/upload/init — ask LinkedIn for a one-time upload URL.
    2. You PUT the file bytes straight to that URL.
    3. POST /posts/create — publish the post, referencing the uploaded file.
  3. Document (PDF) — four steps. Same as media, plus a poll: after uploading, call GET /posts/upload/document-status until 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…mediaTypeStepsKey fields
Just textnonecreatetext
One imageimageinit → upload → createassetUrn, altText
A carouselimageinit ×N → upload ×N → createassetUrns[]
A videovideoinit → upload → createassetUrn, recipes
A PDF / documentdocumentinit → upload → poll → createassetUrn, recipes, title

Pick your post type