- PostFast Home
- /
- API Guides
- /
- /
- documents
How to Schedule LinkedIn Document Posts via API
Publish documents (PDF, DOC, DOCX, PPT, PPTX) to LinkedIn using the PostFast API. Create swipeable carousel-style document posts programmatically.
LinkedIn document posts allow you to share documents (PDF, DOC, DOCX, PPT, PPTX) that display as swipeable carousels. Document posts often outperform regular image posts for educational content, thought leadership, and lead magnets.
To create a document post, first upload your document to S3 using the signed URL endpoint, then reference it using the linkedinAttachmentKey control. Do NOT include mediaItems when posting documents - use the dedicated attachment controls instead.
Important: Document attachments cannot be mixed with regular media items (images/videos). You must choose one or the other for each post.
API Parameters
| Parameter | Type | Description |
|---|---|---|
linkedinAttachmentKey | string | S3 key returned by /file/get-signed-upload-urls. Format: "file/{uuid}.{ext}" (e.g., "file/4aa995e5-fbd5-4899-91e8-c3bdae175e23.pdf"). |
linkedinAttachmentTitle | string | Display title for the document in the LinkedIn post. |
Code Example
const response = await fetch('https://api.postfa.st/social-posts', {
method: 'POST',
headers: {
'pf-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"posts": [
{
"content": "I analyzed 500+ successful LinkedIn posts.\n\nHere are the 7 patterns that get the most engagement (PDF guide attached):\n\n1. Hook in first 2 lines\n2. Use white space\n3. End with a question\n4. Post Tuesday-Thursday 8-10am\n5. 3-5 hashtags max\n6. Native content > links\n7. Engage in first hour\n\nWhat's your #1 LinkedIn tip?\n\n#linkedin #contentmarketing #b2b",
"scheduledAt": "2025-01-31T09:00:00.000Z",
"socialMediaId": "bb1j3944-l8fh-97j0-g372-001211005007"
}
],
"controls": {
"linkedinAttachmentKey": "file/4aa995e5-fbd5-4899-91e8-c3bdae175e23.pdf",
"linkedinAttachmentTitle": "LinkedIn Engagement Analysis 2025"
}
})
});
const data = await response.json();
Did You Know?
Tips
Use the key returned by /file/get-signed-upload-urls - it will be a UUID like file/4aa995e5-fbd5-4899-91e8-c3bdae175e23.pdf
Design for mobile - most LinkedIn users browse on phones, so use large text and simple layouts
First page is your cover - make it compelling with a clear title and visual hook
Keep it concise - 5-15 pages performs better than 50+ pages
Add a CTA on the last page (follow, visit website, download full version)
Tease key points in the post caption to encourage people to swipe through
PowerPoint presentations work great for step-by-step guides and tutorials
Schedule documents, images, and videos to LinkedIn via API
Common Pitfalls
Files over 60MB will fail to upload. Compress documents before uploading if needed.
If you include both mediaItems AND linkedinAttachmentKey, the API returns an error: "LinkedIn does not support mixing media items and document attachments in the same post".
The linkedinAttachmentKey must start with "file/" (not "document/" or other prefixes). Use the exact key returned by the upload endpoint.
Text that's too small is unreadable on mobile. Use minimum 24pt font for body text.
Only PDF, DOC, DOCX, PPT, and PPTX files are supported. Other formats like XLS, TXT, or images will be rejected.
Frequently Asked Questions
How do I upload the document file?
POST to /file/get-signed-upload-urls with the appropriate contentType (e.g., "application/pdf", "application/vnd.openxmlformats-officedocument.presentationml.presentation" for PPTX) and count: 1. This returns a key (like "file/abc123.pdf") and signedUrl. PUT your file to the signedUrl with the matching Content-Type. Finally, use the key in linkedinAttachmentKey when creating the post.
What document formats does LinkedIn support?
Through the PostFast API, LinkedIn supports PDF, DOC, DOCX, PPT, and PPTX files. Each format has its own MIME type for the upload request.
How does a document post display on LinkedIn?
Each page of your document becomes a swipeable slide, similar to an image carousel. Users can tap through pages directly in the feed without downloading. This works for PDFs, Word docs, and PowerPoint presentations.