Docs / Posts
create_post
Publish one post, or repost one.
This action can change or spend something, and when it does it happens right away. Read “Good to know” first.
What you give it
| Input | What it is | Where to get it |
|---|---|---|
textoptional | Text, up to 3000 characters. The post text, exactly as it should appear. May be empty only for a plain repost. | You write it. |
attachmentUrlsoptional | A list (a link), up to 9. Images, one video or one document to attach. Public https links; each file up to 10 MB, 20 MB in total. | You write it. |
videoThumbnailUrloptional | A link. Cover image for an attached video (a public https link). | You write it. |
repostOfoptional | A post link or a post social id. URL of an existing LinkedIn post to repost. With empty text it is a plain repost; with text, a repost with your thoughts. | On LinkedIn, click the More icon (the three dots) at the top right of the post, then "Copy link to post". Or run search_posts and use posts[].url from its answer.9 more places to get it
|
mentionsoptional | A list (a group of fields), up to 20. People or companies to mention. Put {{0}}, {{1}}, … in the text where each one goes (its position in this list).What goes inside
| You write it. |
linkoptional | A link. A link to show as a preview card. It should also appear in the text; otherwise LinkedIn adds it at the end. | You write it. |
jobPostingIdoptional | A job id. Id of one of your job postings to show as a card (from list_job_postings). | Run list_job_postings and use jobPostings[].id from its answer.7 more places to get it
|
asOrganizationoptional | A organization id. Act as a company page you administer instead of yourself: that page's numeric id. No action here lists the pages you administer. | No action here gives it. |
audienceoptional | A search filter id. Limit who sees the post (company-page posts). Each list holds LinkedIn ids from lookup_search_ids (types LANGUAGE, POST_JOB_FUNCTION, SCHOOL, SENIORITY, INDUSTRY, REGION, LOCATION); headcount is company-size ranges such as { min: 51, max: 200 }.What goes inside
| language: run lookup_search_ids with type LANGUAGE, and use matches[].id from its answer.jobFunction: run lookup_search_ids with type POST_JOB_FUNCTION, and use matches[].id from its answer.school: run lookup_search_ids with type SCHOOL, and use matches[].id from its answer.seniority: run lookup_search_ids with type SENIORITY, and use matches[].id from its answer.industry: run lookup_search_ids with type INDUSTRY, and use matches[].id from its answer.region: run lookup_search_ids with type REGION, and use matches[].id from its answer.location: run lookup_search_ids with type LOCATION, and use matches[].id from its answer. |
connectionIdoptional | A connection id. Which of your LinkedIn accounts to act from (its id from list_linkedin_accounts). Omit to use your first live one. | Run list_linkedin_accounts and use accounts[].id from its answer.15 more places to get it
|
Call it
curl -X POST https://api.heyreagent.com/v1/actions/create_post \
-H "Authorization: Bearer YOUR_KEY" \
-H "content-type: application/json" \
-d '{"text":"Hello LinkedIn!"}'The same call in JavaScript
const response = await fetch("https://api.heyreagent.com/v1/actions/create_post", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_KEY",
"content-type": "application/json",
},
body: JSON.stringify({
"text": "Hello LinkedIn!"
}),
});
const answer = await response.json();
console.log(answer);The same call in Python
import requests
response = requests.post(
"https://api.heyreagent.com/v1/actions/create_post",
headers={"Authorization": "Bearer YOUR_KEY"},
json={
"text": "Hello LinkedIn!",
},
)
print(response.json())The same call in n8n
Add an HTTP Request node and fill it in like this:
| Method | POST |
| URL | https://api.heyreagent.com/v1/actions/create_post |
| Send Headers | On. Name Authorization, Value Bearer YOUR_KEY |
| Send Body | On. Body Content Type JSON, Specify Body Using JSON, then paste the body below |
{
"text": "Hello LinkedIn!"
}Put your own key where it says YOUR_KEY. New here? Start with your first call.
What you get back
When it worked, the answer is { "ok": true, "result": { … } }. Inside result:
published | |
postId | A post id. Other actions take it. |
from | the account it ran on |
usedToday | number |
dailyLimit | number |
A field that does not apply to an answer is left out, or is null.
When it did not work, the answer is { "ok": false, "error": "…", "message": "…" }. What each error means.
Good to know
- No published text says which form of id postId is. Pass it to get_post and use the socialId that comes back.
- A mention is written {{0}}, {{1}}, … in the text, by its position in mentions.
- repost true and attachments (a count) are added to the answer when they apply.
In Claude or ChatGPT
Once connected, ask in your own words. The assistant sees this action as a tool with the same name, create_post, and the same inputs.