POST
/
file
/
upload
import { ComfyDeploy } from "comfydeploy";
import { openAsBlob } from "node:fs";

const comfyDeploy = new ComfyDeploy({
  bearer: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await comfyDeploy.file.upload({
    file: await openAsBlob("example.file"),
  });

  // Handle the result
  console.log(result);
}

run();
{
  "file_id": "img_1a2b3c4d5e6f7g8h",
  "file_name": "example_image.jpg",
  "file_url": "https://your-bucket.s3.your-region.amazonaws.com/inputs/img_1a2b3c4d5e6f7g8h.jpg",
  "message": "File uploaded successfully"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

multipart/form-data
file
file
required

Response

200
application/json
Successful Response
message
string
required

A message indicating the result of the file upload

file_id
string
required

The unique identifier for the uploaded file

file_name
string
required

The original name of the uploaded file

file_url
string
required

The URL where the uploaded file can be accessed