The Fluree HTTP API provides RESTful endpoints for all database operations. This section documents the complete API surface including request formats, authentication, and error handling.
High-level introduction to the Fluree HTTP API, including:
- API design principles
- Authentication overview
- Rate limiting and quotas
- API versioning
Complete reference for all HTTP endpoints:
POST /update- Submit update transactions (WHERE/DELETE/INSERT or SPARQL UPDATE)POST /query- Execute queriesPOST /multi-query- Bundle multiple queries against a shared snapshot (dedicated doc)GET /v1/fluree/ledgers- List ledgersGET /health- Health checksGET /v1/fluree/stats- Server status- And more...
Bundle multiple JSON-LD and/or SPARQL queries into a single request that runs against one shared snapshot moment, with envelope-level @context / opts defaults and per-alias result assembly.
HTTP headers and request format details:
- Content-Type negotiation
- Accept headers for response formats
- Request size limits
- Compression support
- Custom headers
Cryptographically signed and verifiable requests:
- JSON Web Signature (JWS) format
- Verifiable Credentials (VC) support
- Public key verification
- DID authentication
- Signature validation
HTTP status codes and error responses:
- Standard HTTP status codes
- Fluree-specific error codes
- Error response format
- Troubleshooting common errors
The Fluree API follows REST principles:
- Resource-oriented URLs
- Standard HTTP methods (GET, POST)
- Stateless requests
- Standard status codes
Fluree supports multiple content types for requests and responses:
Request Content-Types:
application/json- JSON-LD transactions and queriesapplication/sparql-query- SPARQL queriestext/turtle- Turtle RDF formatapplication/ld+json- Explicit JSON-LD
Response Content-Types:
application/json- Default JSON formatapplication/ld+json- JSON-LD with contextapplication/sparql-results+json- SPARQL result format
Fluree supports multiple authentication mechanisms:
- No Authentication (development only)
- Signed Requests (JWS/VC for production)
- API Keys (simple token-based auth)
- Bearer Tokens (JWT authentication)
See Signed Requests for cryptographic authentication details.
curl -X POST http://localhost:8090/v1/fluree/insert?ledger=mydb:main \
-H "Content-Type: application/json" \
-d '{
"@context": {
"ex": "http://example.org/ns/"
},
"@graph": [
{ "@id": "ex:alice", "ex:name": "Alice" }
]
}'curl -X POST http://localhost:8090/v1/fluree/query \
-H "Content-Type: application/json" \
-d '{
"from": "mydb:main",
"select": ["?name"],
"where": [
{ "@id": "?person", "ex:name": "?name" }
]
}'curl -X POST http://localhost:8090/v1/fluree/query \
-H "Content-Type: application/sparql-query" \
-d 'SELECT ?name FROM <mydb:main> WHERE { ?person ex:name ?name }'curl http://localhost:8090/healthAll examples in this documentation use curl for simplicity. Curl is available on all major platforms.
Fluree's HTTP API can be accessed from any language with HTTP client support:
JavaScript/TypeScript:
const response = await fetch('http://localhost:8090/v1/fluree/query', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
from: 'mydb:main',
select: ['?name'],
where: [{ '@id': '?person', 'ex:name': '?name' }]
})
});
const results = await response.json();Python:
import requests
response = requests.post('http://localhost:8090/v1/fluree/query', json={
'from': 'mydb:main',
'select': ['?name'],
'where': [{'@id': '?person', 'ex:name': '?name'}]
})
results = response.json()Java:
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8090/v1/fluree/query"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(queryJson))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());For local development, the API typically runs without authentication:
./fluree-db-server --port 8090 --storage memoryAccess: http://localhost:8090
For production deployments, enable authentication and use HTTPS:
./fluree-db-server \
--port 8090 \
--storage aws \
--require-signed-requests \
--https-cert /path/to/cert.pem \
--https-key /path/to/key.pemAccess: https://api.yourdomain.com
Always use:
- HTTPS in production
- Signed requests or API keys
- Rate limiting
- Request size limits
Default limits (configurable):
- Transaction size: 10MB
- Query size: 1MB
- Response size: 100MB
See Headers and Request Sizing for details.
- Keep-alive connections supported
- HTTP/2 support available
- WebSocket support for streaming (planned)
- Query results can be cached (ETag support)
- Immutable historical queries cache well
- Current queries should not be cached aggressively
- Getting Started - Quickstart guides
- Transactions - Transaction details
- Query - Query language documentation
- Security - Policy and access control
- Operations - Configuration and deployment