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

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.

FieldTypeDescription
brandstringrequiredThe 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.
channelsarray of stringsrequiredFor example ["facebook", "linkedin"]. Case does not matter. Each channel means every account of that kind in the brand. See Channels.
textstringThe post text. Some channels require it, and each has a maximum length.
formatstring 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_urlsarray of stringsHTTPS links to images or videos that efamex downloads. See Sending media.
media[]filesOnly with multipart/form-data: the files themselves.
alt_textstringImage description for screen readers, used on channels that support it.
scheduled_atstring 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:

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)

scheduledWaiting for its time.
sendingBeing sent right now.
sentHanded to every account. Check the deliveries for each result.
failedCould not be sent at all; error says why.
draftSaved in the app, not planned. The API does not create drafts.

Each delivery (deliveries[].status)

scheduledThe post has not been sent yet.
pendingQueued or being retried automatically.
processingAccepted by the network, which is still processing it (common for video).
publishedLive. permalink links to it where the network provides one.
failedNot published; error says why.
cancelledStopped, 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.

ChannelFormatsTextMedia per postImageVideoAlt text
facebook
Facebook Pages
text, image, carousel, video up to 63,206 1–10 jpeg
max 8 MB
mp4
max 1024 MB
no
instagram
Instagram
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_pages
LinkedIn Pages
text, image up to 3,000, required 1–1 jpeg, png
max 10 MB
– yes
linkedin
LinkedIn
text, image up to 3,000, required 1–1 jpeg, png
max 10 MB
– yes
threads
Threads
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"
}

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.

StatusCodeMeaningWhat to do
400invalid_bodyThe body is not a JSON object or a form.Send a JSON object with Content-Type: application/json, or multipart/form-data.
401missing_credentialsThe X-Api-Key or X-Api-Secret header is missing.Send both headers on every request.
401invalid_credentialsThe 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.
404brand_not_foundNo active brand of your organization has that name.Use the name exactly as shown under Brands in the app. It may have been renamed.
404post_not_foundThe post does not exist or belongs to another organization.Use the id from the answer that created the post.
404not_foundNo such address.Check the URL, including /api/v1/.
405method_not_allowedWrong HTTP method for this address.See the method next to each address above.
413request_too_largeThe request is larger than the server accepts.Send fewer or smaller files, or use media_urls.
422brand_requiredbrand is missing or empty.Add the brand's name.
422brand_ambiguousMore than one brand has that name.Rename one of them in the app.
422invalid_channelsA 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.
422invalid_scheduled_atscheduled_at is not an ISO-8601 time with an offset.Send e.g. 2026-12-01T10:00:00+01:00.
422invalid_contentThe 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.
422invalid_mediaA 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.
422plan_limit_reachedThe 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.
422post_refusedThe post was refused for another reason.Show error to a person.
503try_againA 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.
500server_errorSomething 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