efamex API
Publish or schedule a post to one brand's social accounts from your own software. Requests are JSON (or multipart/form-data for file uploads); answers are always JSON. Everything runs over HTTPS.
Quick example
Publish a post with one image to a brand's Facebook and LinkedIn accounts right away. Put your
API key and secret in the environment variables EFAMEX_API_KEY and EFAMEX_API_SECRET.
POSThttp://efamex.com/api/v1/posts
with the headers X-Api-Key, X-Api-Secret and Content-Type: application/json, and this body:
{
"brand": "acme-bakery",
"channels": ["facebook", "linkedin"],
"format": "image",
"text": "Fresh from the oven",
"media_urls": ["https://cdn.example.com/bread.jpg"],
"alt_text": "A loaf of bread on a wooden table"
}
curl -X POST http://efamex.com/api/v1/posts \
--max-time 60 \
-H "X-Api-Key: $EFAMEX_API_KEY" \
-H "X-Api-Secret: $EFAMEX_API_SECRET" \
-H "Content-Type: application/json" \
-d '{
"brand": "acme-bakery",
"channels": ["facebook", "linkedin"],
"format": "image",
"text": "Fresh from the oven",
"media_urls": ["https://cdn.example.com/bread.jpg"],
"alt_text": "A loaf of bread on a wooden table"
}'
Node.js 18 or later, no packages needed. Save it as post.mjs and run node post.mjs.
const response = await fetch('http://efamex.com/api/v1/posts', {
method: 'POST',
headers: {
'X-Api-Key': process.env.EFAMEX_API_KEY,
'X-Api-Secret': process.env.EFAMEX_API_SECRET,
'Content-Type': 'application/json',
},
body: JSON.stringify({
brand: 'acme-bakery',
channels: ['facebook', 'linkedin'],
format: 'image',
text: 'Fresh from the oven',
media_urls: ['https://cdn.example.com/bread.jpg'],
alt_text: 'A loaf of bread on a wooden table',
}),
// Publishing now waits for the networks, so allow up to a minute.
signal: AbortSignal.timeout(60_000),
});
const post = await response.json();
if (!response.ok) {
throw new Error(`${response.status}: ${post.error}`);
}
console.log(post.id, post.status);
for (const delivery of post.deliveries) {
console.log(delivery.channel, delivery.status, delivery.permalink ?? delivery.error ?? '');
}
Any supported PHP version with the curl extension, no packages needed.
<?php
$curl = curl_init('http://efamex.com/api/v1/posts');
curl_setopt_array($curl, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'X-Api-Key: ' . getenv('EFAMEX_API_KEY'),
'X-Api-Secret: ' . getenv('EFAMEX_API_SECRET'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'brand' => 'acme-bakery',
'channels' => ['facebook', 'linkedin'],
'format' => 'image',
'text' => 'Fresh from the oven',
'media_urls' => ['https://cdn.example.com/bread.jpg'],
'alt_text' => 'A loaf of bread on a wooden table',
], JSON_THROW_ON_ERROR),
CURLOPT_RETURNTRANSFER => true,
// Publishing now waits for the networks, so allow up to a minute.
CURLOPT_TIMEOUT => 60,
]);
$body = curl_exec($curl);
if ($body === false) {
throw new RuntimeException(curl_error($curl));
}
$status = curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
$post = json_decode($body, true, 512, JSON_THROW_ON_ERROR);
if ($status !== 201) {
throw new RuntimeException("$status: {$post['error']}");
}
echo $post['id'], ' ', $post['status'], PHP_EOL;
foreach ($post['deliveries'] as $delivery) {
echo $delivery['channel'], ' ', $delivery['status'], ' ', $delivery['permalink'] ?? $delivery['error'] ?? '', PHP_EOL;
}
Answer: 201 Created
{
"id": "p4zEfWIs",
"brand": "acme-bakery",
"brand_archived": false,
"status": "sent",
"format": "image",
"text": "Fresh from the oven",
"scheduled_at": "2026-11-18T13:02:11+00:00",
"sent_at": "2026-11-18T13:02:14+00:00",
"error": null,
"deliveries": [
{ "target_id": "t1ThLinU", "channel": "facebook", "name": "Acme Bakery", "status": "published", "permalink": "https://www.facebook.com/...", "error": null },
{ "target_id": "t1ThLikp", "channel": "linkedin", "name": "Jane Doe", "status": "processing", "permalink": null, "error": null }
]
}
Every field is explained under Create a post, media rules under Sending media, and what each status means under Statuses.
1. Authentication
Every request needs an API key and its API secret. A user creates them in the app under
API keys (http://efamex.com/app/settings/api-keys).
The key starts with efxk_ and stays visible in the app. The secret starts with efxs_
and is shown only once, so store it somewhere safe. If it is lost, create a new key and revoke the old one.
Send both on every request, in these two headers:
X-Api-Key: efxk_your_key_here
X-Api-Secret: efxs_your_secret_here
- Posts made with a key are made in the name of the user who created it, for that user's organization.
- A key can only reach its own organization's brands and posts. Anything else is answered with
404. - A key can be revoked at any time on the same page. From then on it gets
401. - Treat the secret like a password: never put it in a URL, in browser code or in a public repository.
2. Create a post
POSThttp://efamex.com/api/v1/posts
One post goes to one brand, on the channels you name. Leave out scheduled_at to publish
right away, or give a time to schedule it.
| Field | Type | Description | |
|---|---|---|---|
brand | string | required | The brand to post for, by its name exactly as shown under Brands in the app, e.g. acme-bakery. Upper and lower case do not matter. Renaming a brand in the app changes the name to send here. |
channels | array of strings | required | For example ["facebook", "linkedin"]. Case does not matter. Each channel means every account of that kind in the brand. See Channels. |
text | string | The post text. Some channels require it, and each has a maximum length. | |
format | string |
text, image, carousel, video, reel, story.
Default text. Set it whenever you send media, e.g. image for one picture or carousel for several. | |
media_urls | array of strings | HTTPS links to images or videos that efamex downloads. See Sending media. | |
media[] | files | Only with multipart/form-data: the files themselves. | |
alt_text | string | Image description for screen readers, used on channels that support it. | |
scheduled_at | string |
When to publish, as ISO-8601 with an offset: 2026-12-01T10:00:00+01:00 or 2026-12-01T09:00:00Z.
At least 60 seconds in the future. A time without an offset is refused. |
Publish now
curl -X POST http://efamex.com/api/v1/posts \
-H "X-Api-Key: $EFAMEX_API_KEY" \
-H "X-Api-Secret: $EFAMEX_API_SECRET" \
-H "Content-Type: application/json" \
-d '{
"brand": "acme-bakery",
"channels": ["facebook", "linkedin"],
"text": "We are open on Sunday!"
}'
Schedule
curl -X POST http://efamex.com/api/v1/posts \
-H "X-Api-Key: $EFAMEX_API_KEY" \
-H "X-Api-Secret: $EFAMEX_API_SECRET" \
-H "Content-Type: application/json" \
-d '{
"brand": "acme-bakery",
"channels": ["linkedin_pages"],
"text": "Our new catalogue is out.",
"scheduled_at": "2026-12-01T10:00:00+01:00"
}'
Answer: 201 Created
{
"id": "p4zEfWIs",
"brand": "acme-bakery",
"brand_archived": false,
"status": "sent",
"format": "text",
"text": "We are open on Sunday!",
"scheduled_at": "2026-11-18T13:02:11+00:00",
"sent_at": "2026-11-18T13:02:14+00:00",
"error": null,
"deliveries": [
{
"target_id": "t1ThLinU",
"channel": "facebook",
"name": "Acme Bakery",
"status": "published",
"permalink": "https://www.facebook.com/...",
"error": null
},
{
"target_id": "t1ThLikp",
"channel": "linkedin",
"name": "Jane Doe",
"status": "processing",
"permalink": null,
"error": null
}
]
}
deliveries has one entry per account the post goes to, with that account's own result.
id and target_id are opaque strings: store them as they are and do not parse them.
brand_archived is true when the post's brand has since been archived in the app. Its
name can then be used again by a new brand, so brand may name a different brand today.
All times in answers are UTC. A 201 means the post was accepted; check each delivery's
status to see whether it was published.
3. Sending media
There are two ways. Both can be combined in one multipart request.
Links in JSON (media_urls)
curl -X POST http://efamex.com/api/v1/posts \
-H "X-Api-Key: $EFAMEX_API_KEY" \
-H "X-Api-Secret: $EFAMEX_API_SECRET" \
-H "Content-Type: application/json" \
-d '{
"brand": "acme-bakery",
"channels": ["instagram", "facebook"],
"format": "carousel",
"text": "Three new cakes",
"media_urls": [
"https://cdn.example.com/cake-1.jpg",
"https://cdn.example.com/cake-2.jpg",
"https://cdn.example.com/cake-3.jpg"
],
"alt_text": "Three cakes on a wooden table"
}'
efamex downloads each link once, when the request comes in. The links must:
- use
https://on the standard port 443, without a user name or password in the URL; - point to a public internet address (private, local and internal addresses are refused);
- answer
200directly: redirects are not followed, so use the final URL; - be no larger than the largest file the chosen channels accept (see the table below).
The file type is read from the file's content, not from its name or headers.
File upload (multipart/form-data)
curl -X POST http://efamex.com/api/v1/posts \
-H "X-Api-Key: $EFAMEX_API_KEY" \
-H "X-Api-Secret: $EFAMEX_API_SECRET" \
-F brand=acme-bakery \
-F "channels[]=facebook" \
-F "channels[]=linkedin" \
-F format=image \
-F "text=Fresh from the oven" \
-F "media[][email protected]"
In multipart requests, list fields use []: channels[], media_urls[], media[].
A request larger than the server's upload limit is answered with 413.
Media files are stored privately. They are only passed on to the networks you post to, and they are removed again when no post needs them any more.
4. Get a post's status
GEThttp://efamex.com/api/v1/posts/{id}
curl http://efamex.com/api/v1/posts/p4zEfWIs \
-H "X-Api-Key: $EFAMEX_API_KEY" \
-H "X-Api-Secret: $EFAMEX_API_SECRET"
Answers with the same object as creating the post. Use it to follow a scheduled post, or a delivery
that is still pending or processing. Polling once a minute is plenty.
5. Statuses
The post (status)
scheduled | Waiting for its time. |
sending | Being sent right now. |
sent | Handed to every account. Check the deliveries for each result. |
failed | Could not be sent at all; error says why. |
draft | Saved in the app, not planned. The API does not create drafts. |
Each delivery (deliveries[].status)
scheduled | The post has not been sent yet. |
pending | Queued or being retried automatically. |
processing | Accepted by the network, which is still processing it (common for video). |
published | Live. permalink links to it where the network provides one. |
failed | Not published; error says why. |
cancelled | Stopped, e.g. because the account was disconnected. |
6. Channels and their limits
Use these names in channels. A channel only works if the brand has at least one connected
account of that kind. Content that any chosen channel cannot take is refused before anything is posted,
so a post never goes out on some networks and not on others because of the content.
| Channel | Formats | Text | Media per post | Image | Video | Alt text |
|---|---|---|---|---|---|---|
facebookFacebook Pages |
text, image, carousel, video | up to 63,206 | 1–10 | jpeg max 8 MB |
mp4 max 1024 MB |
no |
instagramInstagram |
image, carousel, reel, story | up to 2,200 | 1–10 | jpeg max 8 MB |
mp4 max 1024 MB |
yes |
| Instagram allows 25 published posts per account in 24 hours. | ||||||
linkedin_pagesLinkedIn Pages |
text, image | up to 3,000, required | 1–1 | jpeg, png max 10 MB |
– | yes |
linkedinLinkedIn |
text, image | up to 3,000, required | 1–1 | jpeg, png max 10 MB |
– | yes |
threadsThreads |
text, image, carousel, video | up to 500 | 1–20 | jpeg max 8 MB |
mp4 max 1024 MB |
no |
| Threads allows 250 published posts per account in 24 hours. | ||||||
"Media per post" applies to formats with media. When you name several channels, the content has to fit all of them. Images may be converted to JPEG for channels that only take JPEG.
7. Errors
Every error is JSON with two fields:
{
"error": "acme-bakery has no threads account that can be posted to.",
"code": "invalid_channels"
}
erroris a sentence you can show to a person. Its wording may change, so never match on it.codeis for your code. A code keeps its meaning within v1. New codes may be added, so treat an unknown code by its HTTP status.
Every 4xx answer to POST means nothing was posted or saved. Fix the request and send it again.
A 503 with the code try_again also means nothing was posted or saved, but the request itself is fine:
send it again unchanged after the number of seconds in the Retry-After header.
| Status | Code | Meaning | What to do |
|---|---|---|---|
400 | invalid_body | The body is not a JSON object or a form. | Send a JSON object with Content-Type: application/json, or multipart/form-data. |
401 | missing_credentials | The X-Api-Key or X-Api-Secret header is missing. | Send both headers on every request. |
401 | invalid_credentials | The key or secret is wrong, or the key was revoked. | Check both values. If the secret is lost, create a new key in the app. |
404 | brand_not_found | No active brand of your organization has that name. | Use the name exactly as shown under Brands in the app. It may have been renamed. |
404 | post_not_found | The post does not exist or belongs to another organization. | Use the id from the answer that created the post. |
404 | not_found | No such address. | Check the URL, including /api/v1/. |
405 | method_not_allowed | Wrong HTTP method for this address. | See the method next to each address above. |
413 | request_too_large | The request is larger than the server accepts. | Send fewer or smaller files, or use media_urls. |
422 | brand_required | brand is missing or empty. | Add the brand's name. |
422 | brand_ambiguous | More than one brand has that name. | Rename one of them in the app. |
422 | invalid_channels | A channel is unknown, none was named, or the brand has no account of that kind that can be posted to. | Use names from Channels. Connect or reconnect the account in the app. |
422 | invalid_scheduled_at | scheduled_at is not an ISO-8601 time with an offset. | Send e.g. 2026-12-01T10:00:00+01:00. |
422 | invalid_content | The content does not fit the chosen channels: text too long or missing, wrong number of media, unknown format, a field of the wrong type, or a time too soon. | Change the content. error says what does not fit; limits are under Channels. |
422 | invalid_media | A file or media link cannot be used: the link answers with an error such as 404, the file is too large, or it cannot be read. | Check the link or file. See Sending media. |
422 | plan_limit_reached | The organization's plan does not cover this post, e.g. the monthly posts are used up. | Upgrade the plan in the app, or wait for the next period. |
422 | post_refused | The post was refused for another reason. | Show error to a person. |
503 | try_again | A passing problem: another post of your organization was being saved at the same moment, a media link did not answer or answered with a server error, or a file could not be stored on our side. | Send the same request again after Retry-After seconds. If it keeps failing, check the media links. |
500 | server_error | Something went wrong on our side. | Check the post with GET before trying again; it may have been posted. |
Any other status comes with the code error.
A few answers can come from a web server or proxy in front of the API before the request reaches it, for example
a 413 for a very large upload or a 502 or 504. These may not be JSON and have no code.
Check the Content-Type of an error answer before reading it as JSON, and go by the HTTP status when it is not JSON.
Example answers
400 Bad Request
{ "error": "Send a JSON object, or multipart/form-data.", "code": "invalid_body" }
401 Unauthorized
{ "error": "Invalid API key or secret.", "code": "invalid_credentials" }
404 Not Found
{ "error": "Brand not found.", "code": "brand_not_found" }
413 Payload Too Large
{ "error": "The request is too large.", "code": "request_too_large" }
422 Unprocessable Content
{ "error": "Unknown channel \"tiktok\". Use one of: facebook, instagram, linkedin_pages, linkedin, threads.", "code": "invalid_channels" }
500 Internal Server Error
{ "error": "Internal Server Error", "code": "server_error" }
503 Service Unavailable with Retry-After: 10
{ "error": "Another post is being saved right now. Please try again.", "code": "try_again" }
8. Good to know
-
Do not retry a POST blindly. If a request times out, it may still have been posted. There is no
idempotency key yet, so a repeated request is a new post. Keep the
idfrom the answer and check it withGETinstead. - Publishing now can take a few seconds, because efamex sends the post before it answers. Allow a timeout of at least 60 seconds, longer when sending media links. Slow processing on a network (such as video) finishes in the background; poll the post to see the result.
- Each API post counts as one post of the organization's monthly plan, however many channels it goes to. A scheduled post is counted when it is scheduled.
-
Failed deliveries are retried automatically when the network's error is temporary. Permanent errors
end as
failed. -
Accounts can expire. If a network's login runs out, that account cannot be posted to until a user
reconnects it in the app, and naming its channel gives a
422. - Scheduled posts can be seen, changed or deleted in the app under Planned.
-
The version is part of the URL (
/api/v1/). Within v1, changes only add things: new optional fields, new fields in answers, new channels or new status values, so ignore what you do not know. A change that could break an existing integration comes as a new version (/api/v2/) and does not replace v1 without notice.