Skip to Content
API reference

Create an upload

POST
/v1/uploads

Creates an upload slot and answers 201 with a signed upload_url. PUT the file there with every header in upload_headers within 15 minutes, then use asset_id as image, image_2 or image_3 in an edit. TensorFactory doesn't keep uploads: one is deleted when the run that uses it ends, or 30 minutes after it is made if no run uses it. Upload the file again for each edit.

Authorization

apiKey
headerAuthorizationBearer <tf_...>

Your API key from API keys, sent as Authorization: Bearer $TENSORFACTORY_API_KEY. Keep it on your server.

Request Body

application/json
  1. body
kind?"image"

Optional. Always image.

Value in"image"
mime*string

The file's type.

Value in"image/jpeg""image/png""image/webp"
bytes*integer

The file's size in bytes, up to 7 MiB.

Range1 <= value <= 7340032
filename?string

Optional.

Lengthlength <= 200

Response Body

The upload slot.

application/json
  1. response
asset_id*string

Send it as image, image_2, image_3 or mask.

Formatuuid
upload_url*string

Where to PUT the file. Signed. No key needed.

Formaturi
upload_headers*

Send each of these headers with the PUT.

expires_at*string

When upload_url stops working (15 minutes).

Formatdate-time
Example Request
curl -X POST 'https://tensorfactory.ai/v1/uploads' \  -H 'Content-Type: application/json' \  -d '{  "kind": "image",  "mime": "image/jpeg",  "bytes": 482113,  "filename": "photo.jpg"}'
Example Response
{  "asset_id": "6f1d2c3b-8a4e-4f0b-9d6a-1c2e3f4a5b6c",  "upload_url": "https://tensorfactory.ai/v1/uploads/6f1d2c3b-8a4e-4f0b-9d6a-1c2e3f4a5b6c/data?expires=1794046504&signature=...",  "upload_headers": {    "Content-Type": "image/jpeg"  },  "expires_at": "2026-11-07T10:15:04.000Z"}