---
title: "Create a new mapping from room alias to room ID."
method: PUT
path: "/_matrix/client/v3/directory/room/{roomAlias}"
tags: ["Room directory"]
---

# Create a new mapping from room alias to room ID.

`PUT /_matrix/client/v3/directory/room/{roomAlias}`

## Request

- Base URL: `https://matrix.org`
- URL: `https://matrix.org/_matrix/client/v3/directory/room/{roomAlias}`
- Auth: one of:
  - API key in query parameter `access_token`
  - HTTP bearer
- TypeScript: <https://skmtc.dev/matrix/apis/matrix-client-server-api/docs/_matrix/client/v3/directory/room/:roomAlias/put.ts> (a function with typed inputs; its response is checked against the schema)

## Path parameters

- `roomAlias` string, mx-room-alias, required

## Request body

- object
  - `room_id` string, mx-room-id, required: The room ID to set.

## Response `200`

The mapping was created.

- object

## Other responses

- `400`: The given `roomAlias` is not a valid room alias.
- `409`: A room alias with that name already exists.

---

[API](https://skmtc.dev/matrix/apis/matrix-client-server-api.md) - [All operations](https://skmtc.dev/matrix/apis/matrix-client-server-api/llms.txt) - [OpenAPI document](https://skmtc.dev/matrix/apis/matrix-client-server-api/revisions/c7fe4072c681?raw)
