<aside> <img src="/icons/snippet_gray.svg" alt="/icons/snippet_gray.svg" width="40px" />
Table of Contents
</aside>
Overview
The /queue
endpoint allows users to upload an image, validate authorization, and enqueue the image for processing. The image is stored in Supabase storage, and the request is added to a queue for further processing.
Functionality
Usage Example
Request:
POST /queue
Authorization: Bearer <API_KEY>
Content-Type: multipart/form-data
--boundary
Content-Disposition: form-data; name="file"; filename="image.jpg"
Content-Type: image/jpeg
(binary image data)
--boundary
Content-Disposition: form-data; name="platform_id"
"12345"
--boundary
Content-Disposition: form-data; name="platform_url"
"<https://example.com>"
--boundary--
Response:
{
"success": true,
"message": "Image has been added to the queue."
}
HTTP Method
POST
Request
Headers
Bearer <API_KEY>
(Required)multipart/form-data
Form Data Parameters
Parameter | Type | Required | Description |
---|---|---|---|
file |
file |
Yes | The image file (PNG, JPG, JPEG). Max size 4MB. |
platform_id |
string |
Yes | The platform identifier. |
platform_url |
string |
Yes | The URL associated with the platform. |
Response
Success Response
Status Code: 200 OK
{
"success": true,
"message": "Image has been added to the queue."
}
Error Responses
Missing Authorization HeaderStatus Code: 401 Unauthorized
{
"error": "Missing Authorization header"
}
Missing Required FieldStatus Code: 400 Bad Request
{
"error": "Missing required field: <field_name>"
}
File Size ExceededStatus Code: 400 Bad Request
{
"error": "File size exceeds 4MB limit."
}
Invalid API KeyStatus Code: 401 Unauthorized
{
"error": "Invalid or missing license key"
}
Unsupported File TypeStatus Code: 400 Bad Request
{
"error": "Unsupported file type. Only PNG, JPG, and JPEG are allowed."
}
File Upload FailureStatus Code: 500 Internal Server Error
{
"error": "File upload failed."
}
Queue Processing FailureStatus Code: 500 Internal Server Error
{
"error": "Failed to enqueue image."
}
Overview
The /v1/queue/process
endpoint is responsible for processing image analysis tasks from a queue. It retrieves pending messages from the queue, analyzes the images using an AI service, stores the results, and deletes processed messages from the queue.
Functionality
images
queue.processed
.Error Handling
400
error with details.Usage Example
Request:
GET /v1/queue/process
Response:
{
"message": "Processing completed"
}
HTTP Method
GET
Request
Headers
application/json
Query Parameters
None.
Response
Success Response
Status Code: 200 OK
{
"message": "Processing completed"
}
Error Responses
Queue Fetch Error:Status Code: 400 Bad Request
{
"error": "Queue fetch error: <error details>"
}
Processing Error:Status Code: 400 Bad Request
{
"error": "Request error: <error details>"
}
<aside> <img src="/icons/thought-dialogue_gray.svg" alt="/icons/thought-dialogue_gray.svg" width="40px" />
</aside>