Image Classification
Detect whether an image is a car, document, etc.
This page shows how to use the VehiCore Image Classification API to detect what’s in an image (e.g. car vs document) using AI.
You can send an image in two ways:
- Upload:
multipart/form-datawith fieldimage - URL: pass
?url=...(GET, or POST without upload)
Authentication is required via X-API-Key. To get a key, register and purchase at vehicore.pro/api-keys.
How it works: You send an image (file upload or ?url=...) and your X-API-Key. The service runs a classification model (CLIP or ViT) and returns the best-matching label plus scores.
Classify image (CLIP — zero-shot labels)
POST /api/image-classification/clip
CLIP runs zero-shot classification against a list of labels (default labels are: car, document, motorcycle, truck, person, other).
Request
Headers
| Field | Type | Required | Description |
|---|---|---|---|
X-API-Key | string | Yes | Your API key. |
Body (multipart/form-data)
| Field | Type | Required | Description |
|---|---|---|---|
image | file | Yes* | Image file (JPG, PNG, etc.). Required if no url query param provided. |
Query parameters
| Field | Type | Required | Description |
|---|---|---|---|
url | string (URL) | No | Image URL (use instead of file upload). |
labels | string | No | Comma-separated labels for CLIP (e.g. car,document,other). |
clipModel | string | No | Optional model override (advanced). |
Example request
curl -X POST "https://api.vehicore.pro/api/image-classification/clip?labels=car,document,motorcycle,truck,person,other" \
-H "X-API-Key: YOUR_API_KEY" \
-F "image=@/path/to/image.jpg"import fs from 'node:fs';
const formData = new FormData();
const buf = fs.readFileSync('/path/to/image.jpg');
formData.append('image', new Blob([buf], { type: 'image/jpeg' }), 'image.jpg');
const url = new URL('https://api.vehicore.pro/api/image-classification/clip');
url.searchParams.set('labels', 'car,document,motorcycle,truck,person,other');
const response = await fetch(url, {
method: 'POST',
headers: { 'X-API-Key': process.env.VEHICORE_API_KEY },
body: formData,
});
const data = await response.json();import os
import requests
url = "https://api.vehicore.pro/api/image-classification/clip"
headers = {"X-API-Key": os.environ["VEHICORE_API_KEY"]}
files = {"image": open("/path/to/image.jpg", "rb")}
params = {"labels": "car,document,motorcycle,truck,person,other"}
response = requests.post(url, headers=headers, files=files, params=params)
print(response.json())Response
On success the API returns:
{
"result": "car",
"confidence": 0.93,
"model": "clip",
"predictions": [
{ "label": "car", "score": 0.93 },
{ "label": "document", "score": 0.03 }
]
}See Swagger for the full schema.
Possible errors
All error responses use the shape { "message": "Human-readable text", "code": "OPTIONAL_CODE" }. See Error responses for details.
| Status | Code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR | Bad Request — missing image, invalid url, invalid input. |
| 401 | UNAUTHORIZED | Unauthorized — missing or invalid X-API-Key. |
| 402 | INSUFFICIENT_CREDITS | Payment Required — insufficient credits. Purchase more from Billing. |
| 500 | — | Internal Server Error — unexpected server error; retry later. |
Classify image (ViT — ImageNet)
POST /api/image-classification/vit
ViT runs ImageNet classification (fixed label space). VehiCore maps common vehicle/document-like outputs into its categories when possible.
Request
Same as CLIP, except labels is ignored.
Headers
| Field | Type | Required | Description |
|---|---|---|---|
X-API-Key | string | Yes | Your API key. |
Body (multipart/form-data)
| Field | Type | Required | Description |
|---|---|---|---|
image | file | Yes* | Image file. Required if no url query param provided. |
Query parameters
| Field | Type | Required | Description |
|---|---|---|---|
url | string (URL) | No | Image URL (use instead of file upload). |
vitModel | string | No | Optional model override (advanced). |
Example request
curl -X POST "https://api.vehicore.pro/api/image-classification/vit" \
-H "X-API-Key: YOUR_API_KEY" \
-F "image=@/path/to/image.jpg"URL mode (GET)
You can also call the API using GET with a URL:
GET /api/image-classification/clip?url=...&labels=...GET /api/image-classification/vit?url=...
Example:
curl -H "X-API-Key: YOUR_API_KEY" \
"https://api.vehicore.pro/api/image-classification/clip?url=https://example.com/image.jpg&labels=car,document,other"