The HTTP Server resource creates REST API endpoints for your Ditto database, enabling any HTTP client to query and manipulate data without using the Ditto SDK. This is ideal for web applications, third-party integrations, and systems that require standard HTTP access.Documentation Index
Fetch the complete documentation index at: https://docs.ditto.live/llms.txt
Use this file to discover all available pages before exploring further.
Basic Configuration
Add an HTTP server to expose your database via REST API:API Endpoints
The HTTP server provides the following endpoints:- Execute endpoint:
POST /<base_path>/execute- Execute DQL queries - Attachments:
POST /<base_path>/attachments/uploadandGET /<base_path>/attachments/{id}- Upload and download attachments - Presence:
GET /<base_path>/presence- View the presence graph of connected peers - Logs:
GET /<base_path>/logs- Download server logs as a.tar.gzfile - API documentation:
GET /<base_path>/docs- Access OpenAPI specification and Swagger UI - Health check:
GET /<base_path>/health- Simple health status
- Execute endpoint:
POST http://127.0.0.1:8080/execute - Health check:
GET http://127.0.0.1:8080/health - API docs:
GET http://127.0.0.1:8080/docs
Security Considerations
Authentication
Edge Server supports API key authentication to protect your HTTP endpoints. See the Authentication guide for details on:- Generating API keys
- Configuring identities and permissions
- Securing your HTTP server
Network Access
The HTTP server allows binding to any listen address (e.g.,0.0.0.0 or [::]) to facilitate use inside Docker containers. When exposing the HTTP server to external networks:
- Always enable authentication in production
- Use TLS/HTTPS for encrypted connections
- Consider using a reverse proxy for additional security layers
API Documentation
OpenAPI Specification
The Edge Server automatically generates a comprehensive OpenAPI 3.1 specification from your configuration file. The spec is generated directly from the actual HTTP handlers used at runtime, ensuring it always stays in sync with the server’s behavior—even as handlers are updated.The spec is generated from the real HTTP handlers, not manually maintained documentation. When handler signatures change, the spec automatically reflects those changes.
- Interactive docs - Swagger UI, ReDoc, Stoplight
- Client generation - Type-safe SDKs in 50+ languages (TypeScript, Python, Go, Rust, Java, etc.)
- API testing - Postman collections, Insomnia workspaces
- Contract testing - Pact, Dredd, Schemathesis
- Documentation - Static site generation, developer portals
- Validation - CI/CD spec validation, breaking change detection
Interactive Documentation
Access the built-in Swagger UI documentation while the server is running:- Browse all available endpoints
- View request/response schemas
- Try out API calls directly from the browser
- See authentication requirements
- Explore error responses
Using the API
Query Examples
Execute a SELECT query:Docker Networking
When using Docker, ensure proper port mapping:Best Practices
- Use unique ports: Each HTTP server must bind to a different port
- Limit API access: Only enable the execute endpoint if needed
- Monitor health: Use the health check endpoint for monitoring
- Secure production: Use TLS and enable authentication for production deployments