Skip to main content

Overview

LoopOS AI provides a comprehensive REST API for accessing all AI services. All endpoints follow RESTful conventions and return JSON responses.

Base URL

https://loopos-ai-server-3recw.ondigitalocean.app

Authentication

Currently, LoopOS AI services don’t require authentication for public endpoints. All requests must use HTTPS.
Authentication may be added in the future. Check documentation for updates.

Request Format

All requests use:
  • Method: POST (except health check)
  • Content-Type: application/json
  • Body: JSON object

Response Format

All responses return JSON:
  • 200 OK: Successful request
  • 422 Validation Error: Invalid input parameters
  • 413 Payload Too Large: Request exceeds size limits
  • 429 Too Many Requests: Rate limit exceeded
  • 500 Internal Server Error: Server-side error

Common Request Fields

Most endpoints accept these common fields:
FieldTypeDescriptionDefault
languagestringLanguage code (e.g., “PT-PT”, “en-US”)“PT-PT”
conversationbooleanWhether this is conversationalfalse
callback_urlstringAsync callback URLnull
loopos_core_contextstringBusiness contextnull
messagesarrayConversation messages[]
imagesarrayImage URLs or base64[]
agent_specificobjectService-specific paramsnull
session_extra_dataobjectSession metadata

Endpoints

Core Services

Utility Endpoints

  • GET /health - Health check endpoint
  • GET / - Root endpoint (serves index page)

Rate Limiting

Rate limits are applied per endpoint. If you exceed the limit, you’ll receive a 429 Too Many Requests response.

Timeouts

  • Default timeout: 120 seconds
  • Long-running operations: Up to 300 seconds

Error Responses

Validation Error (422)

{
  "detail": [
    {
      "loc": ["body", "agent_specific", "category"],
      "msg": "field required",
      "type": "value_error.missing"
    }
  ]
}

Server Error (500)

{
  "error": "Internal Server Error"
}

OpenAPI Specification

The complete OpenAPI specification is available at:
/openapi.json
You can use this to:
  • Generate client libraries
  • Explore endpoints in tools like Postman
  • Validate requests and responses

Code Examples

import requests

BASE_URL = "https://loopos-ai-server-3recw.ondigitalocean.app"

response = requests.post(
    f"{BASE_URL}/loopos_ai_decision",
    json={
        "language": "PT-PT",
        "prompt": "What condition?",
        "options": ["Excellent", "Good", "Fair", "Poor"],
        "item_context": "iPhone 12 with scratches"
    },
    timeout=120
)
result = response.json()