API Reference

Complete API documentation for Confidential AI Network integration and development

API Documentation

Authentication

All API requests require authentication using OAuth 2.0 with JWT tokens.

POST /auth/token

Exchange credentials for access token

Request Body:
{
  "grant_type": "password",
  "username": "your_username",
  "password": "your_password",
  "client_id": "your_client_id"
}
Response:
{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "refresh_token": "def50200..."
}

Contracts

Manage AI training contracts and agreements between parties.

GET /contracts

Retrieve list of contracts

Query Parameters:
?status=active&type=ai_training&limit=20&offset=0
POST /contracts

Create new contract

Request Body:
{
  "title": "Healthcare AI Training Contract",
  "description": "Training AI model on patient data",
  "parties": ["tdp_id", "tdc_id", "ccrp_id"],
  "datasets": ["dataset_id_1", "dataset_id_2"],
  "terms": {
    "duration_days": 365,
    "data_usage": "training_only",
    "privacy_level": "confidential"
  }
}

Datasets

Manage training datasets and their metadata.

GET /datasets

Retrieve available datasets

POST /datasets

Register new dataset

Request Body:
{
  "name": "Patient Health Records",
  "description": "Anonymized healthcare data",
  "data_type": "structured",
  "record_count": 1000000,
  "privacy_level": "confidential",
  "compliance": ["HIPAA", "GDPR"],
  "metadata": {
    "fields": ["age", "gender", "diagnosis"],
    "format": "CSV",
    "size_mb": 250
  }
}

AI Training

Manage AI model training sessions and monitor progress.

POST /training/sessions

Start new training session

Request Body:
{
  "contract_id": "contract_123",
  "model_type": "neural_network",
  "hyperparameters": {
    "learning_rate": 0.001,
    "epochs": 100,
    "batch_size": 32
  },
  "privacy_settings": {
    "differential_privacy": true,
    "epsilon": 1.0,
    "delta": 1e-5
  }
}

Error Codes

Common HTTP error codes and their meanings.

Code Error Description
400 Bad Request Invalid request parameters or body
401 Unauthorized Invalid or expired authentication token
403 Forbidden Insufficient permissions for the resource
404 Not Found Requested resource does not exist
429 Too Many Requests Rate limit exceeded
500 Internal Server Error Unexpected server error