Available APIs
Vespa exposes the following main HTTP APIs:Document v1 API
CRUD operations for documents
Search API
Query and retrieve documents
Deploy API
Deploy and manage applications
Base URL Structure
All Vespa HTTP APIs follow a consistent URL structure:- Document API:
http://localhost:8080/document/v1/ - Search API:
http://localhost:8080/search/ - Deploy API:
http://localhost:19071/application/v2/
Authentication
Vespa supports multiple authentication mechanisms depending on your deployment:Vespa Cloud
For Vespa Cloud deployments, all API requests require authentication using:- mTLS (Mutual TLS): Certificate-based authentication for production environments
- API Keys: Token-based authentication for development and CI/CD
Self-Hosted Vespa
For self-hosted deployments:- Authentication is optional and configured per container
- Can integrate with custom authentication filters
- Supports token-based authentication via custom handlers
Request Format
Content Types
Vespa APIs support the following content types:- JSON (default):
application/json - CBOR:
application/cbor(binary JSON format for better performance)
Common Headers
The MIME type of the request body
The desired response format. Supports
application/json or application/cborResponse Format
All API responses follow a consistent JSON structure:Error Responses
Error responses include detailed information:The request path that generated the response
Human-readable message describing the result or error
HTTP Status Codes
Vespa uses standard HTTP status codes:| Status Code | Description |
|---|---|
| 200 OK | Request succeeded |
| 201 Created | Document created successfully |
| 400 Bad Request | Invalid request format or parameters |
| 404 Not Found | Document or resource not found |
| 412 Precondition Failed | Test-and-set condition failed |
| 429 Too Many Requests | Rate limit exceeded or system overload |
| 500 Internal Server Error | Server-side error |
| 504 Gateway Timeout | Request timeout exceeded |
| 507 Insufficient Storage | No storage space available |
Timeouts
All APIs support timeout configuration:Request timeout in seconds or with unit suffix (e.g.,
5s, 1000ms)Tracing
Enable request tracing for debugging:Trace level from 0 (off) to 9 (maximum detail)
Rate Limiting
Vespa implements automatic rate limiting to protect system stability:- Document API: Queue-based throttling with configurable limits
- Search API: Thread pool saturation monitoring
- Deploy API: Per-tenant rate limiting
Performance Considerations
Best Practices
- Batch Operations: Use visitor operations for bulk reads instead of individual GET requests
- Connection Reuse: Use HTTP keep-alive and connection pooling
- CBOR Format: Use CBOR for better performance with large responses
- Timeout Configuration: Set appropriate timeouts based on operation complexity
- Compression: Enable HTTP compression for large payloads
Example: Connection Pooling
Monitoring and Metrics
Vespa exposes API metrics through:- Prometheus metrics: Available at
/prometheus/v1/values - JSON metrics: Available at
/state/v1/metrics
http.status.2xx: Successful requestshttp.status.4xx: Client errorshttp.status.5xx: Server errorshttp.request.latency: Request latency percentiles
Next Steps
Document v1 API
Learn about document CRUD operations
Search API
Explore query capabilities
Deploy API
Deploy your applications
Query Language
Learn YQL query syntax