# st.createPost

This action allows you to create a post on LinkedIn. You can post as yourself or on behalf of a company page you have admin access to. The action supports text content with optional media attachments including images, videos, and documents.

## Constraints

> ⏺️ **Root Start:** allowed.

> ⬆️ **Parent Actions:** N/A.

> ⬇️ **Child Actions:** N/A.

## Parameters

```json
{
  "actionType": "st.createPost",
  "label": "post1",
  "text": "Excited to share my latest insights on building scalable APIs!",
  "attachments": [
    {
      "url": "https://example.com/images/team-photo.jpg",
      "type": "image"
    }
  ],
  "companyUrl": "https://www.linkedin.com/company/microsoft"
}
```

- `label` (optional) – custom label for tracking this action in workflow completion.
- `text` (required) – post text, must be up to **3000** characters.
- `attachments` (optional) – array of media attachments. Maximum **9** items.
  - `url` (required) – publicly accessible URL of the file to attach.
  - `type` (required) – type of attachment: `image`, `video`, or `document`.
  - `name` (required when type is `document`) – display name for the document.
- `companyUrl` (optional) – LinkedIn company page URL. When provided, the post will be published on behalf of the company. Requires content admin access to the company page.

### Attachment limits

- Maximum **9 images** per post (JPEG, PNG, GIF, WebP, max 8mb).
- Maximum **1 video** per post (MP4, MOV, WebM, max 200 mb).
- Maximum **1 document** per post (PDF, max 100 mb).
- Cannot mix different attachment types (e.g., images and video together).

## Result options

1. **Successful post creation:**

```json
{
  "actionType": "st.createPost",
  "label": "post1",
  "success": true,
  "data": {
    "postUrl": "https://www.linkedin.com/feed/update/urn:li:activity:1234567890"
  }
}
```

- `label` – included only if specified in the action parameters.
- `data.postUrl` – URL of the created post.

2. **Failed post creation:**

```json
{
  "actionType": "st.createPost",
  "label": "weeklyUpdate1",
  "success": false,
  "error": {
    "type": "companyNotFound",
    "message": "Provided URL is not an existing LinkedIn company."
  }
}
```

- `label` – included only if specified in the action parameters.
- `error.type` – enum with the following possible values:
  - `textTooLong` – post text exceeds 3000 characters limit.
  - `companyNotFound` – specified company page was not found on LinkedIn.
  - `noPostingPermission` – no permission to post on behalf of this company.
  - `unsupportedAttachmentType` – attachment type is not supported. Use `image`, `video`, or `document`.
  - `missingDocumentName` – document attachment requires a `name` field.
  - `urlNotAccessible` – attachment URL is not publicly accessible or returned an error.
  - `fileTooLarge` – attachment file exceeds the maximum allowed size.
  - `unsupportedMimeType` – file's MIME type is not supported by LinkedIn.
  - `tooManyAttachments` – more than 9 attachments were provided.
  - `mixingNotAllowed` – cannot mix different attachment types (e.g., images with video).
