Developer

API Reference

Version 2.0 • Last updated: January 2024

Authentication

All API requests require authentication using an API key. Include your API key in the request headers:

Authorization: Bearer YOUR_API_KEY

To obtain an API key, sign up for an account and visit the API Keys section in your dashboard.

Endpoints

Data Upload

POST /api/v2/data/upload

Upload raw data for processing. Supports CSV, JSON, Parquet, and custom formats up to 5GB per file.

Request Body:

{
  "file": "base64_encoded_file",
  "format": "csv|json|parquet",
  "metadata": {
    "name": "dataset_name",
    "description": "optional_description"
  }
}

Data Processing

POST /api/v2/process

Apply transformations, cleaning, and enrichment to your datasets.

Request Body:

{
  "dataset_id": "your_dataset_id",
  "operations": [
    {
      "type": "clean|transform|enrich",
      "params": {...}
    }
  ]
}

Model Training

POST /api/v2/models/train

Train custom models using your prepared datasets.

Request Body:

{
  "dataset_id": "your_dataset_id",
  "model_type": "classification|regression|llm",
  "config": {
    "epochs": 100,
    "batch_size": 32,
    "learning_rate": 0.001
  }
}

Inference

POST /api/v2/models/predict

Make predictions using your trained models.

Request Body:

{
  "model_id": "your_model_id",
  "input": {
    "data": [...] 
  },
  "options": {
    "temperature": 0.7,
    "max_tokens": 100
  }
}

Rate Limits

API rate limits vary by plan tier to ensure fair usage and system stability.

Tier Requests/Min Requests/Day
Free 10 1,000
Pro 100 50,000
Enterprise Custom Unlimited

Code Examples

Python

import requests

API_KEY = "your_api_key"
BASE_URL = "https://api.vectorial.dev/v2"

headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json"
}

# Upload data
response = requests.post(
    f"{BASE_URL}/data/upload",
    headers=headers,
    json={
        "file": "base64_encoded_data",
        "format": "csv",
        "metadata": {"name": "my_dataset"}
    }
)

dataset_id = response.json()["dataset_id"]

JavaScript

const API_KEY = 'your_api_key';
const BASE_URL = 'https://api.vectorial.dev/v2';

async function uploadData(fileData) {
  const response = await fetch(`${BASE_URL}/data/upload`, {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${API_KEY}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      file: fileData,
      format: 'csv',
      metadata: { name: 'my_dataset' }
    })
  });

  const { dataset_id } = await response.json();
  return dataset_id;
}

cURL

curl -X POST https://api.vectorial.dev/v2/data/upload \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "file": "base64_encoded_data",
    "format": "csv",
    "metadata": {
      "name": "my_dataset"
    }
  }'

Error Handling

The API uses standard HTTP response codes to indicate success or failure.

200 Success
400 Bad Request - Invalid parameters
401 Unauthorized - Invalid API key
429 Too Many Requests - Rate limit exceeded
500 Internal Server Error