# youtube audio to telegram bot api: file_id - fastsaver api

send youtube audio straight into your telegram bot. POST /youtube/audio/tg-bot returns a file_id your bot forwards. 7 credits a call, 15 when not cached.

> source: https://api.fastsaver.io/docs/youtube/audio-tg-bot

`POST https://api.fastsaver.io/v1/youtube/audio/tg-bot` - audio straight into your telegram bot

we send the audio to your bot and hand back a `file_id`, so your bot forwards a file it already owns instead of uploading one. 7 credits when we have the track cached, 15 when we have to fetch it first. send `X-Return-File-Id: false` to get `channel_id` and `message_id` instead.

Credits: 7 credits, 15 when it is not cached. A failed call costs 0.1 credit.
Every request carries `X-Api-Key`.

## Parameters

- `video_id` (string, required) - youtube video id (not the full url) (example: `vk6014HuxcE`)
- `bot_username` (string, required) - your bot, with the @ (example: `@your_bot`)

## Request

```http
POST https://api.fastsaver.io/v1/youtube/audio/tg-bot
Content-Type: application/json

{
  "video_id": "vk6014HuxcE",
  "bot_username": "@bot_username"
}
```

## Response

```json
{
  "ok": true,
  "file_id": "CQACAgIAAxkDAAIVKWk..."
}
```

## what to do with the file_id

the audio is already sitting in your bot. `file_id` is telegram's own handle for it, so `sendAudio` delivers it without uploading anything - no bandwidth from you and no wait. a `file_id` only works for the bot that received the file, which is why we ask for `bot_username`: hand it to another bot and telegram answers `wrong file identifier`. reuse it as often as you like.

```http
POST https://api.telegram.org/bot<your_bot_token>/sendAudio
Content-Type: application/json

{
  "chat_id": 123456789,
  "audio": "CQACAgIAAxkDAAIVKWk..."
}
```

with `X-Return-File-Id: false` you get `channel_id` and `message_id` instead - pass those to `copyMessage` when you would rather forward the original message than send a fresh one.

See: telegram bot api: sendAudio - https://core.telegram.org/bots/api#sendaudio
