Upload an image or video
Upload an image or video and receive a media ID that identifies the stored file.
Authorization
bearerAuth In all requests that require authentication, please add the following to the HTTP header:
In: header
The raw bytes of the file. This endpoint does not accept multipart/form-data.
Two headers are required:
Content-Type— the MIME type of the file, for exampleimage/pngorvideo/mp4. The server acceptsimage/*andvideo/*types only.Content-Length— the exact byte length of the body. The request fails when the body length is different from this value.
TypeScript Definitions
Use the request body type in TypeScript.
binaryResponse 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"
}Get media image by ID GET
Redirect with HTTP 302 to the image file of a media item, so a media ID can be used directly as an image URL.
Docs MCP server
Give Claude Code, Cursor, VS Code or any MCP client search and read access to this documentation through the docs MCP server at https://platform.pixai.art/docs-mcp. It serves the docs only; it does not generate images.