Create Image Upload
Stage a photo that is on the agent's disk, before attaching it to a task or record. Send filename, content_type and byte_size (and an optional checksum, standard base64 of the raw MD5 or SHA-256 of the file). The response data object carries upload_id, a one-time upload_url on this API host, method (PUT), headers, expires_at (about 30 minutes), max_bytes (20 MB) and curl_example.
Run curl_example from the shell, in the directory that contains the file. The URL authenticates itself: no bearer token. The PUT returns { upload_id, status: "uploaded", content_type, byte_size }. HEIC and HEIF are stored as JPEG, EXIF orientation is applied, the capture time is kept and GPS is removed.
Then pass upload_id as image_upload_ids on the create or update. Never base64-encode a local photo into a tool call. A public http(s) URL uses image_urls instead. image_base64s is only for a tiny generated image under about 100 KB decoded.
One upload can be attached to several records (up to 20) until it expires, 24 hours after it was staged. This call does not write farm data and does not need confirm. The call that attaches the photo still does. An Idempotency-Key header makes a retry of this call return the same upload.
Request
- Base URL: https://api.purplegrain.com/api/v1
- URL: https://api.purplegrain.com/api/v1/image-uploads
- Auth: HTTP bearer
Headers
Optional. Send the same value when retrying a create after a 502 or 504. The same user, path and key returns the original result instead of writing a second one. The key is kept for 24 hours.
Request body
Example request
{
"data": {
"filename": "IMG_0079.heic",
"content_type": "image/heic"
}
}Response
The staged upload. Run data.curl_example, then pass data.upload_id.
Example response
{
"data": {
"type": "image-upload"
}
}Changes
No recorded changes to this operation across all 1 revision of this API.