開発者API

あらゆるファイルワークフローに対応する1つの共通API

Converter App は、開発者向けの高性能なファイル処理インターフェースを提供します。個別のツールを単一の API に置き換え、拡張性の高い文書変換、メディア処理、文字起こし、OCR を実現します。

Converter App APIの概要

Converter App API は、開発者にあらゆるファイル処理ニーズに対応する、スムーズで универсальные なインターフェースを提供します。分断された個別ツール群を個別に統合する代わりに、アプリケーションは高性能な単一サービスを呼び出せます。標準的なファイル変換から負荷の高いメディア処理まで、当社の完全な変換スイートをバックエンドのワークフローに直接統合できます。

公開ベースURLは https://api.converter.app/ です。このドキュメント内のパスは、この外部公開APIルートを使用します。

幅広い対応範囲

1つの効率的な統合で、変換ツールの完全なライブラリにアクセスできます。

2つの処理モード

即時の応答には同期リクエストを、サイズの大きいファイルや長時間かかる処理には非同期ジョブを選択してください。

お客様のニーズに合わせて最適化

お問い合わせいただければ、お客様のニーズに合わせた最適なプランを、他に負けない料金でご提案いたします。

ドキュメント 画像 音声 動画 テキスト アーカイブ

対応している変換を確認する(キーは不要)

公開pairsエンドポイントを、最も簡単な接続テストとしてご利用ください。APIキーは不要で、プラットフォームで利用可能な対応変換ペアの全一覧を返します。

取得 /public/pairs

このエンドポイントは公開されているため、開発者はAPIキーをリクエストまたは設定する前に、汎用変換カタログを確認できます。

curl "https://api.converter.app/public/pairs"

JavaScript

const response = await fetch('https://api.converter.app/public/pairs');
const pairs = await response.json();
console.log(pairs.supported_pairs);

Python

import requests

response = requests.get('https://api.converter.app/public/pairs')
response.raise_for_status()
pairs = response.json()
print(pairs['supported_pairs'])

例の回答

{
  "supported_pairs": [
    { "from": "mp3", "to": "text" },
    { "from": "mp4", "to": "mp3" },
    { "from": "mov", "to": "mp4" },
    { "from": "wav", "to": "mp3" },
    { "from": "mkv", "to": "mp4" }
  ]
}

認証とアクセス制御

開発者は、HTTPヘッダー X API Key に API キーを渡して認証します。公開 /public/pairs エンドポイントは、このページ内でキーを必要としない唯一のエンドポイントです。

制御仕組み 開発者向けの影響
X-API-KeyキーをHTTPリクエストヘッダーとして送信します。/pairs/convert/sync/convert/progress/{jobid}、および/download/{jobid}に必要です。
利用上限各キーには数値の変換上限があります。変換タスクが作成されると、上限が減少します。-1 のクォータでは変換回数が無制限になります。その他の値は、残りの変換可能回数を表します。
許可された組み合わせキーは、mp42mp3 のような特定の変換タイプに制限することも、all の対応済みペアすべてへのアクセスを許可することもできます。/pairs は、お使いのキーで使用が許可されているペアのみを返し、その一覧に含まれない変換リクエストは拒否されます。
curl "https://api.converter.app/pairs" \
  -H "X-API-Key: YOUR_API_KEY"

JavaScript

const response = await fetch('https://api.converter.app/pairs', {
  headers: {
    'X-API-Key': apiKey
  }
});

const pairs = await response.json();
console.log(pairs);

Python

import requests

headers = {'X-API-Key': 'YOUR_API_KEY'}
response = requests.get('https://api.converter.app/pairs', headers=headers)
response.raise_for_status()
print(response.json())

2. 同期変換

POST /convert/sync

同じHTTPレスポンス内で即時の結果が必要な場合は、同期変換をご利用ください。APIが変換ジョブを開始して完了を待機している間、リクエストは開いたままで、最長30分まで継続します。

フォームフィールド種類説明
target_format文字列pdfdocxmp3jpg などの、指定された出力拡張子。
filesfile[]アップロードされた1つ以上のソースファイルです。API は、アップロードされたファイル名からソース形式を判定します。
curl -X POST "https://api.converter.app/convert/sync" \
  -H "X-API-Key: YOUR_API_KEY" \
  -F "target_format=pdf" \
  -F "files=@/path/to/document.docx" \
  -o converted.pdf

JavaScript

const form = new FormData();
form.append('target_format', 'pdf');
form.append('files', fileInput.files[0]);

const response = await fetch('https://api.converter.app/convert/sync', {
  method: 'POST',
  headers: {
    'X-API-Key': apiKey
  },
  body: form
});

const convertedFile = await response.blob();

Python

import requests

headers = {'X-API-Key': 'YOUR_API_KEY'}
data = {'target_format': 'pdf'}

with open('/path/to/document.docx', 'rb') as document:
    files = {'files': document}
    response = requests.post(
        'https://api.converter.app/convert/sync',
        headers=headers,
        data=data,
        files=files
    )

response.raise_for_status()
with open('converted.pdf', 'wb') as output:
    output.write(response.content)

レスポンスは変換されたファイルを直接ストリーミングします。変換によって複数のファイルが生成される場合、API は .zip アーカイブを返します。

3. 非同期変換

POST /convert

大容量ファイル、バッチ処理、長時間実行される音声・動画タスク、または処理中にアップロードリクエストを開いたままにしない本番アプリケーションには、非同期変換を使用してください。

フォームフィールド種類説明
target_format文字列希望する出力形式です。ソースとターゲットが変換ペアを構成します。たとえば mp42mp3 です。
filesfile[]変換する1つ以上のファイル。

cURL

curl -X POST "https://api.converter.app/convert" \
  -H "X-API-Key: YOUR_API_KEY" \
  -F "target_format=mp3" \
  -F "files=@/path/to/video.mp4"

JavaScript

const form = new FormData();
form.append('target_format', 'mp3');
form.append('files', fileInput.files[0]);

const response = await fetch('https://api.converter.app/convert', {
  method: 'POST',
  headers: {
    'X-API-Key': apiKey
  },
  body: form
});

const job = await response.json();
console.log(job.jobid, job.remaining_quota);

Python

import requests

headers = {'X-API-Key': 'YOUR_API_KEY'}
data = {'target_format': 'mp3'}

with open('/path/to/video.mp4', 'rb') as video:
    files = {'files': video}
    response = requests.post(
        'https://api.converter.app/convert',
        headers=headers,
        data=data,
        files=files
    )

response.raise_for_status()
job = response.json()
print(job['jobid'], job['remaining_quota'])

成功レスポンス

{
  "status": "success",
  "jobid": "b3f6b2e8f5c34c4ab01c93c4d1b2f9e8",
  "pair": "mp42mp3",
  "remaining_quota": 42
}

4. ステータストラッキング

取得する /progress/{jobid}

非同期ジョブを作成した後、このエンドポイントをポーリングしてください。ジョブのステータス、0.0 から 1.0 までの数値による進捗値、および変換に失敗した場合のエラー詳細が返されます。

ヘッダー説明
X-API-Key開発者用APIキー。
curl "https://api.converter.app/progress/b3f6b2e8f5c34c4ab01c93c4d1b2f9e8" \
  -H "X-API-Key: YOUR_API_KEY"

JavaScript

const response = await fetch('https://api.converter.app/progress/b3f6b2e8f5c34c4ab01c93c4d1b2f9e8', {
  headers: {
    'X-API-Key': apiKey
  }
});

const progress = await response.json();
console.log(progress.status, progress.progress);

Python

import requests

headers = {'X-API-Key': 'YOUR_API_KEY'}
response = requests.get(
    'https://api.converter.app/progress/b3f6b2e8f5c34c4ab01c93c4d1b2f9e8',
    headers=headers
)
response.raise_for_status()
progress = response.json()
print(progress['status'], progress['progress'])
{
  "jobid": "b3f6b2e8f5c34c4ab01c93c4d1b2f9e8",
  "progress": 1.0,
  "status": "completed",
  "error": null
}

可能なステータスは processingcompletedfailed です。進捗は 0.0 から 1.0 の間の数値です。

5. ファイル取得

取得 /download/{jobid}

非同期ジョブが completed に達したら、ジョブの作成に使用したのと同じAPIキーで変換済みの出力を取得してください。

結果タイプ動作
出力ファイルは1つだけAPI は変換されたファイルを直接ストリーミングします。
resultfile マニフェストジョブが結果マニフェストを提供する場合、APIはそのマニフェストで指定されたファイルを返します。
複数の出力ファイルAPIは、生成されたファイルをその場で .zip アーカイブにまとめます。
curl -L "https://api.converter.app/download/b3f6b2e8f5c34c4ab01c93c4d1b2f9e8" \
  -H "X-API-Key: YOUR_API_KEY" \
  -o converted-output.zip

JavaScript

const response = await fetch('https://api.converter.app/download/b3f6b2e8f5c34c4ab01c93c4d1b2f9e8', {
  headers: {
    'X-API-Key': apiKey
  }
});

const file = await response.blob();

Python

import requests

headers = {'X-API-Key': 'YOUR_API_KEY'}
response = requests.get(
    'https://api.converter.app/download/b3f6b2e8f5c34c4ab01c93c4d1b2f9e8',
    headers=headers
)
response.raise_for_status()

with open('converted-output.zip', 'wb') as output:
    output.write(response.content)

開発者ワークフローの概要

API は、2 つの統合パターンをサポートしており、開発者は各ユースケースに最適な動作を選択できます。

フローリクエストパターン最適な用途
クイック同期フローPOST /convert/sync は、変換されたファイルを同じレスポンスで返します。小さなファイル、コマンドラインスクリプト、プロトタイプ、およびシンプルなサーバーサイド自動化。
堅牢な非同期フローPOST /convert、次に GET /progress/{jobid} をポーリングし、最後に GET /download/{jobid} を呼び出します。大容量の動画・音声ファイル、バッチ変換、Webアプリケーションのバックエンド、そして再試行に適した本番システム。

非同期フローの例

# 1. Start the job
curl -X POST "https://api.converter.app/convert" \
  -H "X-API-Key: YOUR_API_KEY" \
  -F "target_format=mp3" \
  -F "files=@/path/to/video.mp4"

# 2. Poll until completed
curl "https://api.converter.app/progress/JOBID" \
  -H "X-API-Key: YOUR_API_KEY"

# 3. Download the finished output
curl -L "https://api.converter.app/download/JOBID" \
  -H "X-API-Key: YOUR_API_KEY" \
  -o result.mp3

JavaScript

const form = new FormData();
form.append('target_format', 'mp3');
form.append('files', fileInput.files[0]);

const createResponse = await fetch('https://api.converter.app/convert', {
  method: 'POST',
  headers: {
    'X-API-Key': apiKey
  },
  body: form
});
const job = await createResponse.json();

const progressResponse = await fetch(`https://api.converter.app/progress/${job.jobid}`, {
  headers: {
    'X-API-Key': apiKey
  }
});
const progress = await progressResponse.json();

if (progress.status === 'completed') {
  const downloadResponse = await fetch(`https://api.converter.app/download/${job.jobid}`, {
    headers: {
      'X-API-Key': apiKey
    }
  });
  const result = await downloadResponse.blob();
}

Python

import requests

headers = {'X-API-Key': 'YOUR_API_KEY'}
data = {'target_format': 'mp3'}

with open('/path/to/video.mp4', 'rb') as video:
    files = {'files': video}
    create_response = requests.post(
        'https://api.converter.app/convert',
        headers=headers,
        data=data,
        files=files
    )

create_response.raise_for_status()
job = create_response.json()

progress_response = requests.get(
    f"https://api.converter.app/progress/{job['jobid']}",
    headers=headers
)
progress_response.raise_for_status()
progress = progress_response.json()

if progress['status'] == 'completed':
    download_response = requests.get(
        f"https://api.converter.app/download/{job['jobid']}",
        headers=headers
    )
    download_response.raise_for_status()
    with open('result.mp3', 'wb') as output:
        output.write(download_response.content)

エラーレスポンス

エラーは、標準のHTTPステータスコードを使用し、detailフィールドを含むJSONとして返されます。

ステータスよくある原因
400ファイルが見つからない、target_format が見つからない、サポートされていないジョブ ID 形式、または無効なリクエスト入力。
401X API Key が指定されていないか、無効です。
403APIキーは、要求された変換ペアの使用が許可されていません。
404要求されたジョブまたは生成された結果ファイルは利用できません。
409ダウンロードが要求された時点で、変換はまだ処理中です。
429APIキーの残りの利用枠がありません。
500サーバー側の処理エラーのため、変換を準備または完了できませんでした。
{
  "detail": "This API key is not authorized for mp42mp3 conversions."
}