Skip to content

Installation

Requirements

  • Python 3.10 or later
  • Wagtail 6.0 or later

Install the package

pip install wagtail-write-api
uv add wagtail-write-api
poetry add wagtail-write-api

Dependencies

The following packages are installed automatically:

Package Purpose
django-ninja API framework (Pydantic + OpenAPI)
markdown Markdown to HTML conversion
markdownify HTML to Markdown conversion
qrcode QR code generation for mobile app connect

Configure Django

Add the app to INSTALLED_APPS:

settings.py
INSTALLED_APPS = [
    # ... your existing apps ...
    "wagtail_write_api",
]

Run migrations to create the API token table:

python manage.py migrate

Add the URL routes

Include the API URLs in your project's URL configuration:

urls.py
from django.urls import include, path

urlpatterns = [
    path("api/write/v1/", include("wagtail_write_api.urls")),
    # ... your other URL patterns ...
]

Create an API token

Generate a token for a user:

python manage.py create_api_token admin

This prints a token you can use in the Authorization header:

Created token: 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b

Verify it works

Start the dev server and check the interactive docs:

python manage.py runserver

Open http://localhost:8000/api/write/v1/docs in your browser.

Test with curl:

curl -H "Authorization: Bearer YOUR_TOKEN" \
     http://localhost:8000/api/write/v1/pages/