Skip to main content
POST
/
v1
/
posts
Create post
curl --request POST \
  --url https://api.marblecms.com/v1/posts \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data @- <<EOF
{
  "title": "Getting Started with Next.js",
  "content": "<p>Hello world</p>",
  "description": "A beginner's guide to Next.js",
  "slug": "getting-started-with-nextjs",
  "categoryId": "cryitfjp2345kl05weoybfk9",
  "status": "draft",
  "tags": [
    "cryitfjp4567no07ygqadhm1"
  ],
  "authors": [
    "cryitfjp3456lm06xfpzcgl0"
  ],
  "featured": false,
  "coverImage": "https://media.marblecms.com/cover.jpg",
  "publishedAt": "2024-01-15T10:00:00Z",
  "attribution": {
    "author": "<string>",
    "url": "<string>"
  }
}
EOF
{
  "post": {
    "id": "cryitfjp5678mn09qrstuvwx",
    "slug": "getting-started-with-nextjs",
    "title": "Getting Started with Next.js",
    "status": "draft",
    "featured": false,
    "publishedAt": "2024-01-15T10:00:00.000Z",
    "createdAt": "2024-01-15T10:00:00.000Z"
  }
}

Authorizations

Authorization
string
header
required

Your Marble API key

Body

application/json
title
string
required
Minimum string length: 1
Example:

"Getting Started with Next.js"

content
string
required
Minimum string length: 1
Example:

"<p>Hello world</p>"

description
string
required
Minimum string length: 1
Example:

"A beginner's guide to Next.js"

slug
string
required
Minimum string length: 1
Example:

"getting-started-with-nextjs"

categoryId
string
required
Minimum string length: 1
Example:

"cryitfjp2345kl05weoybfk9"

status
enum<string>
required
Available options:
published,
draft
Example:

"draft"

tags
string[]

Array of tag IDs to attach to the post

Example:
["cryitfjp4567no07ygqadhm1"]
authors
string[]

Array of author IDs. If omitted, the first workspace author is used.

Example:
["cryitfjp3456lm06xfpzcgl0"]
Example:

false

coverImage
string<uri> | null
Example:

"https://media.marblecms.com/cover.jpg"

publishedAt
string<date-time>

ISO 8601 datetime. Defaults to current time if omitted.

Example:

"2024-01-15T10:00:00Z"

attribution
object

Attribution to original author when republishing content

Response

Post created successfully

post
object
required