/redaxo-api-addon:api-routesfrom redaxo-api-addon
Documents how to call the FriendsOfRedaxo/api REST endpoints (v1.2+), covering Bearer and backend-session auth, route tables for articles/categories/slices/modules/templates/languages/media/users/metainfo, the slice POST schema, the /api/me discovery endpoint, OpenAPI spec, unified list format, and 401/404/405/500 diagnostic flow.
Ships in redaxo-api-addon. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
api Addon – Calling the API (v1.2+)The api addon (Repo: FriendsOfRedaxo/api, Vendor-NS: FriendsOfRedaxo\Api) exposes a RESTful API for a REDAXO backend. Auth via Bearer token or backend session cookie, Symfony UrlMatcher routing, mounted at /api/... via YREWRITE_PREPARE.
Canonical reference (always trust over this skill if they disagree): the addon README.md and lib/RoutePackage/*.php.
Authorization: Bearer <token>BearerAuth — token-based frontend API (default for most routes)BackendUser — uses the REDAXO backend session cookie. Every Bearer route is automatically mirrored under /api/backend/... with BackendUser auth and a backend/<scope> scope name. These routes follow the backend user's REDAXO permissions (admin / structure / media / clang / etc.) — no token needed.GET /api/me (v1.3+)First call against any unfamiliar instance – do not guess paths from scope names (media/get is /api/media/{filename}/info):
curl -H "Authorization: Bearer $TOKEN" https://example.org/api/me
path_parameters, query, body incl. type, required, default). Routes of other addons appear too.new BearerAuth(false)); a token without scopes sees exactly one endpoint, me.required follows the validation: a field without an explicit required key is required.?format=openapi returns the same set as a filtered OpenAPI 3.0 spec.GET /api/backend/me is the backend-session variant, unfiltered – permissions are checked per request, meta.note says so.meta.auth.scopes are the token's stored scopes. A scope listed there without a matching endpoint means the route no longer exists, e.g. after a rename in an update.AuthorizationApache strips Authorization in some configurations. If the token is correct but the server returns Authorization failed, add to .htaccess:
RewriteCond %{HTTP:Authorization} .
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
Authoritative list lives in lib/RoutePackage/*.php (scopes) and the addon's README.md (paths + bodies). High-level overview of what's available in v1.2:
| Method | Path | Scope |
|---|---|---|
| GET | /api/structure/articles | structure/articles/list |
| GET | /api/structure/articles/{id} | structure/articles/get |
| POST | /api/structure/articles | structure/articles/add |
| PUT | /api/structure/articles/{id} | structure/articles/update |
| DELETE | /api/structure/articles/{id} | structure/articles/delete |
| POST | /api/structure/categories | structure/categories/add |
| PUT | /api/structure/categories/{id} | structure/categories/update |
| DELETE | /api/structure/categories/{id} | structure/categories/delete |
| GET | /api/structure/articles/{id}/slices | structure/articles/slices/list |
| GET | /api/structure/articles/{id}/slices/{slice_id} | structure/articles/slices/get |
| POST | /api/structure/articles/{id}/slices | structure/articles/slices/add |
| PUT | /api/structure/articles/{id}/slices/{slice_id} | structure/articles/slices/update |
| DELETE | /api/structure/articles/{id}/slices/{slice_id} | structure/articles/slices/delete |
GET/POST list+add, GET/PUT/DELETE on {id} for all three. Scopes: templates/{list,get,add,update,delete}, modules/{list,get,add,update,delete}, system/clangs/{list,get,add,update,delete}.
| Method | Path | Scope |
|---|---|---|
| GET | /api/media | media/list |
| POST | /api/media (multipart/form-data) | media/add |
| GET | /api/media/{filename}/info | media/get |
| GET | /api/media/{filename}/file | media/get/file |
| PUT | /api/media/{filename}/update | media/update |
| DELETE | /api/media/{filename}/delete | media/delete |
| GET | /api/media/category | media/category/list |
| POST | /api/media/category | media/category/add |
| PUT | /api/media/category/{id} | media/category/update |
| DELETE | /api/media/category/{id} | media/category/delete |
Multipart upload: send the file under field name file (multipart/form-data); other metadata fields (title, category_id) sit alongside as form fields. PUT /api/media/{filename}/update reads a replacement file from the same field name file.
POST /api/media is bound to PHP's upload_max_filesize / post_max_size (exceeding them returns 413). Larger files go through five routes that assemble the chunks server-side and then hand the file to rex_media_service::addMedia() — same checks and EPs as a normal upload.
| Method | Path | Route name | Scope |
|---|---|---|---|
| POST | /api/media/upload | media/upload/init | media/upload |
| GET | /api/media/upload/{upload_id} | media/upload/status | media/upload |
| POST/PUT | /api/media/upload/{upload_id}/chunk/{index} | media/upload/chunk | media/upload |
| POST | /api/media/upload/{upload_id}/finalize | media/upload/finalize | media/upload |
| DELETE | /api/media/upload/{upload_id} | media/upload/delete | media/upload |
media/upload. Unlike the routes above, where the scope equals the route name, it is shared — grant media/upload on the token, not the five route names.init takes a JSON body {"filename": "...", "size": <bytes>, "category_id": 0, "title": ""} (unknown fields → 400) and answers 201 with upload_id, chunk_size_max, max_chunks and expires_at. The file extension is checked here already.chunk: send the bytes as the raw request body (application/octet-stream) or as multipart field chunk. index is zero-based; re-sending an index replaces that chunk. More bytes than announced at init → 400.status lists the received chunks, bytes_missing, contiguous and complete — use it to resume after a broken connection.finalize requires the indices to be contiguous from 0 and the total to match size; it answers 201 {"message": "Media created", "filename": "..."}.404 Upload not found./api/backend/media/upload/... with backend-session auth, like all media routes.User CRUD on /api/users[/{id}] (users/{list,get,add,update,delete}), role CRUD on /api/users/roles[/{id}] (users/roles/{list,get,add,update,delete,duplicate}), and user↔role assignment:
GET /api/users/{id}/role → users/role/listPOST /api/users/{id}/role/{role_id} → users/role/assignDELETE /api/users/{id}/role/{role_id} → users/role/removeField definitions and value-roundtrips for the four metainfo prefixes (art_*, cat_*, med_*, clang_*):
GET /api/metainfo/types → metainfo/types/list/api/metainfo/fields[/{id}] → metainfo/fields/{list,get,add,update,delete}GET/PUT /api/structure/articles/{id}/metainfo → metainfo/articles/values/{get,update}GET/PUT /api/structure/categories/{id}/metainfo → metainfo/categories/values/{get,update}GET/PUT /api/media/{filename}/metainfo → metainfo/media/values/{get,update}GET/PUT /api/system/clangs/{id}/metainfo → metainfo/clangs/values/{get,update} (admin-only via Backend-Session)Every Bearer route above is also exposed under /api/backend/<original-path> with scope backend/<original-scope>, authenticated via the REDAXO backend session cookie (no token needed). Permissions follow the user's REDAXO complexPerm settings — admins see everything, restricted users only their assigned structures/media-categories/clangs.
Use these for first-party backend tooling (a custom backend page calling its own API, for example) so you don't have to issue a token to your own backend session.
All list endpoints return:
{
"data": [ ... ],
"meta": { "page": 1, "per_page": 20, "total": 137, "total_pages": 7 }
}
Common query parameters on list endpoints:
page, per_page — pagination (per_page is capped at 1000)sort — comma-separated field:direction, e.g. name:asc,createdate:desc. Each list endpoint has its own whitelist of allowed sort fields; passing an invalid one returns 400 with the allowed list.filter[<field>] — endpoint-specific filters| Status | Body | Meaning |
|---|---|---|
| 401 | {"error":"Authorization failed","required_scope":"users/list"} | Token valid and active, scope missing (v1.3+ adds required_scope) |
| 401 | {"error":"Authorization failed"} | Token missing, wrong, or deactivated – required_scope only appears for a valid token |
| 404 | {"error":"Route not found"} | No route matched the path |
| 405 | {"error":"Method not allowed","allowed":[...]} | Path matched but the HTTP method is wrong; allowed lists valid ones |
| 500 | {"error":"Internal server error","message":"..."} | Controller threw — check var/log/system.log for the exception |
Quick path:
GET /api/me (v1.3+) → shows the token's scopes and every permitted endpoint with path and parameters, and settles "wrong path" versus "missing scope" in one call.Authorization failed with required_scope → extend the token's scope list. Without it → the token is missing, wrong or deactivated (status 0). BackendUser route: log into the backend first.Route not found → check path, method and trailing slash against /api/me or lib/RoutePackage/*.php before suspecting the token.Method not allowed → use one of the methods in allowed[].Internal server error → tail var/log/system.log for the underlying exception. The message field also includes the immediate error string.POST /api/structure/articles/{id}/slices body:
{
"module_id": <int, required>,
"clang_id": <int, required>,
"ctype_id": <int, default 1>,
"value1": "...", "value2": "...", ... "value20": "...",
"media1": "...", ... "media10": "...",
"medialist1":"...", ... "medialist10":"...",
"link1": "...", ... "link10": "...",
"linklist1":"...", ... "linklist10":"..."
}
One slice = one module. Which value* / media* slot maps to which editor field is defined in the module's input PHP as REX_INPUT_VALUE[n] / REX_MEDIA[id=n].
The addon validates before insert:
rex_article::get(...))rex_clang::getAllIds())rex_module)rex_template::hasModule(...)) — otherwise the call fails. If this check fails, look at the template's ctype/module assignment in the backend.PUT on a slice replaces the same fields; DELETE removes the slice and triggers the same EP chain as the backend page (SLICE_DELETE PRE → rex_sql delete → SLICE_DELETED POST → art_content_updated).
A newly-created article/category may return 404 on the frontend even with status=1:
var/cache/addon/yrewrite/...rex_article_service::addArticle() triggers the right EPs, but yrewrite doesn't always regenerate its path cache (especially for new root categories)rex_yrewrite::generatePathFile([])Set custom metainfos (art_*, cat_*, med_*, clang_*) via the metainfo value endpoints:
PUT /api/structure/articles/{id}/metainfo
{ "art_color": "blue", "art_layout": "wide" }
Field definitions are managed via /api/metainfo/fields (admin-only when called via BackendUser; via Bearer the token needs the metainfo/fields/* scopes).
Generated from the route definitions via OpenAPIConfig. Two ways to get it:
?page=api/openapi (Swagger UI), raw JSON with &load_config=1 – all routes, needs a backend login with the api[] permission.GET /api/me?format=openapi (v1.3+) – filtered to the routes the token may call. This is the way for Postman, client generators and agents without a backend login.Parameters and body fields carry type and default in their schema (v1.3+), so client generators work. What the spec lacks are response schemas: list routes answer {data, meta}, detail routes the flat object – see "List response format" above.
structure/article/add vs. structure/articles/add) → 401 Authorization failed. Copy from the route source, don't re-type./api/backend/... mirror for backend-session calls, the plain path for Bearer.rex_yrewrite::generatePathFile([])).value21, media11, link11, … — REDAXO modules only have slots 1–20 (values) / 1–10 (media/medialist/link/linklist). Extra slots are silently ignored, not validated.module_id + clang_id, or with a module_id that isn't allowed in the article's template/ctype → 4xx / 500 with "Template has no module in such ctype". Check the template config before retrying.per_page above 1000 — the value is silently capped at 1000, not honoured as-is. Paginate explicitly with page=N when you actually need more.sort field that isn't in the endpoint's whitelist → 400 with the allowed list in the body. Read that list; don't guess at ?sort=name:asc if the endpoint only accepts e.g. priority/createdate/updatedate.rex_logger is configured and writeable; the addon logs every controller exception.Authorization header missing on Apache → add the RewriteRule above.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub friendsofredaxo/claude-marketplace --plugin redaxo-api-addon2 skills in this plugin
Other plugins' skills for the same job