> ## Documentation Index
> Fetch the complete documentation index at: https://www.openpmm.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Publish to LinkedIn with the OpenPMM API

> Publish text, images, and video to a LinkedIn Destination with the OpenPMM API, including media limits and review steps.

Use the OpenPMM API to prepare and publish a Post to a LinkedIn Destination. This guide shows the LinkedIn-specific choices. Read [Create posts](/docs/guides/publish-posts) first for the complete Post workflow.

<Warning>
  Publishing creates content on LinkedIn. Review the Destination, content, media, and timing before you send a confirmed request.
</Warning>

## Before you start

You need these objects:

* An API credential with access to the Workspace.
* A Workspace ID.
* A connected LinkedIn Destination ID.
* Any media Asset that the Post uses.

Use [Connect a destination](/docs/guides/connect-a-destination) to authorize the LinkedIn account. Use [Upload assets](/docs/guides/upload-assets) when the Post includes media.

## Choose the LinkedIn Post type

LinkedIn accepts one video or a set of images in one Post. It does not accept a video and an image in the same Post.

Use the following content choices:

* Text only when the Post has no media.
* One video when the Post contains a video.
* One to 20 images when the Post contains images.

The [LinkedIn media guidelines](/docs/media/linkedin) page lists the current file and duration limits.

## Create a LinkedIn draft

Create a draft with the LinkedIn channel. A draft uses `channel` because it does not have a Destination yet.

```json theme={null}
{
  "when": "draft",
  "group": "linkedin-launch",
  "posts": [
    {
      "channel": "linkedin",
      "headline": null,
      "body": ["A release update from OpenPMM."],
      "media": [],
      "destination_options": null
    }
  ]
}
```

Send the request to `POST /workspaces/{workspace_id}/posts`. Store the returned Post `id` and `version`.

## Add media to the Post

Upload the file as an Asset before you publish the Post. Add the Asset ID to the Post body that should contain the media.

Use one of these patterns:

* Add one video Asset to the Post.
* Add up to 20 image Assets to the Post.
* Do not mix a video Asset with image Assets in the same LinkedIn Post.

OpenPMM checks the media before publication. If the file cannot publish, the
request identifies the required change before any provider request starts.

## Publish the reviewed Post

Publish the same Post with its current version and the LinkedIn Destination ID.

```json theme={null}
{
  "confirmed": true,
  "when": "now",
  "time_zone": "UTC",
  "posts": [
    {
      "id": "send_01JABCDEF",
      "version": 1,
      "destination_id": "dest_01JABCDEF"
    }
  ]
}
```

Send the body to `POST /workspaces/{workspace_id}/posts/publish`. Add a unique `Idempotency-Key` header. Use the same key when you retry the same request after a timeout.

For a scheduled Post, use `when: "schedule"` and provide the publication time described in [Queue, schedule, and retry](/docs/guides/schedule-and-retry).

## Check the result

Use `GET /workspaces/{workspace_id}/posts/{post}` after the request. The Post response includes its state and publication receipt.

If the Post enters `preparing`, it has not reached LinkedIn. Poll the Post until it becomes `ready`, `scheduled`, or `needs-attention`. Do not confirm the same Post again after it moves from `preparing`.

If LinkedIn rejects the media or content, read the error details and correct the Post. OpenPMM keeps each Post independent when the same request targets other Destinations.

## Related pages

* [LinkedIn media guidelines](/docs/media/linkedin)
* [Check media compatibility](/docs/guides/media-compatibility)
* [Create posts](/docs/guides/publish-posts)
* [Queue, schedule, and retry](/docs/guides/schedule-and-retry)
