How to Publish Blog Posts to a Custom API Endpoint Automatically · BloGoose

Blog · Content Automation · November 20, 2026

How to Publish Blog Posts to a Custom API Endpoint Automatically

Authors

Roktim Saha · Senior software engineer

Roktim Saha builds BloGoose. He is a senior software engineer in India, and Verthilix is the name he uses for that software. roktimsaha.com

Verthilix · Software

Verthilix is the name Roktim Saha uses for the software he builds, including BloGoose. It is not a company. verthilix.com

How to Publish Blog Posts to a Custom API Endpoint Automatically

Direct answer: A custom API endpoint is the route an article is sent to. The payload schema is the fixed set of fields that route accepts. An idempotency key is a unique string attached to each request so that a retry changes nothing instead of creating a second post.

Your draft is approved, the publish slot passed two hours ago, and the person who owns the receiving route is offline. To publish blog posts to a custom API endpoint you need the one thing nobody handed you: a written description of what that endpoint accepts.

This guide covers the receiver side of the handoff — the fields and auth model your endpoint needs, the retry rule that stops a timeout from becoming a duplicate article, and five steps that end with a verified live URL instead of a hopeful status code.

Hold on to one detail that resurfaces in the failure matrix below: a 200 from your sender proves nothing about whether a page exists.

What Your Endpoint Must Accept Before You Send Anything

Before a request leaves your machine, the destination needs four things: a scoped auth model, a payload schema, an idempotency rule, and its response codes. All four belong to the receiver, which is why sender-side tutorials stop short.

A custom API publish endpoint is one HTTP route that accepts an article as JSON and returns a URL where it can be read. Think of a courier desk: the desk decides which forms are required and what receipt you leave with, and a parcel that ignores the forms never gets accepted.

Most walkthroughs are sender-side, the video-led ones assume you already control WordPress, and none lists what the destination must implement.

What that contract contains:

A custom API publish endpoint must implement four things before a sender can use it reliably. One: a bearer token scoped to posts:write only, so a leaked key cannot read drafts or touch users. Two: a JSON schema fixing seven fields — title, slug, HTML body, status, canonical URL, meta description, and image URLs — each with a length or format rule. Three: an idempotency rule, meaning the same key sent twice returns the original result instead of a second post. Four: defined response codes — 201 created, 409 key already used, 400 schema rejected, 401 token dead.

Two fields break more first sends than any others. Pin the slug at creation to keep the slug stable so the canonical never drifts, and escape the article body before it hits the wire so quotes and angle brackets survive JSON encoding.

Your situationCheapest pathWhat you still build
WordPress onlyWordPress REST API create post (/wp/v2/posts)Scoped application password, error handling
You own the appGeneric POST route at /v1/postsAll four contract pieces
Tool ships only a CMS integrationUse one with a generic HTTP targetSame as above
Webhook consumerDo not publish through itNothing — no canonical URL returned

The Jasper-and-WordPress question lives in that last row. A bundled CMS integration ships to one named CMS; a generic HTTP POST target accepts anything that speaks JSON. Tools that only do the first cannot be pointed at your route.

BloGoose covers the sender half — crawling your site, drafting in your voice, publishing to WordPress or a custom API target — so only the receiver's contract is left to settle.

How Do I Publish a Post to My Endpoint Step by Step?

How Do I Publish a Post to My Endpoint Step by Step?

Send one POST to a versioned route carrying a scoped token and an idempotency key, then prove success by reading the 201 response's Location header and fetching that URL. The first run takes about 30 minutes; later runs are just a schedule.

Before you start: the article's final HTML body, a route that accepts JSON, permission to create an API token, and curl or any HTTP client.

  1. Define and version the route (about 15 minutes). Create the destination as /v1/posts, not /posts, and write down the seven fields it accepts plus the status codes it returns. Versioning the path means a schema change next quarter never breaks a batch run already in flight. You should finish with one page of contract both sides can read.
  2. Mint a bearer token scoped to posts:write (about 5 minutes). Open Settings, then API Keys, and grant only that scope. A key that can also read drafts or touch user records turns a leak into an audit; a posts-only key turns rotation into a one-line change. You should see the token exactly once — store it in an environment variable, never in the repo.
  3. Send the payload (about 5 minutes). Script the request with Content-Type: application/json and an Idempotency-Key built from the slug plus a hash of the body, so a retried article produces the same key:
    curl -X POST https://yourdomain.com/v1/posts \
     -H "Authorization: Bearer $POSTS_TOKEN" \
     -H "Content-Type: application/json" \
     -H "Idempotency-Key: how-to-publish-blog-posts-7f3c9a2b" \
     -d '{"title":"How to Publish Blog Posts to a Custom API Endpoint","slug":"how-to-publish-blog-posts-to-a-custom-api-endpoint","status":"draft","body":"<p>First paragraph.</p>"}'
    You should see HTTP 201 Created.
  4. Read the response instead of scanning for "no error" (2 minutes). Branch on 201 plus a Location header, never on a 2xx range check. 409 Conflict means the key already fired and nothing new was created, 400 means the schema rejected the body, and 401 means the token rolled. You should see exactly one branch taken.
  5. Fetch the Location URL (2 minutes). Send a GET to the returned address and confirm the title and body render as HTML, not as escaped text. Then ping your sitemap and, if the host allows it, push the URL to the Indexing API so discovery does not wait on a crawl. You should see a live page at a stable canonical.

A clean 201 feels like the finish line; the first week of retries and canonical conflicts is where the real failures surface.

What Breaks in the First Week and How Do You Stop It?

What Breaks in the First Week and How Do You Stop It?

Four failures cause almost every week-one publishing incident: a retried timeout, a key rotated mid-batch, a sanitizer that eats your JSON-LD, and image URLs that 404 after an asset move. One status code or pre-flight check identifies each.

You've probably already met the first one — the article that published twice.

201 Created and 409 Conflict separate a safe retry from a double publish.

One nightly batch shows the shape of it: the sender times out at 30 seconds, retries the same payload, and the receiver writes a second copy at a suffixed path, so both URLs canonicalise to themselves. The Idempotency-Key from step three plus a 409 carrying the original Location lets the sender re-read one URL instead of creating two.

Proving that surviving URL is live and indexable is the next step.

How Do You Confirm the Post Is Live and Indexable?

How Do You Confirm the Post Is Live and Indexable?

Treat "it published" as a claim that needs evidence — because a 200 from your own sender proves nothing about the destination. It confirms your request left; it says nothing about what the receiver built.

Four checks, in this order:

  1. GET the returned Location URL. You want a 200 and the expected title in the body — not a redirect, not a draft preview.
  2. View source and check the canonical. The link rel="canonical" value must match the slug you sent, or you have just published a duplicate of your own post.
  3. Fetch the XML sitemap and grep for the slug. The CMS "published" badge and the sitemap frequently disagree after a failed regeneration, and the crawler reads the sitemap.
  4. Request a crawl with the Indexing API. Crawl requests shorten discovery; they do not guarantee indexing.

That last line is the honest boundary of the entire pipeline. You cannot promise a ranking, only that you removed every reason a crawler would skip the page — no orphan slug, no canonical conflict, no missing sitemap entry.

Which means publishing is the start of the work, not the trophy. Next move: optimize the post for AI citations, so the page you proved live is also the page an answer engine quotes.

BloGoose runs that loop end to end — crawl, plan, draft, image, and publish directly to WordPress or your own custom API endpoint, with the AEO layer inside the draft instead of bolted on afterward.

The teams that compound organic traffic are not the ones who ship fastest; they are the ones who verify what shipped, then optimize it, on every single post.