---
title: "Create a redirect rule"
method: POST
path: "/redirects"
tags: ["Redirects"]
---

# Create a redirect rule

`POST /redirects`

## Request

- Base URL: `https://api.cavuno.com/v1`
- URL: `https://api.cavuno.com/v1/redirects`
- Auth: HTTP bearer

Creates a redirect. The request is idempotent when an `Idempotency-Key` header is supplied.

## Request body

- CreateRedirectBody
  - `fromPath` string, required: Source path to match, for example `/old-careers`.
  - `toPath` string, required: Destination path or URL, for example `/jobs`.
  - `statusCode` union: HTTP status code. One of `301` or `302`. Defaults to `301`.
    - 301
    - 302

## Response `201`

Successful response.

- Redirect
  - `id` string, required: Unique identifier for the redirect.
  - `object` 'redirect', required: String representing the object's type. Objects of the same type share the same value.
  - `fromPath` string, required: Source path matched by this redirect.
  - `toPath` string, required: Destination path or URL.
  - `statusCode` union, required: HTTP status code used when redirecting.
    - 301
    - 302
  - `createdAt` string, required: Time at which the redirect was created. ISO 8601 datetime.

## Other responses

- `400`: The request was malformed.
- `409`: A redirect from this path already exists.

## Changes

- **2026-10-19** `c34152c38176`: 2 info
  - added the optional property `error/upgrade` to the response with the `400` status
  - added the optional property `error/upgrade` to the response with the `409` status

[Operation history](https://skmtc.dev/cavuno/apis/cavuno-v1-rest-api/changes/redirects/post.md)

---

[API](https://skmtc.dev/cavuno/apis/cavuno-v1-rest-api.md) · [All operations](https://skmtc.dev/cavuno/apis/cavuno-v1-rest-api/llms.txt) · [OpenAPI document](https://skmtc.dev/cavuno/apis/cavuno-v1-rest-api/revisions/d5974dabff14?raw)
