Techsolut API Documentation

Our RESTful API allows you to integrate Techsolut's advanced computer vision capabilities directly into your applications.

v2.5.0 Last updated: April 15, 2025

Explore API

Authentication

The Techsolut API uses API keys to authenticate requests. You can view and manage your API keys in your Techsolut dashboard.

Authentication Header

Pass your API key in the Authorization header of all API requests:

HTTP
Authorization: Bearer YOUR_API_KEY

Important: Keep your API key confidential and never share it publicly. Do not embed it directly in client-side code.

Base URL

All URLs referenced in this documentation have the following base URL:

https://api.techsolut.fr/v1

Rate Limits

To ensure service availability for all users, the Techsolut API enforces rate limits. The limits vary based on your subscription plan.

Rate Limit Headers

Each API response includes headers that indicate your current rate limit status:

Header Description
X-RateLimit-Limit The maximum number of requests you can make per minute.
X-RateLimit-Remaining The number of requests remaining in the current time window.
X-RateLimit-Reset The time in seconds until the current time window resets.

Error Handling

The Techsolut API uses standard HTTP status codes to indicate the success or failure of an API request. Error codes are accompanied by descriptive error messages to help you understand and resolve the issue.

Error Format
JSON
{
  "error": {
    "code": "invalid_request",
    "message": "The request was malformed. Check the 'details' field for more information.",
    "details": "The parameter 'confidence' must be a float between 0 and 1.",
    "status": 400,
    "request_id": "req_7PtGLOvd9YHhe0"
  }
}
Common Error Codes
HTTP Code Error Code Description
400 invalid_request The request is malformed or contains invalid parameters.
401 unauthorized Invalid or missing authentication.
403 forbidden You are not allowed to access this resource.
404 not_found The requested resource does not exist.
429 rate_limit_exceeded You have exceeded your rate limit.
500 internal_error An internal error occurred on the server.

Object Detection

Detect objects in images with bounding boxes, classes, and confidence scores.

POST /detect

Detects objects in an image and returns their positions, classes, and confidence scores.

Request Parameters
JSON
{
  "image": "data:image/jpeg;base64,/9j/4AAQSkZ...",
  "confidence": 0.5,
  "model": "yolov8x",
  "classes": ["person", "car"],
  "max_detections": 20
}
Form Data
Content-Type: multipart/form-data
...
file: [binary image data]
confidence: 0.5
model: yolov8x
classes: person,car
max_detections: 20
Parameter Type Description
image string Base64-encoded image (JSON request) or binary file (form-data).
confidence float Minimum confidence threshold (0.0-1.0). Default: 0.25
model string Model to use for detection. Default: "yolov8x"
classes array Filter results by class. Optional
max_detections integer Maximum number of objects to detect. Default: 100
Response
JSON 200 OK
{
  "success": true,
  "detections": [
    {
      "class": "person",
      "confidence": 0.92,
      "box": {
        "x1": 23.5,
        "y1": 74.2,
        "x2": 483.1,
        "y2": 352.7
      }
    },
    {
      "class": "car",
      "confidence": 0.87,
      "box": {
        "x1": 532.3,
        "y1": 152.0,
        "x2": 789.6,
        "y2": 245.1
      }
    }
  ],
  "processing_time": 0.234,
  "model": "yolov8x"
}
Implementation Examples
curl
curl -X POST https://api.techsolut.fr/v1/detect \
     -H "Authorization: Bearer YOUR_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{
       "image": "data:image/jpeg;base64,/9j/4AAQSkZ...",
       "confidence": 0.5,
       "model": "yolov8x"
     }'
Python
import requests
import base64
from PIL import Image
import io

# Charger et encoder l'image en base64
def encode_image(image_path):
    with open(image_path, "rb") as image_file:
        return base64.b64encode(image_file.read()).decode('utf-8')

# Configuration
api_key = "YOUR_API_KEY"
api_endpoint = "https://api.techsolut.fr/v1/detect"
image_path = "path/to/your/image.jpg"

# Préparer les données
image_base64 = encode_image(image_path)
data = {
    "image": f"data:image/jpeg;base64,{image_base64}",
    "confidence": 0.5,
    "model": "yolov8x"
}

# Envoyer la requête
headers = {
    "Authorization": f"Bearer {api_key}",
    "Content-Type": "application/json"
}

response = requests.post(api_endpoint, json=data, headers=headers)

# Traiter la réponse
if response.status_code == 200:
    detections = response.json()
    print(f"Detected {len(detections['detections'])} objects:")
    for detection in detections['detections']:
        print(f"- {detection['class']}: {detection['confidence']:.2f}")
else:
    print(f"Error: {response.status_code}")
    print(response.text)
JavaScript
// Fonction pour encoder une image en base64
function encodeImageFileAsURL(file) {
  return new Promise((resolve, reject) => {
    const reader = new FileReader();
    reader.onloadend = () => resolve(reader.result);
    reader.onerror = reject;
    reader.readAsDataURL(file);
  });
}

// Fonction principale pour détecter des objets
async function detectObjects(imageFile) {
  const apiKey = 'YOUR_API_KEY';
  const apiEndpoint = 'https://api.techsolut.fr/v1/detect';
  
  try {
    // Encoder l'image en base64
    const imageBase64 = await encodeImageFileAsURL(imageFile);
    
    // Préparer les données
    const data = {
      image: imageBase64,
      confidence: 0.5,
      model: "yolov8x"
    };
    
    // Envoyer la requête
    const response = await fetch(apiEndpoint, {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${apiKey}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify(data)
    });
    
    // Traiter la réponse
    if (response.ok) {
      const result = await response.json();
      console.log(`Detected ${result.detections.length} objects`);
      
      // Traiter chaque détection
      result.detections.forEach(detection => {
        console.log(`${detection.class}: ${detection.confidence.toFixed(2)}`);
      });
      
      return result;
    } else {
      throw new Error(`HTTP error! status: ${response.status}`);
    }
  } catch (error) {
    console.error('Error:', error);
    throw error;
  }
}

// Utilisation avec un input file
const fileInput = document.getElementById('imageInput');
fileInput.addEventListener('change', async (e) => {
  const file = e.target.files[0];
  if (file) {
    try {
      const result = await detectObjects(file);
      // Afficher les résultats
      displayResults(result);
    } catch (error) {
      console.error('Detection failed:', error);
    }
  }
});
PHP
<?php
// Configuration
$apiKey = 'YOUR_API_KEY';
$apiEndpoint = 'https://api.techsolut.fr/v1/detect';
$imagePath = 'path/to/your/image.jpg';

// Charger et encoder l'image
$imageData = file_get_contents($imagePath);
$base64Image = 'data:image/jpeg;base64,' . base64_encode($imageData);

// Préparer les données
$data = [
    'image' => $base64Image,
    'confidence' => 0.5,
    'model' => 'yolov8x'
];

// Initialiser cURL
$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_URL => $apiEndpoint,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => json_encode($data),
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . $apiKey,
        'Content-Type: application/json'
    ]
]);

// Exécuter la requête
$response = curl_exec($curl);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);

// Traiter la réponse
if ($httpCode === 200) {
    $result = json_decode($response, true);
    echo "Objets détectés: " . count($result['detections']) . "\n";
    
    foreach ($result['detections'] as $detection) {
        echo "- " . $detection['class'] . ": " . 
             number_format($detection['confidence'], 2) . "\n";
    }
} else {
    echo "Erreur HTTP: " . $httpCode . "\n";
    echo $response . "\n";
}
?>
POST /detect/async

Asynchronous version of the detect endpoint, useful for large images or when many images need to be processed.

This endpoint accepts the same parameters as /detect but immediately returns a task ID. You then need to use the /tasks/{task_id} endpoint to check the status and retrieve results.

Response
JSON 202 Accepted
{
  "task_id": "task_fRsj4iLk8Z",
  "status": "processing",
  "estimated_time": 5,
  "task_url": "https://api.techsolut.fr/v1/tasks/task_fRsj4iLk8Z"
}

Image Classification

Classify images by assigning labels and confidence scores.

POST /classify

Classifies an image and returns the most relevant labels with their confidence scores.

Request Parameters
Parameter Type Description
image string Base64-encoded image (JSON request) or binary file (form-data).
top_k integer Number of top categories to return. Default: 5
model string Model to use for classification. Default: "resnet101"
Response
JSON 200 OK
{
  "success": true,
  "classifications": [
    {
      "label": "golden retriever",
      "confidence": 0.92
    },
    {
      "label": "labrador retriever",
      "confidence": 0.07
    },
    {
      "label": "dog",
      "confidence": 0.01
    }
  ],
  "processing_time": 0.156,
  "model": "resnet101"
}

Text Recognition (OCR)

Extract and recognize text from images.

POST /ocr

Extracts text from an image and returns the detected content with the position of each text element.

Request Parameters
Parameter Type Description
image string Base64-encoded image (JSON request) or binary file (form-data).
language string Primary language of the text (ISO 639-1 code). Default: "auto"
detailed boolean If true, returns detailed information about each text element. Default: false
Response
JSON 200 OK
{
  "success": true,
  "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
  "elements": [
    {
      "text": "Lorem ipsum",
      "confidence": 0.98,
      "box": {
        "x1": 10,
        "y1": 20,
        "x2": 100,
        "y2": 40
      }
    },
    {
      "text": "dolor sit amet,",
      "confidence": 0.95,
      "box": {
        "x1": 110,
        "y1": 20,
        "x2": 250,
        "y2": 40
      }
    },
    {
      "text": "consectetur adipiscing elit.",
      "confidence": 0.92,
      "box": {
        "x1": 10,
        "y1": 50,
        "x2": 200,
        "y2": 70
      }
    }
  ],
  "language": "la",
  "processing_time": 0.221
}

Model Management

Create, train, and manage your own computer vision models.

GET /models

Lists all your available models, including both predefined and custom models.

Request Parameters
Parameter Type Description
type string Filter by model type: "detection", "classification", "ocr", or "segmentation". Optional
custom_only boolean If true, returns only your custom models. Default: false
limit integer Maximum number of models to return. Default: 50
offset integer Number of models to skip (for pagination). Default: 0
Response
JSON 200 OK
{
  "models": [
    {
      "id": "yolov8x",
      "name": "YOLOv8X",
      "type": "detection",
      "description": "State-of-the-art object detection model",
      "custom": false,
      "version": "1.0.0",
      "last_updated": "2024-01-15T12:00:00Z",
      "status": "active"
    },
    {
      "id": "mod_custom_retail",
      "name": "Retail Product Detector",
      "type": "detection",
      "description": "Custom model for retail product detection",
      "custom": true,
      "version": "2.3.0",
      "created_at": "2024-03-10T09:23:15Z",
      "last_updated": "2024-04-05T14:18:32Z",
      "status": "active",
      "metrics": {
        "map": 0.892,
        "precision": 0.917,
        "recall": 0.885
      }
    }
  ],
  "total": 12,
  "limit": 50,
  "offset": 0
}
POST /models

Creates a new custom model that can be trained on your own data.

Example Request
curl
curl -X POST https://api.techsolut.fr/v1/models \
     -H "Authorization: Bearer YOUR_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{
       "name": "Custom Product Detector",
       "type": "detection",
       "description": "Detects specific retail products in store shelves",
       "base_model": "yolov8n",
       "classes": ["soda_can", "cereal_box", "snack_bag", "water_bottle"]
     }'

Dataset Management

Create and manage datasets for training your custom models.

GET /datasets

Lists all your available datasets.

POST /datasets

Creates a new empty dataset.

POST /datasets/{dataset_id}/images

Adds images to an existing dataset.

Assistant IA Techsolut
Historique des conversations

Vous n'avez pas encore de conversations enregistrées.

Analyser une image

Glissez-déposez une image ici
ou cliquez pour choisir un fichier