API Reference

Complete API documentation for Onairos endpoints.

Updated 27 December 2024
apiendpointsrestreference

🌐 Base URL

Production https://api2.onairos.uk
Development http://localhost:8080

🔐 Authentication

All API requests require Bearer token authentication in the header:

Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json

Test User API

POST /inferenceTest

Test route to validate the format of Onairos user API requests before production.

📥 Request Body

ParameterTypeRequiredDescription
inputDataarrayArray of inference input objects
inputData[].textstringText content for inference
inputData[].categorystringCategory of the content
inputData[].img_urlstringOptional URL to an image
accessTokenstringJWT token for authentication
Request Example
{
  "inputData": [
    {
      "text": "I love hiking and outdoor adventures",
      "category": "interests",
      "img_url": "https://example.com/hiking.jpg"
    }
  ],
  "accessToken": "eyJhbGciOiJIUzI1NiIs..."
}
Response (200 OK)
{
  "InferenceResult": {
    "output": {
      "sentiment": [[0.9234]],
      "confidence": 0.95
    }
  }
}

Get API Access Token

POST /getAPIurl

Retrieve access token and approved requests for a user who just agreed to connect their data.

📥 Request Body

ParameterTypeRequiredDescription
Info.web3TypestringType of web3 auth (e.g., "Othent")
Info.confirmationsarrayArray of data confirmations
Info.DomainstringYour registered domain
Info.EncryptedUserPinstringOnairos encrypted PIN
Info.proofModebooleanEnable ZK proof mode
Info.accountstringUser account identifier
Request Example
{
  "Info": {
    "web3Type": "Othent",
    "confirmations": [
      { "data": "Traits", "date": "2024-12-27" }
    ],
    "Domain": "yourapp.com",
    "EncryptedUserPin": "encrypted_pin_here",
    "OthentSub": "sub_123456",
    "proofMode": false,
    "account": "user_account_id"
  }
}
Response (200 OK)
{
  "apiUrl": "https://api2.onairos.uk/inference/abc123",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6..."
}

User Mind Reading API

POST /inferenceNoProof

Generate user preferences, insights, and memories based on their authorized data. This is the main inference endpoint.

📥 Request Body

Same structure as Test User API - array of input objects with text, category, and optional image URL.

📤 Response Codes

200Successful inference - returns ML results
400Bad request - invalid input data format
401Unauthorized - invalid or expired token
413Payload too large - input exceeds size limit
500Server error - internal processing failed

User Traits API

POST /traits

Generate only user personality traits without full inference. Lighter weight endpoint for trait-only applications.

Request Example
{
  "inputData": [
    {
      "text": "User profile content...",
      "category": "profile"
    }
  ],
  "accessToken": "your_jwt_token"
}
Response (200 OK)
{
  "Traits": {
    "positive_traits": {
      "creativity": 9.7,
      "empathy": 9.6,
      "curiosity": 9.1
    },
    "traits_to_improve": {
      "patience": 3.2,
      "organization": 4.1
    }
  }
}

⚠️ Error Response Format

All API errors return a consistent JSON structure:

{
  "message": "Human-readable error description",
  "details": {
    "code": "ERROR_CODE",
    "field": "problematic_field",
    "suggestion": "How to fix the issue"
  }
}
Need Help?

Contact our developer support at support@onairos.uk or join our Discord community.