POST /api/process
Process an image with AI using a selected outfit option. The endpoint accepts an image file and an outfit option, processes the image asynchronously, and returns URLs for accessing the result.
Endpoint
POST /api/processRequest
Content-Type
multipart/form-dataParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
image | File | Yes | The image file to be processed. Supported formats: JPEG, PNG, etc. |
outfit | String | Yes | The outfit in format X.Y (e.g., "9.1", "9.2", "9.3", etc.) |
Example Request
curl -X POST https://o2o.digicon.pro/api/process \ -F "image=@/path/to/image.jpg" \ -F "outfit=9.1"
// JavaScript/TypeScript (FormData)
const formData = new FormData();
formData.append('image', imageFile);
formData.append('outfit', '9.1');
const response = await fetch('/api/process', {
method: 'POST',
body: formData
});
const data = await response.json();
console.log(data);Response
Success Response (200 OK)
Content-Type: application/json{
"success": true,
"request_id": "550e8400-e29b-41d4-a716-446655440000",
"redirectUrl": "https://o2o.digicon.pro/result/550e8400-e29b-41d4-a716-446655440000",
"downloadUrl": "https://o2o.digicon.pro/processed/550e8400-e29b-41d4-a716-446655440000.png"
}Response Fields
| Field | Type | Description |
|---|---|---|
success | Boolean | Indicates if the request was successful |
request_id | String (UUID) | Unique identifier for this processing request |
redirectUrl | String (URL) | URL to the result page where users can view the processed image and complete a survey. This URL is used to generate QR codes for users to scan. |
downloadUrl | String (URL) | Direct URL to download or display the processed image. The image is available at this URL as soon as processing completes, without requiring survey completion. You can use this URL to display the image immediately when it's ready. |
Error Responses
400 Bad Request
{
"error": "Missing image or outfit"
}500 Internal Server Error
{
"error": "Internal Server Error"
}Important Notes
- Asynchronous Processing: The API returns immediately with both
redirectUrlanddownloadUrl. Image processing happens in the background. The processed image will be available at thedownloadUrlas soon as processing completes, without requiring survey completion. - Outfit Options: Valid outfit options follow the format
X.Y(e.g., "9.1", "9.2", "9.3"). The available options correspond to the outfit images 9.1 to 9.8 available in the system. - Image Formats: The API accepts common image formats (JPEG, PNG, etc.). The processed image will be returned as PNG.
- Request ID: Use the
request_idto track your request. The processed image filename will be{request_id}.png. - Redirect URL vs Download URL:
redirectUrl: Points to the survey/result page. Use this URL to generate QR codes that users can scan to access the survey and view their processed image.downloadUrl: Direct URL to the processed image file. The image is available at this URL immediately when processing completes, independent of survey completion. You can use this URL to display or download the image programmatically.
💡 Tip:
For QR Code Generation: Use the redirectUrl to generate QR codes that users can scan to access the survey page. For Image Display: Use the downloadUrlto display the processed image immediately when it's ready, without waiting for survey completion. You can poll the downloadUrl to check when the image becomes available.