Skip to main content

Engagements

Publish a post

The Linked API allows you to publish posts on LinkedIn programmatically. Below is an example of how to publish a post using a POST request.

Endpoint

POST /v1/posts

Parameters

  • content (required, string): The text content of the post.
  • image (optional, file): The image file to include in the post. Accepted formats are jpg, png, and gif.

Example

curl -X POST https://api.linkedapi.io/v1/posts \
-H "x-api-token: your-api-token-here" \
-H "account-token: your-account-token-here" \
-F "content=Excited to announce our new product launch next week! Stay tuned." \
-F "image=@/path/to/image.jpg"

Response

{
  "postId": "789654123",
  "content": "Excited to announce our new product launch next week! Stay tuned.",
  "imageUrl": "https://api.linkedapi.io/images/789654123.jpg",
  "timestamp": "2024-09-21T16:45:00Z"
}

Errors

  • 400 Bad Request: Invalid or missing parameters.
  • 401 Unauthorized: Missing or invalid authorization token.
  • 403 Forbidden: Insufficient permissions to publish a post.
  • 415 Unsupported Media Type: The uploaded file is not in a supported format.
  • 500 Internal Server Error: Unexpected server error.