MAPI Documentation

The Meta API (MAPI) enables you to create dynamic data structures (entities) and manage content records programmatically.

ℹ️ When to use MAPI Use MAPI when you need structured data like blog posts, products, or any content that might be used across multiple pages. PAPI handles the presentation, MAPI handles the data.

Authentication

MAPI requests require both a Bearer token AND an X-Project-ID header for meta operations:

Authorization: Bearer {your_api_token}
X-Project-ID: {your_project_id}  // Required for /mapi/entities endpoints

Base URL

https://api.websitepublisher.ai

Entities

Entities are like database tables. You define the structure, MAPI creates it.

GET /mapi/entities

List all entities in the project.

Headers: Authorization, X-Project-ID

POST /mapi/entities

Create a new entity with properties.

Request Body

{
    "name": "blogpost",
    "plural": "blogposts",
    "properties": [
        {"name": "title", "type": "varchar", "length": 200, "required": true},
        {"name": "content", "type": "text", "required": true},
        {"name": "published", "type": "tinyint", "default": 0},
        {"name": "published_at", "type": "datetime"}
    ]
}
DELETE /mapi/entities/{name}

Delete an entity and all its records.

⚠️ Destructive Action This permanently deletes the entity and ALL its data.

Properties

POST /mapi/entities/{name}/properties

Add a new property to an existing entity.

{
    "name": "author",
    "type": "varchar",
    "length": 100
}
DELETE /mapi/entities/{name}/properties/{property_id}

Remove a property from an entity.

Note: Use the property ID, not the name.

Property Types

Type Description Parameters
varchar Short text string length (max 255)
text Long text content None
int Integer number None
tinyint Boolean (0/1) None
datetime Date and time Format: YYYY-MM-DD HH:MM:SS
⚠️ Not Supported float, decimal, double, boolean (use tinyint instead)

Records (CRUD)

Once you've created an entity, manage its records:

GET /mapi/project/{project_id}/{entity}

List all records. Supports pagination.

Query params: ?limit=10&offset=0

POST /mapi/project/{project_id}/{entity}

Create a new record.

{
    "title": "My First Blog Post",
    "content": "This is the content...",
    "published": 1,
    "published_at": "2026-01-13 10:00:00"
}
GET /mapi/project/{project_id}/{entity}/{record_id}

Get a specific record by ID.

PUT /mapi/project/{project_id}/{entity}/{record_id}

Update a record.

DELETE /mapi/project/{project_id}/{entity}/{record_id}

Delete a record.

POST /mapi/project/{project_id}/{entity}/search

Search records with filters.

{
    "filters": {
        "published": 1
    }
}
GET /mapi/project/{project_id}/{entity}/count

Get the total count of records.

Complete Example

Creating a blog system:

# 1. Create the blogpost entity
curl -X POST "https://api.websitepublisher.ai/mapi/entities" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "X-Project-ID: 22253" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "blogpost",
    "plural": "blogposts",
    "properties": [
      {"name": "title", "type": "varchar", "length": 200, "required": true},
      {"name": "slug", "type": "varchar", "length": 100, "required": true},
      {"name": "content", "type": "text", "required": true},
      {"name": "published", "type": "tinyint", "default": 0}
    ]
  }'
# 2. Create a blog post
curl -X POST "https://api.websitepublisher.ai/mapi/project/22253/blogpost" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Hello World",
    "slug": "hello-world",
    "content": "This is my first blog post!",
    "published": 1
  }'
# 3. List published posts
curl -X POST "https://api.websitepublisher.ai/mapi/project/22253/blogpost/search" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"filters": {"published": 1}}'

Powered by WebSumo