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

# Загрузить по ссылке

> AiGenda сама скачает файл по прямой ссылке. Отвечает сразу, файл скачивается в фоне.

## Параметры пути

<ParamField path="space_id" type="integer" required>
  Идентификатор пространства.
</ParamField>

## Тело запроса

<ParamField body="url" type="string" required>
  Прямая ссылка на файл, до 255 символов, без авторизации.
</ParamField>

<ParamField body="title" type="string" required>
  Название до 255 символов, заканчивается расширением файла.
</ParamField>

<ParamField body="content_type" type="string" required>
  MIME-тип файла.
</ParamField>

## Ответ

<ResponseField name="audio_id" type="integer">
  Идентификатор записи. Пока файл скачивается, запись скрыта из списка.
</ResponseField>

После ответа дождитесь `is_uploaded: true` в [Статус загрузки](/api-reference/audio/info) по `audio_id`, затем [запустите обработку](/api-reference/processing/classify). Если файл не скачается, запись останется с `is_uploaded: false` без отдельной ошибки. Подробнее: [Загрузка по ссылке](/upload/url).

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.aigenda.tech/api/spaces/1024/audio/by_url/" \
    -H "Authorization: Bearer <access>" \
    -H "Content-Type: application/json" \
    -d '{
      "url": "https://records.example.com/calls/client-call.mp3",
      "title": "Звонок с клиентом 17.10.mp3",
      "content_type": "audio/mpeg"
    }'
  ```

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

  response = requests.post(
      "https://api.aigenda.tech/api/spaces/1024/audio/by_url/",
      headers={"Authorization": "Bearer <access>"},
      json={
          "url": "https://records.example.com/calls/client-call.mp3",
          "title": "Звонок с клиентом 17.10.mp3",
          "content_type": "audio/mpeg",
      },
      timeout=30,
  )
  response.raise_for_status()
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://api.aigenda.tech/api/spaces/1024/audio/by_url/", {
    method: "POST",
    headers: { Authorization: "Bearer <access>", "Content-Type": "application/json" },
    body: JSON.stringify({
      "url": "https://records.example.com/calls/client-call.mp3",
      "title": "Звонок с клиентом 17.10.mp3",
      "content_type": "audio/mpeg"
    }),
  });
  const data = await response.json();
  console.log(data);
  ```
</RequestExample>

<ResponseExample>
  ```json 201 theme={null}
  {
    "audio_id": 51234
  }
  ```

  ```json 400 theme={null}
  {
    "url": [
      "Ensure this field has no more than 255 characters."
    ]
  }
  ```
</ResponseExample>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.