Register, rename or remove a React Native app's screens.
POST/ai-builder-api/cli/projects/:projectId/sandbox/extension-routes
Changes the screen list of a React Native app (react_native_app_kernel_v1) once its screen files are written with POST .../sandbox/edit: app-extensions/routes.ts is generated from these changes, never written as text. Send several changes as one batch: all of them apply or none does, and a resent batch that is already in effect changes nothing (a repeated single add is refused as duplicate_id). The run started next with externalAgent: true checks the screens, saves them as a mobile revision and deploys the preview.
Request
The API version.
v3Project identifier.
Possible values: Value must match regular expression ^prj_[A-Za-z0-9]+$
- application/json
- Body
- Example (auto)
Bodyrequired
One change, or several as { "action": "batch", "changes": [...] }. A change is { "action": "add", "route": { "id", "label", "icon", "requires"?, "parent"?, "copyKey"?, "filledIcon"? } }, { "action": "rename", "id", "newId", "label"? } or { "action": "remove", "id" }. id is kebab-case and names the screen file; icon is one of the kernel's icon names, and an unknown one is refused; parent makes the screen a detail pushed from that route.
{
"action": {
"action": "batch",
"changes": [
{
"action": "add",
"route": {
"id": "class-schedule",
"label": "Schedule",
"icon": "Calendar"
}
}
]
}
}
The route change, or why it was refused (ok false with reason and error).
- application/json
- Schema
- Example (auto)
Schema
Whether the change applied. False changes nothing; reason, error and problems say why.
The action that applied.
addrenameremovebatchThe route id a single change added, renamed to or removed; for a batch, every such id.
Ids whose change in the batch was already in effect.
The app's routes after the change.
What changed, in one sentence.
Why the change was refused, as a code.
Why the change was refused, in words.
Every problem a refused batch found, so one answer fixes them all.
{
"ok": true,
"action": "batch",
"changed": [
"class-schedule"
],
"unchanged": [],
"routes": [
{
"id": "class-schedule",
"href": "/(app)/ext/class-schedule",
"label": "Schedule"
}
],
"summary": "Added class-schedule.",
"reason": "duplicate_id",
"error": "change 0: screen id \"class-schedule\" is already registered",
"problems": [
{
"reason": "duplicate_id",
"message": "change 0: screen id \"class-schedule\" is already registered"
}
]
}