FOLIO API
softwarePublic RESTful API for the Federated Open Legal Information Ontology, providing programmatic access to 18,000+ legal concepts with multiple output formats
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
A production-ready RESTful API service providing public access to the Federated Open Legal Information Ontology (FOLIO), enabling developers to integrate standardized legal concepts into their applications through a well-documented HTTP interface.
Service Overview
The FOLIO API serves as the primary web interface for accessing the legal ontology, offering:
- Public Access: Free, unrestricted API at https://folio.openlegalstandard.org/
- Multiple Formats: JSON-LD, OWL XML, Markdown, and HTML responses
- Semantic Search: Optional LLM-powered search capabilities
- OpenAPI Documentation: Interactive API docs at /docs endpoint
API Capabilities
Core Endpoints
Class Retrieval
- Get detailed information about specific FOLIO classes
- Access by IRI or internal identifier
- Full property and relationship data
Search Functions
- Prefix Search: Autocomplete functionality
- Label Search: Find concepts by name
- Definition Search: Query by descriptions
- Semantic Search: LLM-enhanced discovery
Format Conversion
- JSON-LD for web applications
- OWL XML for ontology tools
- Markdown for documentation
- HTML for human browsing
Technical Architecture
Infrastructure
- Web Framework: Python-based API server
- Reverse Proxy: Caddy for HTTPS and security
- Containerization: Docker for deployment
- Documentation: OpenAPI/Swagger integration
Deployment Features
- Automatic TLS certificate management
- Security headers configuration
- Load balancing support
- Health check endpoints
Configuration
The API supports flexible configuration through config.json
:
{
"enable_llm_search": true,
"cache_timeout": 3600,
"rate_limiting": {
"enabled": true,
"requests_per_minute": 60
}
}
Development Setup
Local Development
# Clone repository
git clone https://github.com/alea-institute/folio-api
# Install dependencies
pip install -r requirements.txt
# Run development server
python -m uvicorn main:app --reload
Docker Deployment
# Build and run with Docker Compose
docker-compose up -d
# Access at https://localhost
API Usage Examples
Basic Class Retrieval
# Get contract concept
curl https://folio.openlegalstandard.org/api/v1/class/Contract
# Get as JSON-LD
curl -H "Accept: application/ld+json" \
https://folio.openlegalstandard.org/api/v1/class/Contract
Search Operations
# Search by prefix
curl https://folio.openlegalstandard.org/api/v1/search?prefix=Cont
# Semantic search
curl -X POST https://folio.openlegalstandard.org/api/v1/search/semantic \
-H "Content-Type: application/json" \
-d '{"query": "employment agreements"}'
Performance Features
- Caching: Intelligent response caching
- Rate Limiting: Fair usage policies
- Compression: Gzip response compression
- Connection Pooling: Efficient resource usage
Security
Built with security best practices:
- HTTPS by default with Caddy
- CORS configuration for web apps
- Rate limiting to prevent abuse
- Input validation and sanitization
Integration Support
The API facilitates integration with:
- Legal tech applications
- AI/ML pipelines
- Knowledge management systems
- Document processing tools
- Research platforms
Monitoring
Production monitoring includes:
- Request/response logging
- Performance metrics
- Error tracking
- Usage analytics
Documentation
Comprehensive documentation available:
Future Enhancements
- GraphQL endpoint support
- Webhook notifications
- Batch processing endpoints
- Advanced query language
- Real-time synchronization
The FOLIO API represents a critical infrastructure component for the legal technology ecosystem, providing reliable, scalable access to standardized legal information.