Methods
Posts
Publish text and media posts from a connected account, read stats, and delete.
Publish content from a connected account, attach images or video, read a post's engagement stats, and delete.
Upload media (optional)
To attach a photo or video, upload it first and use the returned media_id when creating the post.
POST /v1/media
Send the file as multipart/form-data with fields account_id, kind (image or video) and file.
curl -X POST https://api.correctinbox.com/v1/media \
-H "X-API-KEY: $CORRECTINBOX_API_KEY" \
-F account_id=acc_8f21c0 \
-F kind=image \
-F file=@./launch.png
const form = new FormData();
form.append("account_id", "acc_8f21c0");
form.append("kind", "image");
form.append("file", fileBlob, "launch.png");
const { media_id } = await (
await fetch("https://api.correctinbox.com/v1/media", {
method: "POST",
headers: { "X-API-KEY": process.env.CORRECTINBOX_API_KEY },
body: form,
})
).json();
media_id = requests.post(
"https://api.correctinbox.com/v1/media",
headers={"X-API-KEY": os.environ["CORRECTINBOX_API_KEY"]},
data={"account_id": "acc_8f21c0", "kind": "image"},
files={"file": open("launch.png", "rb")},
).json()["media_id"]
Create a post
POST /v1/posts
| Field | Type | Required | Description |
|---|---|---|---|
account_id |
string | yes | The publishing account. |
text |
string | yes | The post body. |
media |
array | no | Media objects: { "media_id": "...", "alt": "..." }. |
visibility |
string | no | anyone (default) or connections. |
curl -X POST https://api.correctinbox.com/v1/posts \
-H "X-API-KEY: $CORRECTINBOX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"account_id": "acc_8f21c0",
"text": "We just shipped something we are proud of.",
"media": [{ "media_id": "med_3a9", "alt": "Product screenshot" }]
}'
const post = await (
await fetch("https://api.correctinbox.com/v1/posts", {
method: "POST",
headers: {
"X-API-KEY": process.env.CORRECTINBOX_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
account_id: "acc_8f21c0",
text: "We just shipped something we are proud of.",
media: [{ media_id: "med_3a9", alt: "Product screenshot" }],
}),
})
).json();
post = requests.post(
"https://api.correctinbox.com/v1/posts",
headers={"X-API-KEY": os.environ["CORRECTINBOX_API_KEY"]},
json={
"account_id": "acc_8f21c0",
"text": "We just shipped something we are proud of.",
"media": [{"media_id": "med_3a9", "alt": "Product screenshot"}],
},
).json()
Response
{ "object": "post", "id": "pst_91f", "account_id": "acc_8f21c0", "url": "https://www.linkedin.com/feed/update/urn:li:activity:7160..." }
Post stats
GET /v1/posts/{post_id}/stats?account_id={account_id}
{ "likes": 42, "comments": 7, "reposts": 3 }
Delete a post
DELETE /v1/posts/{post_id}?account_id={account_id}
curl -X DELETE "https://api.correctinbox.com/v1/posts/pst_91f?account_id=acc_8f21c0" \
-H "X-API-KEY: $CORRECTINBOX_API_KEY"