Redirect operations

2 operations named redirects.*. Every one runs in a batch through apply_ops, dry_run_ops, the CLI or the admin.

Updated
OperationWhat it doesPermissionConfirmation
redirects.readRead the draft redirects of the site: the list redirects.update replaces, each { from, to, status }.site.readnone
redirects.updateReplace the site's redirects with redirects, the whole list (at most 500; an empty list removes them all).site.editnone

redirects.read

Read the draft redirects of the site: the list redirects.update replaces, each { from, to, status }. The public site answers the redirects of its published version.

permission: site.readreads onlyclass: read

Example input

{}

Input

The input is a record; see the schema below.

{
  "type": "object",
  "properties": {},
  "additionalProperties": false
}

Output

FieldTypeRequiredNotes
redirectsarray of objectyesAt most 500 items.
redirects[].fromstringyesAt most 2048 characters.
redirects[].tostringyesAt most 2048 characters.
redirects[].status301 | 302yes

Try it

yarn splash redirects.read '{}' --dry-run

redirects.update

Replace the site's redirects with redirects, the whole list (at most 500; an empty list removes them all). Each rule is { from, to, status }: from a path of this site, matched exactly with or without a trailing slash, or ending in /* to take that path and every path under it (/old/* takes /old and /old/a/b; an exact rule wins over a prefix, a longer prefix over a shorter one); to a path of this site (a query or a hash may follow; a request's query is kept when to has none) or an https:// address; status 301 (moved for good) or 302 (moved for now). A locale's paths carry its prefix (/en/old). Refused with 422 redirects_invalid, every problem named: two rules with the same from, a loop (a target that a rule of the chain redirects again), or a rule that adds or changes a from on the path of a published page (unpublish the page or change its address first; an item path of a collection page is not checked). The platform's own paths (/admin, /api, /_…) are refused. Redirects are versioned: the public site answers them, before any page renders, after the next publish; undo restores the previous list.

permission: site.editwrites: settingsclass: transactionundo: yes

Example input

{
  "redirects": [
    {
      "from": "/old-about",
      "to": "/about",
      "status": 301
    },
    {
      "from": "/shop/*",
      "to": "https://shop.example.com/",
      "status": 302
    }
  ]
}

Input

FieldTypeRequiredNotes
redirectsarray of objectyesAt most 500 items.
redirects[].fromstringyesAt most 2048 characters.
redirects[].tostringyesAt most 2048 characters.
redirects[].status301 | 302yes

Output

FieldTypeRequiredNotes
redirectsarray of objectyesAt most 500 items.
redirects[].fromstringyesAt most 2048 characters.
redirects[].tostringyesAt most 2048 characters.
redirects[].status301 | 302yes

Try it

yarn splash redirects.update '{"redirects":[{"from":"/old-about","to":"/about","status":301},{"from":"/shop/*","to":"https://shop.example.com/","status":302}]}' --dry-run

Generated from the operation registry and the MCP tool catalogue (source 12f91a6db01e2760).

Something wrong on this page? Write to docs@librettocms.com.

Libretto docs

Colophon. These docs are a Libretto site: 70 pages in two languages, 21 guide pages imported from Markdown and 42 reference pages generated from the operation registry. Set in Softcore, with code in IBM Plex Mono. Its outline:

/ Libretto docs /start Get started /start/request-access Request access /start/workspace Your workspace /start/first-site Your first site /start/invite-a-client Invite a client /start/connect-claude Connect Claude to Libretto /build Build /build/first-page Build a page /build/layers-and-canvas Layers and canvas /build/site-components Site components /design-system Design system /design-system/tokens Colours, space and themes /design-system/components Components and variants /design-system/fonts Typography and fonts /motion Motion /motion/scenes Scenes and recipes /motion/image-sequences Image sequences /motion/reduced-motion Reduced motion /publish Publish /publish/languages Site languages /publish/versions Publish and versions /publish/members-and-forms Members and forms /publish/domains Domains /publish/redirects Redirects /handover Hand a site to a client /glossary Glossary /agents Agents and API /agents/mcp MCP server /agents/cli CLI /agents/batches Batches /agents/errors Errors and findings /agents/operations Operations /search Search