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.
- Integrating it into a project: checking what's exposed, adapting it, running it.
- How it's built: the modules and where a project plugs in.
- The spec: the design and the reasoning behind it.
- Issues: what's planned.
- feincms3-api-cli: the API from the command line
(
f3api), for people and agents with a shell. - Translating content over 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",
],
# What a string is, where its form field and name don't tell
"KINDS": {"tipps.tipplist.color": "machine"},
"MAX_BATCH_OPERATIONS": 100,
"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.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| feincms3_api-0.2.0.tar.gz | 49.1 kB | With provenance | Details for feincms3_api-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| feincms3_api-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for feincms3_api-0.2.0-py3-none-any.whl |
Total release size: 111.0 kB
Release files / feincms3_api-0.2.0.tar.gz
| Download URL | feincms3_api-0.2.0.tar.gz |
|---|---|
| Size | 49.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d418f31a13b1335224451f1d12433f026fec7d340398b34018b6af26738170d5
|
|
BLAKE2b-256 checksum How to use checksums |
1e48ca5596e74a09d6e79b309d94fcd80e30ff6efe15b72cf085392d6577a556
|
| 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 logRelease files / feincms3_api-0.2.0-py3-none-any.whl
| Download URL | feincms3_api-0.2.0-py3-none-any.whl |
|---|---|
| Size | 61.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a70f5e567f3f7efbcfe04ebd13b58f204e9aeec2fa013a74d8d9d4305461c999
|
|
BLAKE2b-256 checksum How to use checksums |
75f9fd5a4f72cf4b260729ea4aa02afd285f861505778b5f77b9e04907b1ee10
|
| 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 logSecurity for feincms3-api 0.2.0
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.
Attestation for feincms3_api-0.2.0.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 logA 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.