Skip to main content
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.

Basic Configuration

Add an HTTP server to expose your database via REST API:
See the HTTP server configuration reference for complete details.

API Endpoints

The HTTP server provides the following endpoints:
  • Execute endpoint: POST /<base_path>/execute - Execute DQL queries
  • Attachments: POST /<base_path>/attachments/upload and GET /<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.gz file
  • API documentation: GET /<base_path>/docs - Access OpenAPI specification and Swagger UI
  • Health check: GET /<base_path>/health - Simple health status
For example, with the config above:
  • 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
See the HTTP server configuration reference for complete details on configuring and controlling these endpoints.

Security Considerations

Edge Server is currently in preview. It is not recommended for production use.Edge server is under rapid development as a result:
  • APIs may change without notice.
  • Configuration format may change without notice.
  • Features, and behavior may change without notice.
  • This documentation may quickly grow stale or become inaccurate.
If you are experiencing issues, please reach out to your Ditto contact.

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.
Access the spec at runtime:
Generate offline without starting the server:
Development workflow examples:
Use cases:
  • 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:
This provides an interactive interface to:
  • Browse all available endpoints
  • View request/response schemas
  • Try out API calls directly from the browser
  • See authentication requirements
  • Explore error responses
The Swagger UI automatically reflects your configuration—only enabled endpoints appear.

Using the API

Query Examples

Execute a SELECT query:
Insert data:

Docker Networking

When using Docker, ensure proper port mapping:

Best Practices

  1. Use unique ports: Each HTTP server must bind to a different port
  2. Limit API access: Only enable the execute endpoint if needed
  3. Monitor health: Use the health check endpoint for monitoring
  4. Secure production: Use TLS and enable authentication for production deployments