---
title: "Download content from the content repository overriding the file name."
method: GET
path: "/_matrix/client/v1/media/download/{serverName}/{mediaId}/{fileName}"
tags: ["Media"]
---

# Download content from the content repository overriding the file name.

`GET /_matrix/client/v1/media/download/{serverName}/{mediaId}/{fileName}`

## Request

- Base URL: `https://matrix.org`
- URL: `https://matrix.org/_matrix/client/v1/media/download/{serverName}/{mediaId}/{fileName}`
- 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/v1/media/download/:serverName/:mediaId/:fileName/get.ts> (a function with typed inputs; its response is checked against the schema)

This will download content from the content repository (same as
the previous endpoint) but replaces the target file name with the one
provided by the caller.

**NOTE:** 
Clients SHOULD NOT generate or use URLs which supply the access token in
the query string. These URLs may be copied by users verbatim and provided
in a chat message to another user, disclosing the sender's access token.


Clients MAY be redirected using the 307/308 responses below to download
the request object. This is typical when the homeserver uses a Content
Delivery Network (CDN).

## Path parameters

- `serverName` string, mx-server-name, required
- `mediaId` string, required
- `fileName` string, required

## Query parameters

- `timeout_ms` integer

## Response `200`

The content that was previously uploaded.

## Other responses

- `307`: A redirect to the requested content.
- `308`: A redirect to the requested content.
- `429`: This request was rate-limited.
- `502`: The content is too large for the server to serve.
- `504`: The content is not yet available. A [standard error response](https://spec.matrix.org/v1.19/client-server-api/#standard-error-response) will be returned with the `errcode` `M_NOT_YET_UPLOADED`.

---

[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)
