curl --request PATCH \
--url https://api.mercemur.com/api/v1/blog-posts/{postId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"expected_updated_at": "2023-11-07T05:31:56Z",
"slug": "<string>",
"title": "<string>",
"excerpt": "<string>",
"body": {},
"cover_image_url": "<string>",
"author_name": "<string>",
"author_bio": "<string>",
"tags": [
"<string>"
],
"reading_time_minutes": 123,
"seo_meta_title": "<string>",
"seo_meta_description": "<string>",
"seo_og_image_url": "<string>",
"category_id": "<string>"
}
'const options = {
method: 'PATCH',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
expected_updated_at: '2023-11-07T05:31:56Z',
slug: '<string>',
title: '<string>',
excerpt: '<string>',
body: JSON.stringify({}),
cover_image_url: '<string>',
author_name: '<string>',
author_bio: '<string>',
tags: ['<string>'],
reading_time_minutes: 123,
seo_meta_title: '<string>',
seo_meta_description: '<string>',
seo_og_image_url: '<string>',
category_id: '<string>'
})
};
fetch('https://api.mercemur.com/api/v1/blog-posts/{postId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.mercemur.com/api/v1/blog-posts/{postId}"
payload = {
"expected_updated_at": "2023-11-07T05:31:56Z",
"slug": "<string>",
"title": "<string>",
"excerpt": "<string>",
"body": {},
"cover_image_url": "<string>",
"author_name": "<string>",
"author_bio": "<string>",
"tags": ["<string>"],
"reading_time_minutes": 123,
"seo_meta_title": "<string>",
"seo_meta_description": "<string>",
"seo_og_image_url": "<string>",
"category_id": "<string>"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mercemur.com/api/v1/blog-posts/{postId}"
payload := strings.NewReader("{\n \"expected_updated_at\": \"2023-11-07T05:31:56Z\",\n \"slug\": \"<string>\",\n \"title\": \"<string>\",\n \"excerpt\": \"<string>\",\n \"body\": {},\n \"cover_image_url\": \"<string>\",\n \"author_name\": \"<string>\",\n \"author_bio\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"reading_time_minutes\": 123,\n \"seo_meta_title\": \"<string>\",\n \"seo_meta_description\": \"<string>\",\n \"seo_og_image_url\": \"<string>\",\n \"category_id\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mercemur.com/api/v1/blog-posts/{postId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'expected_updated_at' => '2023-11-07T05:31:56Z',
'slug' => '<string>',
'title' => '<string>',
'excerpt' => '<string>',
'body' => [
],
'cover_image_url' => '<string>',
'author_name' => '<string>',
'author_bio' => '<string>',
'tags' => [
'<string>'
],
'reading_time_minutes' => 123,
'seo_meta_title' => '<string>',
'seo_meta_description' => '<string>',
'seo_og_image_url' => '<string>',
'category_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"data": {
"author_bio": "<string>",
"author_name": "<string>",
"body": {
"content": [
{
"content": [
{
"text": "<string>",
"type": "<string>"
}
],
"type": "<string>"
}
],
"type": "<string>"
},
"category": {
"id": "<string>",
"name": "<string>",
"slug": "<string>"
},
"cover_image_url": "<string>",
"created_at": "<string>",
"excerpt": "<string>",
"id": "<string>",
"published_at": "<string>",
"reading_time_minutes": 123,
"seo_meta_description": "<string>",
"seo_meta_title": "<string>",
"seo_og_image_url": "<string>",
"slug": "<string>",
"status": "<string>",
"tags": [
"<string>"
],
"title": "<string>",
"updated_at": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}Update a blog post
curl --request PATCH \
--url https://api.mercemur.com/api/v1/blog-posts/{postId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"expected_updated_at": "2023-11-07T05:31:56Z",
"slug": "<string>",
"title": "<string>",
"excerpt": "<string>",
"body": {},
"cover_image_url": "<string>",
"author_name": "<string>",
"author_bio": "<string>",
"tags": [
"<string>"
],
"reading_time_minutes": 123,
"seo_meta_title": "<string>",
"seo_meta_description": "<string>",
"seo_og_image_url": "<string>",
"category_id": "<string>"
}
'const options = {
method: 'PATCH',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
expected_updated_at: '2023-11-07T05:31:56Z',
slug: '<string>',
title: '<string>',
excerpt: '<string>',
body: JSON.stringify({}),
cover_image_url: '<string>',
author_name: '<string>',
author_bio: '<string>',
tags: ['<string>'],
reading_time_minutes: 123,
seo_meta_title: '<string>',
seo_meta_description: '<string>',
seo_og_image_url: '<string>',
category_id: '<string>'
})
};
fetch('https://api.mercemur.com/api/v1/blog-posts/{postId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.mercemur.com/api/v1/blog-posts/{postId}"
payload = {
"expected_updated_at": "2023-11-07T05:31:56Z",
"slug": "<string>",
"title": "<string>",
"excerpt": "<string>",
"body": {},
"cover_image_url": "<string>",
"author_name": "<string>",
"author_bio": "<string>",
"tags": ["<string>"],
"reading_time_minutes": 123,
"seo_meta_title": "<string>",
"seo_meta_description": "<string>",
"seo_og_image_url": "<string>",
"category_id": "<string>"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mercemur.com/api/v1/blog-posts/{postId}"
payload := strings.NewReader("{\n \"expected_updated_at\": \"2023-11-07T05:31:56Z\",\n \"slug\": \"<string>\",\n \"title\": \"<string>\",\n \"excerpt\": \"<string>\",\n \"body\": {},\n \"cover_image_url\": \"<string>\",\n \"author_name\": \"<string>\",\n \"author_bio\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"reading_time_minutes\": 123,\n \"seo_meta_title\": \"<string>\",\n \"seo_meta_description\": \"<string>\",\n \"seo_og_image_url\": \"<string>\",\n \"category_id\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mercemur.com/api/v1/blog-posts/{postId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'expected_updated_at' => '2023-11-07T05:31:56Z',
'slug' => '<string>',
'title' => '<string>',
'excerpt' => '<string>',
'body' => [
],
'cover_image_url' => '<string>',
'author_name' => '<string>',
'author_bio' => '<string>',
'tags' => [
'<string>'
],
'reading_time_minutes' => 123,
'seo_meta_title' => '<string>',
'seo_meta_description' => '<string>',
'seo_og_image_url' => '<string>',
'category_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"data": {
"author_bio": "<string>",
"author_name": "<string>",
"body": {
"content": [
{
"content": [
{
"text": "<string>",
"type": "<string>"
}
],
"type": "<string>"
}
],
"type": "<string>"
},
"category": {
"id": "<string>",
"name": "<string>",
"slug": "<string>"
},
"cover_image_url": "<string>",
"created_at": "<string>",
"excerpt": "<string>",
"id": "<string>",
"published_at": "<string>",
"reading_time_minutes": 123,
"seo_meta_description": "<string>",
"seo_meta_title": "<string>",
"seo_og_image_url": "<string>",
"slug": "<string>",
"status": "<string>",
"tags": [
"<string>"
],
"title": "<string>",
"updated_at": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}Authorizations
A secret API key. Publishable keys cannot reach this API. A key may carry an expiry, and an expired key is refused exactly like an unknown one, with a 401 that names no reason; check the key's expires_at in the dashboard rather than inferring it from a response. When a merchant rolls a key's secret they choose a grace window of up to 3 days, and for its duration BOTH the new secret and the one it replaced authenticate, so an integration moves over on its own deploy schedule instead of at the instant the button is pressed. Move before the window closes: after it, the old secret is refused. Nothing else about this contract moves with a roll. The key keeps its id and its scopes, so the only thing an integration updates is the credential itself.
Headers
A unique key per logical write. Replaying a request with the same key returns the first response byte for byte instead of applying the write twice.
Path Parameters
Body
An omitted field is left unchanged; a nullable field sent as NULL is CLEARED, which is the only way to remove a stale SEO title that is still being served. slug and title are NOT NULL columns and reading_time_minutes is set-only, so null on any of the three is a 400 rather than a silent skip; send [] to remove every tag. A patch naming nothing is refused, so a client with a misspelled field does not read a green light for a no-op. PATCH rather than PUT: status, published_at, scheduled_publish_at and the post's revisions are all state this body cannot express, so a whole-resource replacement reading would be a lie. Every value is an absolute target, so replaying converges. A patch to a PUBLISHED post is live immediately; there is no draft copy of a live post. CHANGING slug CHANGES THE LIVE URL and nothing writes a redirect for you: every inbound link, sent email and indexed result pointing at the old path 404s from the moment this returns 200. Renaming an unpublished post is free because a draft is not served. After publish, pair the rename with POST /api/v1/redirects in the same run. expected_updated_at IS OPTIONAL AND ENFORCED WHEN SENT. Send back the updated_at you read and a write that would revert somebody else's edit is refused 409 post_modified instead of landing silently. Omit it and the write behaves exactly as it always has, last-write-wins: it is optional because this route shipped without it, and requiring it now would break every deployed client. It is compared at the precision you express, so a millisecond timestamp satisfies a microsecond one.
Response
Success
Show child attributes
Show child attributes