PixAI Platform
API ドキュメントメディア

画像・動画のアップロード

画像または動画をアップロードしてメディア ID を取得します。メディア ID は保存されたファイルを識別します。

POST
/media/upload

Authorization

bearerAuth
AuthorizationBearer <token>

認証が必要なすべてのリクエストでは、HTTP ヘッダーに次を追加してください:

In: header

ファイルのバイト列そのもの。このエンドポイントは multipart/form-data を受け付けません。

次の 2 つのヘッダーが必須です:

  • Content-Type — ファイルの MIME タイプ(例: image/pngvideo/mp4)。サーバーは image/*video/* のみを受け付けます。
  • Content-Length — ボディの正確なバイト長。実際のボディ長がこの値と異なる場合、リクエストは失敗します。

TypeScript Definitions

Use the request body type in TypeScript.

body*file
Formatbinary

Response Body

application/json

application/json

application/json

curl -X POST https://api.pixai.art/v1/media/upload \  -H "Authorization: Bearer $PIXAI_API_KEY" \  -H "Content-Type: image/png" \  --data-binary @reference.png
{
  "id": "string",
  "type": "IMAGE",
  "urls": [
    {
      "variant": "PUBLIC",
      "url": "string"
    }
  ],
  "width": 0,
  "height": 0,
  "imageType": "string",
  "fileUrl": "string",
  "duration": 0,
  "thumbnailUrl": "string",
  "hlsUrl": "string",
  "size": 0
}
{
  "code": 0,
  "message": "string"
}
{
  "code": 0,
  "message": "string"
}