# API Reference

## Test user API

> Test route to test format of Onairos user API

```json
{"openapi":"3.0.3","info":{"title":"Onairos Backend API","version":"1.0.0"},"servers":[{"url":"https://api2.onairos.uk","description":"Production server"},{"url":"http://localhost:8080","description":"Development server"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"InferenceInput":{"type":"object","required":["inputData","accessToken"],"properties":{"inputData":{"type":"array","items":{"type":"object","required":["text","category"],"properties":{"text":{"type":"string","description":"Text content for inference"},"category":{"type":"string","description":"Category of the content"},"img_url":{"type":"string","description":"Optional URL to an image"}}}},"accessToken":{"type":"string","description":"JWT token for authentication"}}},"InferenceResponse":{"type":"object","properties":{"InferenceResult":{"type":"object","properties":{"output":{"type":"object","description":"ML inference results"}}}}},"Error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"},"details":{"type":"object","description":"Detailed error information"}}}}},"paths":{"/inferenceTest":{"post":{"summary":"Test user API","description":"Test route to test format of Onairos user API","tags":["User","Development"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceInput"}}}},"responses":{"200":{"description":"Successful test inference","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Get API access token

> Retrieve access token and approved requests for user who just agreed to connect data

```json
{"openapi":"3.0.3","info":{"title":"Onairos Backend API","version":"1.0.0"},"servers":[{"url":"https://api2.onairos.uk","description":"Production server"},{"url":"http://localhost:8080","description":"Development server"}],"paths":{"/getAPIurl":{"post":{"summary":"Get API access token","description":"Retrieve access token and approved requests for user who just agreed to connect data","tags":["Authentication"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetAPIUrlInput"}}}},"responses":{"200":{"description":"Successful API URL generation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetAPIUrlResponse"}}}},"403":{"description":"Forbidden - domain not registered","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"schemas":{"GetAPIUrlInput":{"type":"object","required":["Info"],"properties":{"Info":{"type":"object","required":["web3Type","confirmations","Domain","EncryptedUserPin","OthentSub","proofMode","account"],"properties":{"web3Type":{"type":"string","description":"Type of web3 authentication (e.g., \"Othent\")"},"confirmations":{"type":"array","items":{"type":"object","properties":{"data":{"type":"string","description":"Type of data being confirmed (e.g., \"Traits\", \"Large\", \"Medium\", \"Small\")"},"date":{"type":"string","description":"Date of confirmation"}}}},"Domain":{"type":"string","description":"Domain requesting the API URL"},"EncryptedUserPin":{"type":"string","description":"Onairos encrypted PIN"},"OthentSub":{"type":"string","description":"Othent subscription ID"},"proofMode":{"type":"boolean","description":"Whether to use proof mode"},"account":{"type":"string","description":"User account identifier"}}}}},"GetAPIUrlResponse":{"type":"object","properties":{"apiUrl":{"type":"string","description":"URL for API access"},"token":{"type":"string","description":"JWT token for authentication"}}},"Error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"},"details":{"type":"object","description":"Detailed error information"}}}}}}
```

## User mind reading API

> Mind reading API to generate preferences/insights and memories for approved user

```json
{"openapi":"3.0.3","info":{"title":"Onairos Backend API","version":"1.0.0"},"servers":[{"url":"https://api2.onairos.uk","description":"Production server"},{"url":"http://localhost:8080","description":"Development server"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"InferenceInput":{"type":"object","required":["inputData","accessToken"],"properties":{"inputData":{"type":"array","items":{"type":"object","required":["text","category"],"properties":{"text":{"type":"string","description":"Text content for inference"},"category":{"type":"string","description":"Category of the content"},"img_url":{"type":"string","description":"Optional URL to an image"}}}},"accessToken":{"type":"string","description":"JWT token for authentication"}}},"InferenceResponse":{"type":"object","properties":{"InferenceResult":{"type":"object","properties":{"output":{"type":"object","description":"ML inference results"}}}}},"Error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"},"details":{"type":"object","description":"Detailed error information"}}}}},"paths":{"/inferenceNoProof":{"post":{"summary":"User mind reading API","description":"Mind reading API to generate preferences/insights and memories for approved user","tags":["User"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceInput"}}}},"responses":{"200":{"description":"Successful inference","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceResponse"}}}},"400":{"description":"Bad request - invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized - invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Payload too large - input exceeds size limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## User traits API

> Generate only user personality traits

```json
{"openapi":"3.0.3","info":{"title":"Onairos Backend API","version":"1.0.0"},"servers":[{"url":"https://api2.onairos.uk","description":"Production server"},{"url":"http://localhost:8080","description":"Development server"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"InferenceInput":{"type":"object","required":["inputData","accessToken"],"properties":{"inputData":{"type":"array","items":{"type":"object","required":["text","category"],"properties":{"text":{"type":"string","description":"Text content for inference"},"category":{"type":"string","description":"Category of the content"},"img_url":{"type":"string","description":"Optional URL to an image"}}}},"accessToken":{"type":"string","description":"JWT token for authentication"}}},"InferenceResponse":{"type":"object","properties":{"InferenceResult":{"type":"object","properties":{"output":{"type":"object","description":"ML inference results"}}}}},"Error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"},"details":{"type":"object","description":"Detailed error information"}}}}},"paths":{"/traits":{"post":{"summary":"User traits API","description":"Generate only user personality traits","tags":["User"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceInput"}}}},"responses":{"200":{"description":"Successful traits inference","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```
