---
title: "Create a new 301 redirect"
method: POST
path: "/redirects"
---

# Create a new 301 redirect

`POST /redirects`

## Request

- Base URL: `https://api.ecommerceapi.uk/v1`
- URL: `https://api.ecommerceapi.uk/v1/redirects`
- Auth: HTTP basic

Creates a new 301 redirect.

## Request body

- RedirectCreate
  - `oldPath` string, required: The old URL path to redirect from (must start with '/').
  - `newPath` string, required: The new URL path to redirect to (must start with '/').

## Response `201`

301 redirect created successfully.

- Redirect
  - `id` integer: Unique identifier for the redirect.
  - `oldPath` string: The old URL path to redirect from (must start with '/').
  - `newPath` string: The new URL path to redirect to (must start with '/').
  - `createdAt` string, date-time: Timestamp when the redirect was created.

## Other responses

- `400`: Invalid request data.
- `401`: Unauthorized. Invalid or missing API key.
- `409`: A redirect for the old path already exists.
- `500`: Server error.

---

[API](https://skmtc.dev/ecommerceapi/apis/301-redirects.md) - [All operations](https://skmtc.dev/ecommerceapi/apis/301-redirects/llms.txt) - [OpenAPI document](https://skmtc.dev/ecommerceapi/apis/301-redirects/revisions/c24d1b1e917a?raw)
