Give Opsis an image in one of three ways: a public HTTPS link, a small file inside the request as a data: address (up to 1 MiB), or an upload. An upload is for a file too large to send inline.
Three calls
POST /v1/uploadswith the file's type and size. The answer is a ticket: anid, anupload_url, theupload_headersto send and anexpires_at. The ticket is valid for 20 minutes.- Send the file to
upload_urlwithPUT, with exactly theupload_headers. POST /v1/uploads/{id}/complete. Opsis checks the file and returns the upload with a reference of the formopsis://upl_….
Request
curl 'https://api.opsis.dramatis.ai/v1/uploads' \
|
-X POST \
|
-H "Authorization: Bearer $OPSIS_API_KEY" \
|
-H "Content-Type: application/json" \
|
-d '{
|
"content_type": "image/png",
|
"bytes": 482113
|
}' |
Request
curl 'https://api.opsis.dramatis.ai/v1/uploads/upl_01k3m8x9q2z4v7n5/complete' \
|
-X POST \
|
-H "Authorization: Bearer $OPSIS_API_KEY" |
Using an upload
Use the reference wherever a task takes an image, as often as you need, for 24 hours after completion. An upload belongs to the account that made it. DELETE /v1/uploads/{id} removes it and is never refused, even while a waiting task uses it. If the upload is gone or past its expires_at when the task is built, the task ends FAILED with invalid_asset, refunded.
Namespace
POST /v1/uploads takes an optional namespace, in the same format as a task's: 1 to 128 characters of letters, digits, ., _, = and -, starting with a letter or a digit. See Tasks. The upload returns it as namespace, or null when none was given.
A task may use an upload of its own namespace or an upload with no namespace. A task without a namespace may use only uploads with no namespace. Any other upload is refused when the task is created, as 400 invalid_request with param naming the field.
Limits
- JPEG, PNG or WebP, up to 10 MB. Here "MB" means 1024 × 1024 bytes, so the limit is 10 485 760 bytes.
- The account may hold 100 uploads at a time. A ticket that was not completed counts until it is swept. Beyond that,
POST /v1/uploadsanswers409 limit_reached. - An upload of the wrong type or size for the model is refused when the task is created, as
400 invalid_requestwithparamnaming the field. It is not a task that fails later.