Skip to content
BolderBolder Developers
Esc
↑↓navigate↵open⌘Jpreview

Create a post

Creates a post in the shop’s default blog, or in the blog given by blog_id (see List shop blogs).

To publish a translation, create it in a blog of another language and set translation_of to the original post’s ID: its translation_lang is taken from that blog. An original post can have only one translation per language, and a translation can’t itself be translated.

format: blocks takes an EditorJS JSON document, serialized as a string, in body.

POST/shops/{shop_id}/posts
Authorization
AuthorizationBearer token (JWT) · headerrequired
Path parameters
shop_idintegerrequired
Request body
requiredapplication/json
titlestringrequired
bodystringrequired
slugstring

Auto-generated from title if blank

descriptionstring
short_descriptionstring
publishedboolean
default: false
published_onstring<date-time>
formatstring

markdown is stored as is and rendered by the storefront.

default: "html"
Allowed:htmlblocksmarkdown
blog_idinteger

Blog to publish in. Defaults to the shop's default blog. Must belong to this shop.

translation_ofinteger

ID of the post this one translates. The post must belong to this shop, not be a translation itself, and the blog must have a language different from the original's.

Examples
{
  "title": "Winter Sale",
  "body": "<p>Save big!</p>",
  "published": true
}
Responses
201

Post created

_linksHalLinks
idinteger
shop_idinteger
titlestring
slugstring
bodystring
descriptionstring
short_descriptionstring
publishedboolean

There is no status field — this is a boolean.

published_onstring<date-time>
formatstring

blocks means body is an EditorJS JSON document (as a string).

Allowed:htmlblocks
blog_idinteger

The blog this post lives in. A shop can have several blogs, each with its own language; new posts go to the shop's default blog unless blog_id is given.

translation_ofinteger | null

ID of the original post when this post is a translation of it; null for an original post.

translation_langstring | null

Language of this translation (the language of its blog, e.g. es); null for an original post.

user_idinteger
created_onstring<date-time>
updated_onstring<date-time>
pathstring

Path of the post on the storefront, e.g. /blog/2024/3/15/hello (/es/blog/... for a blog in another language than the shop's).

urlstring | null

Full storefront URL of the post. Unpublished posts end in ?preview=1.

422

Validation error

Try it
Server
Authorization
Parameters
Bodyapplication/json
Request
curl -s -X POST \
  -H "Authorization: Bearer $BOLDER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"title":"Winter Sale","body":"<p>Save big!</p>","published":true}' \
  "https://api.onbolder.com/v2/shops/1/posts"
Response
{
  "_links": {
    "property1": {
      "href": "string",
      "templated": true,
      "method": "get",
      "title": "string",
      "type": "string"
    },
    "property2": {
      "href": "string",
      "templated": true,
      "method": "get",
      "title": "string",
      "type": "string"
    }
  },
  "id": 0,
  "shop_id": 0,
  "title": "string",
  "slug": "string",
  "body": "string",
  "description": "string",
  "short_description": "string",
  "published": true,
  "published_on": "2019-08-24T14:15:22Z",
  "format": "html",
  "blog_id": 0,
  "translation_of": 0,
  "translation_lang": "string",
  "user_id": 0,
  "created_on": "2019-08-24T14:15:22Z",
  "updated_on": "2019-08-24T14:15:22Z",
  "path": "string",
  "url": "string"
}

Was this page helpful?