> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qwoty.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Obtenir un média

> Récupérer un fichier média par ID

## Autorisation

<ParamField header="Authorization" type="string" required>
  Jeton Bearer pour l'authentification. Format : `Bearer qwoty_your_token`
</ParamField>

## Paramètres de chemin

<ParamField path="id" type="string" required>
  L'identifiant unique du fichier média
</ParamField>

## Réponse

Cet endpoint retourne une redirection (302) vers l'URL réelle du fichier média. Le fichier peut être accédé directement ou intégré.

<RequestExample>
  ```bash cURL theme={null}
  curl --request GET \
    --url https://qwoty.app/api/medias/media_123abc \
    --location
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://qwoty.app/api/medias/media_123abc', {
    redirect: 'follow',
  })

  // Obtenir l'URL finale après redirection
  const mediaUrl = response.url
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://qwoty.app/api/medias/media_123abc',
      allow_redirects=True
  )

  # Obtenir l'URL finale
  media_url = response.url
  ```

  ```html HTML theme={null}
  <!-- Intégration directe -->
  <img src="https://qwoty.app/api/medias/media_123abc" alt="Média" />
  ```
</RequestExample>

<ResponseExample>
  ```json 302 theme={null}
  {
    "Location": "https://storage.qwoty.io/files/abc123..."
  }
  ```

  ```json 400 theme={null}
  {
    "error": "Media ID is required"
  }
  ```

  ```json 404 theme={null}
  {
    "error": "Media not found"
  }
  ```
</ResponseExample>

<Note>
  L'URL du média est temporaire et peut expirer. Utilisez toujours l'endpoint de l'API pour
  récupérer l'URL actuelle.
</Note>
