---
title: "Create a URL rewrite"
method: POST
path: "/marketing/url-rewrites"
tags: ["Admin Marketing: Search & SEO"]
---

# Create a URL rewrite

`POST /marketing/url-rewrites`

## Request

- Base URL: `http://localhost:8000/api/admin`
- URL: `http://localhost:8000/api/admin/marketing/url-rewrites`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/bagisto/apis/bagisto-admin-api/docs/marketing/url-rewrites/post.ts> (a function with typed inputs; its response is checked against the schema)

Create a URL rewrite

## Request body

- object
  - `entity_type` 'product' | 'category' | 'cms_page', required
  - `request_path` string, required
  - `target_path` string, required
  - `redirect_type` '301' | '302', required
  - `locale` string, required

## Response `201`

URL rewrite created.

## Other responses

- `400`: Invalid input
- `422`: Validation failure.

---

[API](https://skmtc.dev/bagisto/apis/bagisto-admin-api.md) - [All operations](https://skmtc.dev/bagisto/apis/bagisto-admin-api/llms.txt) - [OpenAPI document](https://skmtc.dev/bagisto/apis/bagisto-admin-api/revisions/3198f11be70f?raw)
