Sync a post by externalId
Create or update a post by your own system's ID with PUT /posts/external/{externalId}. Safe to resend.
If your own system already gives each post an ID, like store products, a CMS, or a spreadsheet, you can keep posts in sync using that ID (externalId). If no post has that ID, one is created. If one exists, it is updated. However many times you send the same request, there is only one post.
Request
| Item | Value |
|---|---|
| Method · path | PUT /posts/external/{externalId} |
| Permission | Creating: Write only (write) or higher. Updating a published post: Full access (publish) |
Request fields
The fields are the same as in Create an empty post (draft).
langis always required. You can keep separatekoandenversions under the same ID.slugis required when the post is first created. You can leave it out when updating.- The ID in the URL (
externalId) is what counts. Sending a differentexternalIdin the body doesn't change it.
Example
curl -X PUT https://api-open.weekerp.com/blog/v1/posts/external/prod-123 \
-H "Authorization: Bearer wk_live_xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"lang": "en",
"slug": "product-123-review",
"title": "Product 123 review",
"content": "# Product 123\n\n..."
}'
Response
- You get
201if the post was created, or200if an existing post was updated, with the full post. - If you didn't get a response, you can send the exact same request again. The post won't be created twice.
Sync flow example
For each post in your system:
1. PUT /posts/external/{your ID} (include lang)
201 → new draft / 200 → existing post updated
2. If the response status is "draft" and the post should be public, POST /posts/{id}/publish
If it's already "published", don't publish again
3. If the post was deleted in your system, POST /posts/{id}/unpublish or DELETE /posts/{id}
Common errors
| HTTP | code | Fix |
|---|---|---|
| 400 | post_slug_invalid |
slug is required when the post is first created |
| 400 | lang_invalid |
Send lang as two lowercase letters |
| 403 | api_key_scope_insufficient |
Updating a published post needs a full-access key |
| 429 | daily_post_limit_exceeded |
Only new posts count toward today's new post limit |
For the full list of errors, see Error format in Publish posts with the blog API.