Create a post.
Creates a post. If source=html is supplied, posts[0].html is converted
into Ghost editor source formats by the input serializer.
To publish immediately, pass status: published. To schedule, pass
status: scheduled and a future published_at. newsletter_id is read-only
on the body. Use the newsletter query parameter with an active newsletter
slug when a publish/schedule/send transition should attach a newsletter.
Authorization
GhostAdminJWT Send Authorization: Ghost <JWT>. This is a custom Ghost scheme, not
standard Bearer.
The JWT is signed with HS256 using the Admin API key secret after hex
decoding it to bytes. The JWT header must include kid set to the Admin
API key id. Ghost verifies the aud claim against the requested Admin or
Content API path and enforces a maximum token age of 5 minutes.
In: header
Query Parameters
Comma-separated includes. Allowed values include tags, authors, authors.roles, email, tiers, newsletter, count.conversions, count.signups, count.paid_conversions, count.clicks, sentiment, count.positive_feedback, count.negative_feedback, post_revisions, and post_revisions.author.
Comma-separated post formats. Allowed values are mobiledoc, lexical, html, and plaintext.
Convert the supplied html field into Ghost editor source formats.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/posts/?include=tags%2Cauthors%2Cnewsletter&formats=html%2Clexical" \ -H "Content-Type: application/json" \ -d '{ "posts": [ { "title": "First story", "status": "draft", "html": "<p>Hello from TribeTale.</p>", "tags": [ "News" ] } ] }'{
"posts": [
{
"id": "string",
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"title": "string",
"slug": "string",
"mobiledoc": "string",
"lexical": "string",
"html": "string",
"plaintext": "string",
"feature_image": "http://example.com",
"featured": true,
"type": "post",
"status": "draft",
"visibility": "string",
"email_segment": "string",
"newsletter_id": "string",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"published_at": "2019-08-24T14:15:22Z",
"custom_excerpt": "string",
"codeinjection_head": "string",
"codeinjection_foot": "string",
"custom_template": "string",
"canonical_url": "http://example.com",
"tags": [
{
"id": "string",
"name": "string",
"slug": "string",
"description": "string",
"feature_image": "http://example.com",
"visibility": "public",
"url": "http://example.com",
"og_image": "string",
"og_title": "string",
"og_description": "string",
"twitter_image": "string",
"twitter_title": "string",
"twitter_description": "string",
"meta_title": "string",
"meta_description": "string",
"codeinjection_head": "string",
"codeinjection_foot": "string",
"canonical_url": "string",
"accent_color": "string",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"count": {}
}
],
"authors": [
{
"id": "string",
"name": "string",
"slug": "string",
"profile_image": "http://example.com",
"cover_image": "http://example.com",
"bio": "string",
"website": "http://example.com",
"location": "string",
"facebook": "string",
"twitter": "string",
"url": "http://example.com"
}
],
"primary_tag": {
"id": "string",
"name": "string",
"slug": "string",
"description": "string",
"feature_image": "http://example.com",
"visibility": "public",
"url": "http://example.com",
"og_image": "string",
"og_title": "string",
"og_description": "string",
"twitter_image": "string",
"twitter_title": "string",
"twitter_description": "string",
"meta_title": "string",
"meta_description": "string",
"codeinjection_head": "string",
"codeinjection_foot": "string",
"canonical_url": "string",
"accent_color": "string",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"count": {}
},
"primary_author": {
"id": "string",
"name": "string",
"slug": "string",
"profile_image": "http://example.com",
"cover_image": "http://example.com",
"bio": "string",
"website": "http://example.com",
"location": "string",
"facebook": "string",
"twitter": "string",
"url": "http://example.com"
},
"newsletter": {
"id": "string",
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"name": "string",
"description": "string",
"feedback_enabled": true,
"slug": "string",
"sender_name": "string",
"sender_email": "string",
"sender_reply_to": "newsletter",
"status": "active",
"visibility": "string",
"subscribe_on_signup": true,
"sort_order": 0,
"header_image": "http://example.com",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
},
"tiers": [
{
"id": "string",
"name": "string",
"description": "string",
"slug": "string",
"active": true,
"type": "free",
"welcome_page_url": "http://example.com",
"visibility": "public",
"benefits": [
"string"
],
"currency": "string",
"monthly_price": 0,
"yearly_price": 0,
"trial_days": 0,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}
],
"og_image": "http://example.com",
"og_title": "string",
"og_description": "string",
"twitter_image": "http://example.com",
"twitter_title": "string",
"twitter_description": "string",
"meta_title": "string",
"meta_description": "string",
"email_subject": "string",
"frontmatter": "string",
"feature_image_alt": "string",
"feature_image_caption": "string",
"email_only": false
}
]
}