Skip to content

Create Post Type

POST
/api/v1/post-types

Creates a user-defined post type. Requires session + POST_TYPES_ADMIN_ROLES (inherits BLOG_ADMIN_ROLES). Returns 403 USER_TYPES_DISABLED when POST_TYPES_ALLOW_USER_TYPES=false. type_key cannot be changed later.

Authorizations

SessionAuth

Session ID for authenticated requests

Type
API Key (header: X-Session-ID)

Request Body

application/json
JSON
{
  
"type_key": "string",
  
"type_name": "string",
  
"description": "string",
  
"slug_prefix": "string",
  
"field_schema": [
  
  
{
  
  
  
"name": "string",
  
  
  
"label": "string",
  
  
  
"type": "string",
  
  
  
"required": true,
  
  
  
"options": [
  
  
  
  
"string"
  
  
  
],
  
  
  
"max_length": 0,
  
  
  
"placeholder": "string"
  
  
}
  
],
  
"behaviors": {
  
  
"public_by_default": true,
  
  
"enables_seo": true,
  
  
"enables_comments": true,
  
  
"enables_reactions": true,
  
  
"enables_bookmarks": true,
  
  
"enables_views": true,
  
  
"enables_scheduling": true,
  
  
"requires_approval": true,
  
  
"allows_password_visibility": true,
  
  
"default_visibility": "string",
  
  
"allowed_body_formats": [
  
  
  
"string"
  
  
],
  
  
"max_per_author": 0,
  
  
"additionalProperties": "string"
  
},
  
"icon": "string",
  
"color": "string",
  
"is_active": true,
  
"sort_order": 0
}

Responses

Type created

application/json
JSON
{
  
"data": {
  
  
"id": "string",
  
  
"type_key": "case-study",
  
  
"type_name": "Case Study",
  
  
"description": "string",
  
  
"slug_prefix": "string",
  
  
"field_schema": [
  
  
  
{
  
  
  
  
"name": "string",
  
  
  
  
"label": "string",
  
  
  
  
"type": "string",
  
  
  
  
"required": true,
  
  
  
  
"options": [
  
  
  
  
  
"string"
  
  
  
  
],
  
  
  
  
"max_length": 0,
  
  
  
  
"placeholder": "string"
  
  
  
}
  
  
],
  
  
"behaviors": {
  
  
  
"public_by_default": true,
  
  
  
"enables_seo": true,
  
  
  
"enables_comments": true,
  
  
  
"enables_reactions": true,
  
  
  
"enables_bookmarks": true,
  
  
  
"enables_views": true,
  
  
  
"enables_scheduling": true,
  
  
  
"requires_approval": true,
  
  
  
"allows_password_visibility": true,
  
  
  
"default_visibility": "string",
  
  
  
"allowed_body_formats": [
  
  
  
  
"string"
  
  
  
],
  
  
  
"max_per_author": 0,
  
  
  
"additionalProperties": "string"
  
  
},
  
  
"icon": "string",
  
  
"color": "string",
  
  
"is_active": true,
  
  
"is_built_in": true,
  
  
"sort_order": 0,
  
  
"created_at": "string",
  
  
"updated_at": "string"
  
}
}

Playground

Server
Authorization
Body

Samples

Powered by VitePress OpenAPI

Create a user-defined post type.

Auth: session + post-types admin role (+ origin checks as configured).

Parameters

None.

Request Body

json
{
	"type_key": "case-study",
	"type_name": "Case Study",
	"description": "Customer success stories",
	"slug_prefix": "case-studies",
	"field_schema": [
		{
			"name": "client",
			"label": "Client",
			"type": "text",
			"required": true
		}
	],
	"behaviors": {
		"requires_approval": true,
		"enables_seo": true
	},
	"is_active": true,
	"sort_order": 10
}

Response 200

json
{
	"data": {
		"id": "pt_2",
		"type_key": "case-study",
		"type_name": "Case Study",
		"is_active": true,
		"is_built_in": false
	}
}

Response Errors

  • 400 invalid payload or type_key
  • 401 missing session
  • 403 insufficient role or USER_TYPES_DISABLED
  • 503 MODULE_DISABLED

Notes

  • type_key is immutable after create.
  • Returns 403 USER_TYPES_DISABLED when POST_TYPES_ALLOW_USER_TYPES=false.
  • Admin roles: POST_TYPES_ADMIN_ROLESBLOG_ADMIN_ROLESadmin,superadmin.