API Overview

RayRay provides a RESTful API built with FastAPI.

Base URL

http://localhost:8000/api

For production, replace with your deployed API URL.

Authentication

All API endpoints require JWT authentication.

Get a Token

curl -X POST http://localhost:8000/api/users/login \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "username=analyst@rayray.demo&password=Analyst123!"

Response:

{
  "access_token": "eyJ...",
  "token_type": "bearer"
}

Use the Token

curl http://localhost:8000/api/users/me \
  -H "Authorization: Bearer eyJ..."

API Endpoints

Document Management

MethodEndpointDescription
POST/api/documents/uploadUpload a PDF document
GET/api/documents/listList all documents
GET/api/documents/{id}Get document details
DELETE/api/documents/{id}Delete a document

Extraction

MethodEndpointDescription
POST/api/extractions/extract/workflowStart extraction workflow
POST/api/extractions/workflow/{id}/reviewSubmit human review

Authentication

MethodEndpointDescription
POST/api/users/loginLogin, get JWT
GET/api/users/meGet current user
POST/api/users/mfa/setupSetup MFA
POST/api/users/mfa/verifyVerify MFA code

Swagger UI

For full API documentation with interactive testing:

Open Swagger UI →

The Swagger UI provides:

  • Full endpoint documentation
  • Request/response schemas
  • Interactive "Try it out" feature
  • Authentication support

Error Handling

All errors follow this format:

{
  "detail": "Error message here"
}

Common HTTP status codes:

CodeMeaning
200Success
201Created
400Bad Request
401Unauthorized
403Forbidden
404Not Found
422Validation Error
500Server Error