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.

http
X-API-Key: venis_live_xyz123...

Base URL

text
https://platformapi.venis.app

Endpoints

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

FieldTypeRequiredDescription
image1_base64stringYesBase64 encoded image of the person.
image2_base64stringYesBase64 encoded image of the garment.
categorystringYesCategory of the garment (e.g., "dresses", "tops", "bottoms"). Helps optimize the AI processing.

Response

json
{
  "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

python
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

json
{
  "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

json
{
  "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 CodeMeaning
200OK - Request successful.
400Bad Request - Invalid input (e.g., image too large, missing fields) / inappropriate request.
401Unauthorized - Invalid or missing API Key.
402Payment Required - Insufficient balance.
403Forbidden - Access denied.
429Too Many Requests - Rate limit exceeded.
500Internal Server Error - Something went wrong on the server.

Error Response Format

json
{
  "success": false,
  "error": "insufficient_balance",
  "message": "You do not have enough credits to perform this action."
}