Search Documentation
Search for a documentation page...
Redirects API
REST API endpoints for managing store URL redirects, one at a time or up to 5,000 per request.
Redirects send visitors from an old storefront address to a new one: after a product slug change, or when moving a shop from another platform. Each redirect has a source (the old path), a target (a path or an absolute URL), a match type and an HTTP status. Every change is synced to the storefront.
Reading redirects needs the storefront:read scope; creating, updating and deleting them needs content:write.
The Redirect object
| Field | Type | Description |
|---|---|---|
id | string | Redirect UUID |
storeId | string | Store UUID |
source | string | Path to redirect from. Lowercased, without query string and trailing slash for exact and prefix; kept as sent for regex |
target | string | A path, or an absolute URL for another domain. Case is kept |
matchType | "exact" | "prefix" | "regex" | How source is matched |
status | "301" | "302" | HTTP status of the redirect |
forwardQuery | boolean | Whether the incoming query string is copied onto the target |
enabled | boolean | Disabled redirects are kept but not applied |
position | number | Evaluation order when several prefix or regex rules match; lower runs first |
title | string | null | Optional note describing the redirect |
hits | number | How many times the redirect was used |
lastAccessedAt | string | null | When it was last used |
createdAt | string | ISO 8601 timestamp |
updatedAt | string | ISO 8601 timestamp |
Write responses can also carry a warnings array of strings when a rule could not be made live on the storefront. It is left out when there is nothing to report.
List Redirects
Returns the store's redirects ordered by position, then source. Without limit or offset, every redirect is returned.
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | number | 1000 | Redirects per page (1-1000). Only applied when limit or offset is sent |
offset | number | 0 | Redirects to skip |
A value that is not a non-negative integer is ignored.
Response
Get Redirect
Returns one redirect by UUID, as a bare Redirect object. Returns 404 when the store has no redirect with that id.
Create Redirect
Creates one redirect. To create many at once, send an array instead: see Create Many Redirects.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
source | string | Yes | Path to redirect from, e.g. /old-url. A regular expression when matchType is regex |
target | string | Yes | A path, or an absolute URL for another domain. May carry its own query string, and $1-$9 backreferences when matchType is regex |
matchType | "exact" | "prefix" | "regex" | No | exact (default): the path must match exactly. prefix: the path or anything beneath it matches, and the remaining segments are appended to the target. regex: source is a regular expression |
status | "301" | "302" | No | 301 (default) for a permanent move, 302 when the old URL will come back |
forwardQuery | boolean | No | Copy the incoming query string onto the target; params set on the target win (default true) |
enabled | boolean | No | Default true |
position | number | No | Integer, at least 0 (default 0) |
title | string | null | No | Optional note, up to 200 characters |
Unknown fields are rejected.
Response (201)
The created Redirect object, plus warnings when there are any.
Errors
| Status | When |
|---|---|
400 | Invalid body; source and target are the same URL; a regex source that is empty, longer than 500 characters, has a repeat inside a repeat (like (a+)+) or does not compile |
409 | The store already has a redirect for that source. Update it with PATCH, or send a different source |
Create Many Redirects
Send an array of 1 to 5,000 redirects, each with the fields of Create Redirect, to write them in one request with a single storefront sync.
- Every row is checked first. If any row is invalid, or the same source appears twice in the batch, nothing is written.
- A source the store already has is updated instead of refused, so the same batch can be sent again.
Response (200)
count is the number of redirects created or updated.
Errors
An empty array or one over 5,000 rows returns 400. Invalid rows return 400 naming each row by its 1-based position (up to 20), for example row 2: source sent twice, with this hint:
Sources are compared after normalising, so /Old and /old/ count as the same source.
Update Redirect
Send any subset of the Create Redirect fields; omitted fields keep their current value.
Response (200)
The updated Redirect object, plus warnings when there are any. Returns 404 when the redirect does not exist, 400 for an invalid rule and 409 when another redirect already owns the new source.
Delete Redirect
Deletes one redirect. Returns 204 with no body, or 404 when the store has no redirect with that id.
Delete Many Redirects
Send a JSON array of 1 to 5,000 redirect UUIDs to delete them in one request with a single storefront sync. An id the store does not have is skipped.
Response (200)
count is the number of redirects actually deleted.
Anything other than an array of 1 to 5,000 UUIDs (an empty array, an id that is not a UUID, or an object such as {"ids": [...]}) returns 400.