Create redirect

Create a new redirect

Creates a new redirect rule.

Requires authentication.

Request

POST /redirects

Headers

HeaderValue
AuthorizationBearer <token>
Content-Typeapplication/json

Request Body

FieldTypeRequiredDescription
sourcestringYesSource path to redirect from. Must start with /.
targetstringYesTarget path to redirect to. Must start with /.
codeintegerYesHTTP redirect status code (e.g. 301 for permanent, 302 for temporary).
priorityintegerNoPriority used when multiple redirects match. Higher values take precedence.

Example Request

{
  "source": "/old-page",
  "target": "/new-page",
  "code": 301,
  "priority": 0
}

Response

Returns the created redirect object.

Example Response

{
  "id": 42,
  "source": "/old-page",
  "target": "/new-page",
  "code": 301,
  "priority": 0
}
Body Params
string

The relative source path of the redirect starting with /.

integer

The http code type of the redirect (e.g. 301, 302).

string

The relative target link for the redirect starting with /.

integer

Priority of this redirect if more than one redirect matches.

Headers
string
required

Makaira Instance ID

Response
200

OK

Language
Credentials
Bearer
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here!