Fill the blog from outside

Create and update posts from another system — with one call.

One call, one post. It creates the post if it does not exist yet and updates it if it does. So you never have to remember what you already sent.

You need a program key with the task Write blog posts of a website (see Overview). The account's administration must have allowed programs — and allowed them to write.

The call

curl -X POST https://<api-address>/v1/websites/<website-id>/posts \
  -H "Authorization: Bearer modi_pat_…" \
  -H "Idempotency-Key: release-2026-09" \
  -H "Content-Type: application/json" \
  -d '{
    "slug": "release-2026-09",
    "title": "New version released",
    "excerpt": "What changed this month.",
    "body": "<p>As of today …</p>",
    "isPublished": true
  }'

The website id is in the website's address in ModiFax. ModiFax shows you the interface's address right after creating the key.

The fields

FieldRequiredMeaning
titleyesThe headline. At most 300 characters.
slugnoThe natural key: the same slug updates the existing post. Without it, one is formed from the title.
excerptnoThe teaser in the overview. At most 1000 characters.
bodynoThe text as HTML.
isPublishednotrue publishes, false keeps a draft. Without it: draft.
publishedAtnoPublication date. Without it, publishing sets the moment of the call.

The account is not part of the call — it comes from the key. A key never finds a website of another account.

The Idempotency-Key

Every writing call needs the Idempotency-Key header — a value your system chooses for this one operation. If the same call arrives a second time with the same value, for example because your connection dropped, ModiFax answers with the first answer instead of writing twice. The same value with different contents is refused.

The answer

{ "id": "3f2a…", "slug": "release-2026-09", "created": true }

created tells you whether the post was created (true) or updated (false).

What happens to your HTML

The text is sanitised before it is stored. What makes an article stays: paragraphs, headings, lists, links, images, emphasis. What could be executed goes: <script>, event attributes such as onclick, embedded frames.

When something goes wrong

AnswerMeaningWhat to do
401 KEY_REQUIRED / KEY_INVALID / KEY_REVOKED / KEY_EXPIREDThe key is missing, wrong, revoked or expiredCheck the key in your profile or create a new one
403 OPERATION_NOT_GRANTEDThe key does not carry this task — or the account no longer allows writingTick the task when creating the key; ask the administration
400 IDEMPOTENCY_KEY_REQUIREDNo Idempotency-Key sentSend the header
422 IDEMPOTENCY_KEY_REUSEDThe same Idempotency-Key with different contentsChoose a value of its own for every operation
404The website does not exist in this accountCheck the website id
429 TOO_MANY_REQUESTS / QUOTA_EXCEEDEDToo many calls in a short time or quota used upWait for Retry-After and retry

Taking back what a program created

If a program runs off the rails, you take back what it created with one click: in your profile (or, as the administration, under Settings → Personal keys) open the key's protocol, pick a period under Take back what it created and confirm. ModiFax deletes every post the key newly created in that period — through the normal delete, with your rights and in the protocol. Posts it only updated stay.

An example worth having

A change log that writes itself: after every release your pipeline calls this endpoint with slug: "release-<version>". Because the slug is the key, a second run corrects the same entry instead of adding another — and your website keeps a version history without anyone maintaining it.