Skip to content

Keep content in sync

EdgeKit’s copy of your content follows your CMS because your CMS says when something changed. Your CMS’s webhook, or an integration you run beside it, calls POST /v1/content/sync with its content source’s source key and the ids that changed. EdgeKit then reads each one’s current state from your CMS and writes it. This route is for Arc XP and WordPress, the CMSs EdgeKit reads itself; any other CMS writes its content through the content API instead.

The request carries a source key and ids, never content. On this route, a caller with your key can only make EdgeKit read an item again from your CMS. What EdgeKit then stores is what your CMS returns.

Send the request with an API key pinned to any of your sites. The route does not check which site. See Issue and revoke API keys.

Terminal window
curl -i https://<tenant>.edgekit.ai/v1/content/sync \
-H 'Authorization: Bearer ek_your_key' \
-H 'Content-Type: application/json' \
-d '{"source": "arcxp", "events": [{"id": "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "type": "story"}]}'
const storyId = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; // the id your CMS sent in its change notice
const response = await fetch('https://<tenant>.edgekit.ai/v1/content/sync', {
method: 'POST',
headers: {
authorization: `Bearer ${process.env.EDGEKIT_API_KEY}`,
'content-type': 'application/json',
},
body: JSON.stringify({
source: 'arcxp', // the content source's source key
events: [{ id: storyId, type: 'story' }],
}),
});
// 200 means enqueued. Retry a 500; fix the request on any other status.
if (!response.ok) throw new Error(`content sync answered ${response.status}`);

The body has two fields. source is required, in the body or in the URL: a webhook that cannot put a fixed value in its body sends /v1/content/sync?source=<source key> instead. When both are present, the body’s is used.

  • source: the Source key of the content source the ids belong to, as Content › Configuration › Sources lists it. One request carries ids of one source.
  • events: 1 to 100 entries, each with:
Field Required What it does
id Yes The CMS id of the item or author that changed, 1 to 256 characters. For Arc XP, the story or author _id. For WordPress, the post id or the user id, as a string.
type No author re-reads one author. For Arc XP, absent or story re-reads an item, and any other value is accepted and nothing is read. For WordPress, any other value or none re-reads a post: EdgeKit does not trust it and looks the id up under each post type.

A 200 answer is {"success": true}. It means EdgeKit queued the reads, not that they are done. See contentSync in the API reference.

For WordPress, send the post type as type, such as {"id": "1234", "type": "post"}. EdgeKit still looks the id up under each of the source’s Post types and marks the item deleted only when none has it; see WordPress.

Status Code Message Cause
400 bad_request Malformed JSON in request body The body is not JSON.
401 unauthorized Missing API key. No key on the request.
401 unauthorized Invalid or missing API key. The key is unknown, revoked or expired.
422 unprocessable_entity Request validation failed. No events, more than 100, or an id, type or source that is empty or too long.
422 unprocessable_entity Name the content source: "source" in the body or the query. The request names no source.
422 unprocessable_entity This organization has no "<source>" content source EdgeKit can sync. No content source has that source key, or it is a pushed source, which uses the content API.
500 internal_error Something went wrong. EdgeKit could not queue the reads. Send the request again.
503 service_unavailable Not configured. Sync is not set up for your organization. Nothing was queued; ask EdgeKit.
  • Repeats are merged. Every id sent again within 5 seconds of the last is read once, so a burst of saves costs one read. Sending an id twice is always safe.
  • Reads are paced. EdgeKit reads at most 4 items or authors every 3 seconds from your CMS, so a large batch is worked through in turn.
  • The read decides what is stored. EdgeKit writes what your CMS returns now, whatever the event said. An item your CMS no longer has is marked deleted and keeps its content; see Content items. An author your CMS no longer has is kept as it is.
  • Nothing needs a deploy. A synced item is live in EdgeKit’s copy as soon as it is written.

Your CMS’s events can miss changes. A change it never announces stays stale until the item’s next event, a re-sync from the console, or a nightly reconciliation if EdgeKit runs one for you. See Nightly reconciliation.

Content › Content › Sync shows one CMS id as EdgeKit holds it beside what a re-sync would write now. Every role can look an id up. A lookup writes nothing, but it reads your CMS, so each one counts against your CMS’s API limits.

  1. Open Content › Content › Sync and pick Items or Authors.
  2. Pick the content source by its source key. The lookup and a re-sync read that source only.
  3. Enter the item’s or author’s id from your CMS and select Look up.

For an item, the screen shows one panel per language EdgeKit holds or your CMS returns. Each panel has the item’s status, when it was Last synced (or Not stored yet), an Open item link, and a diff: lines starting - are stored, lines starting + are what a re-sync would write. No differences. A re-sync would write what is stored. means the copy is current. An author lookup shows one panel the same way, with Open author.

When the screen cannot show a diff, it says why:

The screen says What it means
Your CMS no longer has this item. A re-sync marks it deleted and keeps its content. The item is gone from your CMS. A re-sync writes the deletion.
Your CMS no longer has this author. A re-sync leaves it as stored. Authors are never deleted, so there is nothing to re-sync.
Neither your CMS nor EdgeKit has this id. Check the id and the tab.
This byline has no id in your CMS, so there is no record to read. The author’s id starts with name:; see Authors.
Your CMS pushes this source through the content API, so EdgeKit shows what it stores and reads no CMS. To change it, push it again. A pushed source: the stored side only, and no Re-sync. See Push content from your CMS.
This organization has no CMS token, so EdgeKit cannot read its CMS. EdgeKit does not hold your CMS’s access token. The stored side still shows.
EdgeKit could not read this organization’s CMS token just now, so it shows what is stored. Try again shortly. A passing failure. The stored side still shows.
Your CMS answered a status and a message Your CMS refused the read. The message is your CMS’s own.

Re-sync sends the id through the same path as POST /v1/content/sync. You need the site write permission (the Owner and Admin roles); without it the screen shows no Re-sync button.

  1. Look the id up.
  2. Select Re-sync. It is available only when there is something to write: your CMS returned the id, or EdgeKit holds an item your CMS no longer has.

The screen says Re-sync started., then waits for the new copy and says Re-sync landed. when it arrives. If nothing lands within 30 seconds, it stops waiting and says so; the read may still be queued, so look the id up again later. Each re-sync is recorded in your organization’s audit log with who asked.

edgekit.ai