画像をアップロード
POST /filesの認証、フィールド、応答、エラー、安全な運用をソースから生成した参考資料です。
このページの目次
操作
POST /files
operationId: create_file_v1_files_post
PNG、JPEG、WebPをmultipartのfileフィールドとしてアップロードし、再利用できる公開ファイルIDを取得します。サービスは実際の画像バイトと寸法を検証します。生成は始まりません。アップロードは冪等な有料作成とは異なるため、転送エラー後に無条件で再送しないでください。
認証と副作用
サーバー側のBearer APIキーを使います。必要な権限:animations:write
有料生成は始めません。ほかの状態変更は上記を確認してください。
パラメータ
パス、クエリ、操作固有のヘッダーパラメータはありません。
リクエスト本文 (multipart/form-data)
本文必須:true
| フィールド | 型 | 必須 | 既定値 | 制約 | 説明 |
|---|---|---|---|---|---|
file |
string |
はい | — | format: binary |
PNG, JPEG, or WebP image bytes; validated before returning a public file ID. |
入れ子の全スキーマ:Body_create_file_v1_files_post
応答
| HTTP | 本文 | 説明 |
|---|---|---|
201 |
FileResponse | Successful public response. Example values are illustrative. |
400 |
APIErrorEnvelope | Invalid input; correct the request before retrying. |
401 |
APIErrorEnvelope | Missing, expired, or revoked API key. |
403 |
APIErrorEnvelope | Account eligibility, account status, or key scope does not allow this operation. |
404 |
APIErrorEnvelope | Resource is unavailable, not owned, or its signature is invalid/expired. |
413 |
APIErrorEnvelope | Request or decoded image exceeds the configured limit. |
415 |
APIErrorEnvelope | Use supported image media types. |
422 |
APIErrorEnvelope | Decoded image dimensions exceed the allowed size. |
429 |
APIErrorEnvelope | Account-wide rate or queue limit; wait for Retry-After. |
500 |
APIErrorEnvelope | Internal failure; preserve the task/key and retry only when marked retryable. |
503 |
APIErrorEnvelope | Service/provider unavailable; retry only when error.retryable is true. |
応答ヘッダー
| HTTP | ヘッダー | 型 | 説明 |
|---|---|---|---|
429 |
Retry-After |
integer |
Suggested wait in seconds; respect the server value and an overall deadline. |
503 |
Retry-After |
integer |
Suggested wait in seconds; respect the server value and an overall deadline. |
応答例
{
"byte_size": 1024,
"created_at": "2026-08-30T00:00:00Z",
"height": 512,
"id": "00000000-0000-4000-8000-000000000001",
"mime_type": "image/png",
"object": "file",
"sha256": "0000000000000000000000000000000000000000000000000000000000000000",
"width": 512
}
関連ガイド
この記事は役に立ちましたか?
検索語句、コード、自由記述は収集しません。この設定はドキュメントの操作イベントのみを制御します。 プライバシーポリシー