# 유튜브 오디오 다운로드



유튜브 공개 영상의 소리만 MP3·M4A·Opus 파일로 내려받습니다. 구간만 잘라 받을 수 있고 파일 또는 1시간 유효 다운로드 링크로 받습니다.



인증: Authorization: Bearer $APICK_API_KEY

본문 있는 REST 요청: multipart/form-data. GET 본문 및 MCP JSON-RPC 규격은 해당 명세를 따릅니다.

인증키는 서버에 보관하세요. 모든 예제는 정적 자료입니다.



## POST /rest/youtube_audio_download 응답 필드

- `data` (object): 조회 데이터

- `data.video_id` (string): 11자리 영상 ID

- `data.title` (string): 영상 제목

- `data.duration` (integer): 받은 길이(초). 구간을 지정하면 구간 길이

- `data.size` (integer): 파일 크기(바이트)

- `data.size_units` (integer): 용량 요금 단위 수(10MB 단위 올림)

- `data.content_type` (string): 파일 형식

- `data.filename` (string): 파일명

- `data.download_url` (string): 다운로드 주소. 인증키 없이 받을 수 있고 이어받기(Range)를 지원합니다.

- `data.expires_at` (string): 다운로드 주소 만료 시각(ISO 8601, 발급 1시간 뒤)

- `data.format` (string): 파일 형식 (mp3·m4a·opus)

- `data.bitrate` (integer): MP3 비트레이트(kbps). 그 밖의 형식은 null null 허용.

- `data.billing` (object): 요금 내역

- `data.billing.base` (integer): 기본요금

- `data.billing.size_unit_cost` (integer): 10MB당 요금

- `data.billing.size_cost` (integer): 용량 요금

- `data.billing.total` (integer): 합계(= api.cost)

- `data.success` (integer): API 서버 정상 응답 여부

- `api` (object): API 호출 공통 데이터

- `api.success` (boolean): API 서버 정상 응답 여부

- `api.cost` (integer): 이번 호출 요금(기본요금 + 용량 요금)

- `api.pl_id` (integer): API 결제 로그 ID

- `api.ms` (integer): API 응답 시간

## API 요청: POST /rest/youtube_audio_download



### 입력

- `url` (string, 필수): 유튜브 영상 URL 또는 11자리 영상 ID

- `format` (string, 선택): 파일 형식 mp3(기본)·m4a·opus 허용값: mp3, m4a, opus

- `bitrate` (string, 선택): MP3 비트레이트(kbps). 기본 192 허용값: 128, 192, 320

- `start` (string, 선택): 구간 시작(초 또는 시:분:초)

- `end` (string, 선택): 구간 끝(초 또는 시:분:초)

- `delivery` (string, 선택): file: 응답 본문으로 오디오 파일 (기본값)link: JSON과 1시간 유효한 다운로드 주소



### 응답 명세

```json

{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "video_id": {
          "type": "string",
          "description": "11자리 영상 ID"
        },
        "title": {
          "type": "string",
          "description": "영상 제목"
        },
        "duration": {
          "type": "integer",
          "description": "받은 길이(초). 구간을 지정하면 구간 길이"
        },
        "size": {
          "type": "integer",
          "description": "파일 크기(바이트)"
        },
        "size_units": {
          "type": "integer",
          "description": "용량 요금 단위 수(10MB 단위 올림)"
        },
        "content_type": {
          "type": "string",
          "description": "파일 형식"
        },
        "filename": {
          "type": "string",
          "description": "파일명"
        },
        "download_url": {
          "type": "string",
          "description": "다운로드 주소. 인증키 없이 받을 수 있고 이어받기(Range)를 지원합니다."
        },
        "expires_at": {
          "type": "string",
          "description": "다운로드 주소 만료 시각(ISO 8601, 발급 1시간 뒤)"
        },
        "format": {
          "type": "string",
          "description": "파일 형식 (mp3·m4a·opus)"
        },
        "bitrate": {
          "nullable": true,
          "type": "integer",
          "description": "MP3 비트레이트(kbps). 그 밖의 형식은 null"
        },
        "billing": {
          "type": "object",
          "properties": {
            "base": {
              "type": "integer",
              "description": "기본요금"
            },
            "size_unit_cost": {
              "type": "integer",
              "description": "10MB당 요금"
            },
            "size_cost": {
              "type": "integer",
              "description": "용량 요금"
            },
            "total": {
              "type": "integer",
              "description": "합계(= api.cost)"
            }
          },
          "description": "요금 내역"
        },
        "success": {
          "type": "integer",
          "description": "API 서버 정상 응답 여부"
        }
      },
      "description": "조회 데이터"
    },
    "api": {
      "type": "object",
      "properties": {
        "success": {
          "type": "boolean",
          "description": "API 서버 정상 응답 여부"
        },
        "cost": {
          "type": "integer",
          "description": "이번 호출 요금(기본요금 + 용량 요금)"
        },
        "pl_id": {
          "type": "integer",
          "description": "API 결제 로그 ID"
        },
        "ms": {
          "type": "integer",
          "description": "API 응답 시간"
        }
      },
      "description": "API 호출 공통 데이터"
    }
  }
}

```

### 정적 응답 예시

```json

{
  "data": {
    "video_id": "dQw4w9WgXcQ",
    "title": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)",
    "duration": 213,
    "size": 3449213,
    "size_units": 1,
    "content_type": "audio/mp4",
    "filename": "dQw4w9WgXcQ.m4a",
    "download_url": "https://apick.app/youtube-files/9a8b7c6d5e4f30211203f4e5d6c7b8a9/dQw4w9WgXcQ.m4a",
    "expires_at": "2026-10-06T10:35:12.000Z",
    "format": "m4a",
    "bitrate": null,
    "billing": {
      "base": 20,
      "size_unit_cost": 2,
      "size_cost": 2,
      "total": 22
    },
    "success": 1
  },
  "api": {
    "success": true,
    "cost": 22,
    "pl_id": 1595635,
    "ms": 3210
  }
}

```

### curl

```curl

curl --fail-with-body --request POST 'https://apick.app/rest/youtube_audio_download' \
  --header "Authorization: Bearer $APICK_API_KEY" \
  --form-string 'url=https://www.youtube.com/watch?v=dQw4w9WgXcQ' \
  --form-string 'format=mp3' \
  --form-string 'bitrate=320'

```

### Node.js (서버 ESM)

```javascript

const form = new FormData();
form.append("url", "https://www.youtube.com/watch?v=dQw4w9WgXcQ");
form.append("format", "mp3");
form.append("bitrate", "320");
const response = await fetch("https://apick.app/rest/youtube_audio_download", {
  method: "POST",
  headers: { Authorization: "Bearer " + process.env.APICK_API_KEY },
  body: form,
  signal: AbortSignal.timeout(120_000),
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
const result = await response.json();
console.log(result);

```

### python

```python

import os
import requests
parts = [
    ("url", (None, "https://www.youtube.com/watch?v=dQw4w9WgXcQ")),
    ("format", (None, "mp3")),
    ("bitrate", (None, "320")),
]
response = requests.request("POST", "https://apick.app/rest/youtube_audio_download",
    headers={"Authorization": "Bearer " + os.environ["APICK_API_KEY"]},
    files=parts,
    timeout=(10, 120))
response.raise_for_status()
result = response.json()
print(result)

```

### php

```php

<?php
$headers = ["Authorization: Bearer " . getenv("APICK_API_KEY")];
$form = [
    'url' => 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
    'format' => 'mp3',
    'bitrate' => '320',
];
$curl = curl_init('https://apick.app/rest/youtube_audio_download');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_POSTFIELDS => $form,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_TIMEOUT => 120,
]);
$body = curl_exec($curl);
if ($body === false) { throw new RuntimeException(curl_error($curl)); }
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
if ($status >= 400) { throw new RuntimeException($body); }
$result = json_decode($body, true, 512, JSON_THROW_ON_ERROR);
print_r($result);

```

## 코드·오류

## 상세 기능·요금

Method URL POST https://apick.app/rest/youtube_audio_download 요금 항목 설명 기본요금 20P (후불 30P) 용량 요금 받은 파일 크기 10MB(10,485,760바이트)마다 2P (후불 3P), 10MB 단위로 올림 계산 예 5MB: 기본요금 + 2P100MB: 기본요금 + 20P1GB(1,024MB): 기본요금 + 206P 미리 확인 유튜브 다운로드 화질 조회(youtube_formats)로 화질별 예상 용량과 예상 요금을 볼 수 있습니다. 잔액 확인 받기 전에 예상 요금보다 포인트가 적으면 받지 않고 402로 응답합니다(과금 없음). 미과금 입력 오류, 영상 없음, 2GB 초과, 시간 초과 등으로 파일을 받지 못하면 과금하지 않습니다. API 호출 요청 요청하기 Key Value url format bitrate start end delivery 응답

## 상세 요청

Header 이름 필수 설명 Authorization O Bearer 인증키

## 상세 응답

Header (delivery=file) 이름 필수 설명 success O API 서버 정상 응답 여부 cost O 이번 호출 요금(기본요금 + 용량 요금) ms O API 응답 시간 size O 파일 크기(바이트) duration X 받은 길이(초). 구간을 지정하면 구간 길이 Content-Type O mp3: audio/mpegm4a: audio/mp4opus: audio/ogg Content-Disposition O 파일명 (영상ID.형식) Body (delivery=file) 이름 타입 설명 오디오 파일 데이터 Binary 요청한 형식의 파일 Body (delivery=link) 이름 타입 설명 data Object 조회 데이터 video_id String 11자리 영상 ID title String 영상 제목 duration Number 받은 길이(초) size Integer 파일 크기(바이트) size_units Integer 용량 요금 단위 수(10MB 단위 올림) content_type String 파일 형식 filename String 파일명 download_url String 다운로드 주소. 인증키 없이 받을 수 있고 이어받기(Range)를 지원합니다. expires_at String 다운로드 주소 만료 시각(ISO 8601, 발급 1시간 뒤) format String 파일 형식 (mp3·m4a·opus) bitrate Integer MP3 비트레이트(kbps). 그 밖의 형식은 null billing Object 요금 내역 base Integer 기본요금 size_unit_cost Integer 10MB당 요금 size_cost Integer 용량 요금 total Integer 합계(= api.cost) success Integer 과금 여부0: 실패1: 성공 api Object API 호출 공통 데이터 success Boolean API 서버 정상 응답 여부 cost Integer API 호출 요금 ms Integer API 응답 시간 pl_id Integer API 결제 로그 ID

## 상세 코드·정책

오류 HTTP 상태 코드 HTTP 상황 설명 400 입력 오류 영상 주소, format, bitrate, start·end, delivery 값을 확인하세요. 파일이 최대 2GB를 넘을 때도 400으로 응답합니다(낮은 화질이나 구간을 지정하세요). 402 포인트 부족 예상 요금 또는 실제 요금보다 사용 가능한 포인트가 적습니다. 과금하지 않습니다. 404 영상 없음 삭제·비공개 영상이거나 잘못된 주소입니다. 408 시간 초과 처리 시간이 초과됐습니다. 과금하지 않습니다. 424 받기 불가 연령 제한·회원 전용 영상, 진행 중이거나 예정된 라이브 방송, 요청이 몰린 경우 또는 일시적인 실패입니다. 과금하지 않습니다.

## 상세 예제

요청 예시 (파일로 받기) form-data 전체 예제 보기 요청 예시 (링크로 받기) form-data 전체 예제 보기 응답 예시 (delivery=link) { "data": { "video_id": "dQw4w9WgXcQ", "title": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)", "duration": 213, "size": 3449213, "size_units": 1, "content_type": "audio/mp4", "filename": "dQw4w9WgXcQ.m4a", "download_url": "https://apick.app/youtube-files/9a8b7c6d5e4f30211203f4e5d6c7b8a9/dQw4w9WgXcQ.m4a", "expires_at": "2026-10-06T10:35:12.000Z", "format": "m4a", "bitrate": null, "billing": { "base": 20, "size_unit_cost": 2, "size_cost": 2, "total": 22 }, "success": 1 }, "api": { "success": true, "cost": 22, "pl_id": 1595635, "ms": 3210 } }
