---
title: "Update a redirect if it exists or creates a new one for a given id"
method: PUT
path: "/redirects/{id}"
tags: ["Private"]
---

# Update a redirect if it exists or creates a new one for a given id

`PUT /redirects/{id}`

## Request

- Base URL: `/v1` (relative, and the document’s source URL is not known)
- URL: `/v1/redirects/{id}`
- Auth: API key in header `Authorization`

## Path parameters

- `id` string, required: Unique identifier for a redirect, represented as the base64 encoding of the from path

## Request body

- RedirectPutBody
  - `from` string
  - `to` string

## Response `200`

The updated redirect

- Redirect
  - `from` string
  - `to` string
  - `id` string: Unique identifier for a redirect, represented as the base64 encoding of the from path
  - `links` object
    - `self` object: A link to the individual redirect
      - `href` string: A fully qualified URL to the redirect API response
      - `id` string: Unique identifier for a redirect, represented as the base64 encoding of the from path

## Other responses

- `201`: The created redirect
- `400`: The request was invalid.
- `401`: Failed to process the request due to being unauthorised.
- `500`: Failed to process the request due to an internal error.

---

[API](https://skmtc.dev/office-of-national-statistics/apis/dis-redirect-api.md) - [All operations](https://skmtc.dev/office-of-national-statistics/apis/dis-redirect-api/llms.txt) - [OpenAPI document](https://skmtc.dev/office-of-national-statistics/apis/dis-redirect-api/revisions/b0310191154e?raw)
