API Overview
RayRay provides a RESTful API built with FastAPI.
Base URL
http://localhost:8000/apiFor 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
| Method | Endpoint | Description |
|---|---|---|
POST | /api/documents/upload | Upload a PDF document |
GET | /api/documents/list | List all documents |
GET | /api/documents/{id} | Get document details |
DELETE | /api/documents/{id} | Delete a document |
Extraction
| Method | Endpoint | Description |
|---|---|---|
POST | /api/extractions/extract/workflow | Start extraction workflow |
POST | /api/extractions/workflow/{id}/review | Submit human review |
Authentication
| Method | Endpoint | Description |
|---|---|---|
POST | /api/users/login | Login, get JWT |
GET | /api/users/me | Get current user |
POST | /api/users/mfa/setup | Setup MFA |
POST | /api/users/mfa/verify | Verify MFA code |
Swagger UI
For full API documentation with interactive testing:
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:
| Code | Meaning |
|---|---|
| 200 | Success |
| 201 | Created |
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not Found |
| 422 | Validation Error |
| 500 | Server Error |