API Documentation
Complete reference for integrating Venis Virtual Try-On into your application.
Introduction
The Venis API provides powerful AI-driven virtual try-on capabilities. It allows you to realistically visualize garments on models by combining a person's image with a garment image.
Authentication
All API requests (except health checks) require an API key to be passed in the HTTP headers.
Header Format
Header Name: X-API-Key
Value: Your unique API key.
X-API-Key: venis_live_xyz123...Base URL
https://platformapi.venis.appEndpoints
Virtual Try-On
Method: POST
Endpoint: /v1/tryon
Processes a virtual try-on request. Takes a person image and a garment image, and returns the person wearing the garment.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| image1_base64 | string | Yes | Base64 encoded image of the person. |
| image2_base64 | string | Yes | Base64 encoded image of the garment. |
| category | string | Yes | Category of the garment (e.g., "dresses", "tops", "bottoms"). Helps optimize the AI processing. |
Response
{
"success": true,
"image_base64": "iVBORw0KGgoAAAANSUhEUgAA...",
"message": "Try-on completed successfully for tops",
"processing_time_seconds": 4.5,
"detected_category": "tops",
"tries_remaining": 95
}Python Example
import requests
import base64
API_KEY = "your_api_key_here"
URL = "https://platformapi.venis.app/v1/tryon"
def encode_image(image_path):
with open(image_path, "rb") as image_file:
return base64.b64encode(image_file.read()).decode('utf-8')
payload = {
"image1_base64": encode_image("model.jpg"),
"image2_base64": encode_image("dress.jpg"),
"category": "dresses"
}
headers = {
"X-API-Key": API_KEY,
"Content-Type": "application/json"
}
response = requests.post(URL, json=payload, headers=headers)
if response.status_code == 200:
data = response.json()
print("Success:", data["message"])
# Save the result
with open("result.png", "wb") as f:
f.write(base64.b64decode(data["image_base64"]))
else:
print("Error:", response.json())Get Usage
Method: GET
Endpoint: /v1/keys/usage
Retrieves current usage statistics, balance, and limits for the API Key.
Response
{
"user_id": "user_12345",
"balance": 500.0,
"tryon_limit": 1000,
"monthly_usage": 45,
"price_dealt": 1.5,
"total_requests": 150,
"successful_requests": 148,
"failed_requests": 2,
"is_active": true,
"created_at": "2024-01-01T12:00:00Z"
}Health Check
Method: GET
Endpoint: /health
Simple endpoint to check if the API is running.
Response
{
"status": "healthy",
"timestamp": "2024-02-09T12:00:00.000000",
"version": "1.0.0"
}Error Handling
The API uses standard HTTP status codes to indicate the success or failure of requests.
Status Codes
| Status Code | Meaning |
|---|---|
| 200 | OK - Request successful. |
| 400 | Bad Request - Invalid input (e.g., image too large, missing fields) / inappropriate request. |
| 401 | Unauthorized - Invalid or missing API Key. |
| 402 | Payment Required - Insufficient balance. |
| 403 | Forbidden - Access denied. |
| 429 | Too Many Requests - Rate limit exceeded. |
| 500 | Internal Server Error - Something went wrong on the server. |
Error Response Format
{
"success": false,
"error": "insufficient_balance",
"message": "You do not have enough credits to perform this action."
}