Skip to main content

feincms3-api

A django-ninja API for reading and writing the content of feincms3 sites: pages and other objects with django-content-editor regions and plugins, django-json-schema-editor data and django-cabinet files. For scripts, importers and agents, next to the Django admin, not instead of it.

Status: alpha. The wire format and the Python API may still change.

The admin is the source of truth: the API finds, validates, saves and permits exactly what the admin does, through the admin's querysets, forms, formsets, save hooks and permissions. A plugin with custom validation, or a project hooking save_formset(), behaves the same through the API without any code for the API.

Setup

pip install feincms3-api
INSTALLED_APPS = [
    ...,
    "feincms3_api",
]

Register what the API exposes; nothing else is. Each model needs a ModelAdmin, that's where the forms, permissions and plugins come from:

# app/content_api.py
from feincms3_api.api import ContentAPI
from feincms3_api.cabinet import FileResource, FolderResource
from feincms3_api.forms import ConfiguredFormResource
from feincms3_api.resources import ObjectResource, PageResource, TreeResource

from app.articles.models import Article
from app.forms.models import Form
from app.pages.models import Page

content_api = ContentAPI()
content_api.register(PageResource(Page))
content_api.register(ObjectResource(Article))
content_api.register(ConfiguredFormResource(Form))  # feincms3-forms
content_api.register(FileResource())  # django-cabinet
content_api.register(FolderResource())

Mount it, either as an API of its own or as a router in an existing NinjaAPI:

# app/urls.py
from app.content_api import content_api

urlpatterns = [
    ...,
    path("api/content/", content_api.as_api().urls),
]

./manage.py migrate creates the tables for tokens and uploads. The interactive docs are at api/content/docs.

Settings

FEINCMS3_API = {
    # Never exposed: fields, or values inside JSON data
    "EXCLUDE_FIELDS": [
        "forms.form.recipient_email",
        "pages.jsonplugin_key_figures.data.internal_note",
    ],
    "DEFAULT_PAGE_SIZE": 50,
    "MAX_PAGE_SIZE": 200,
    "TOKEN_LIFETIME": timedelta(hours=8),
    "UPLOAD_LIFETIME": timedelta(days=1),
    "UPLOAD_STORAGE": "default",
}

The schema snapshot

./manage.py f3api_schema app.content_api.content_api prints every type with its fields and what kind of value each is, as a superuser sees them. Commit it and compare it in a test, so a new plugin or field becomes visible through the API only after someone looked at the diff.

Using it

Only active staff users can use the API, with their admin permissions. Scripts and agents use tokens: staff users create their own in the admin (the secret is shown once), or ./manage.py f3api_token USERNAME --write prints one. Tokens are read-only unless created for writing, and expire after TOKEN_LIFETIME. ./manage.py f3api_cleanup removes expired tokens and uploads; run it daily.

API=https://example.com/api/content
AUTH="Authorization: Bearer f3api_…"

curl -H "$AUTH" $API/schema/                       # what's there
curl -H "$AUTH" "$API/pages/find/?path=/de/angebot/"
curl -H "$AUTH" "$API/pages/17/?expand=references"  # one page with its content

Writes need the ETag of what was read (If-Match), and fail as a whole with every problem and its path. ?dry_run=true runs a write in a transaction which is rolled back and returns what it would have done:

curl -X PUT -H "$AUTH" -H 'If-Match: "9f2c…"' -H "Content-Type: application/json" \
  "$API/pages/17/content/?dry_run=true" \
  -d '{"content": {"main": [
        {"type": "pages.richtext", "fields": {"text": "<h2>Hello</h2>"}}
      ]}}'

A dry run runs everything but the commit, signal handlers included: anything they do outside the database (sending mail, calling other APIs, writing files) happens in a dry run too.

Files are uploaded first (POST /uploads/, multipart) and then named in a write as {"upload": "<id>"}. Changes appear in the admin's history, marked "(Through the API.)".

Credits

feincms3-api grows out of feincms3-autotranslate, started by Moritz Wettstein and Matthias Kestenholz at Feinheit in October 2026. Its content introspection (which fields hold text, HTML or links, JSON schemas, plugin discovery) is the base of this package.

Metadata

Release files for feincms3-api 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for feincms3-api 0.1
File Size Uploaded Provenance Actions
feincms3_api-0.1.tar.gz 48.0 kB With provenance Details for feincms3_api-0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for feincms3-api 0.1
File Interpreter ABI Platform Actions
feincms3_api-0.1-py3-none-any.whl Python 3 none any Details for feincms3_api-0.1-py3-none-any.whl

Total release size: 108.5 kB

Release files / feincms3_api-0.1.tar.gz

Download URL feincms3_api-0.1.tar.gz
Size 48.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b55d517c4c2bbb79373d61aad5bc517a126f317a37289cd02190bdc16a555742
BLAKE2b-256 checksum
How to use checksums
2a1024b95b8a2febea9bfaa55081dd158fc8e0244ccd57bb270ff700891b32a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Release files / feincms3_api-0.1-py3-none-any.whl

Download URL feincms3_api-0.1-py3-none-any.whl
Size 60.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
82edbe03aa789ab9ab52384f134bb53dac4057febc8dfe9c9729d688fe2d823f
BLAKE2b-256 checksum
How to use checksums
79809d28571b045dd50ea97e4302187123590677d32a09d78af77c89b57c54c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Security for feincms3-api 0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for feincms3_api-0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page