Error Response Format
All API errors follow a consistent JSON structure that includes an error code, human-readable message, and request ID for troubleshooting.Error Response Structure
When an error occurs, the API returns a JSON response with the following structure:The error object containing all error information
Machine-readable error code identifying the type of error
Human-readable description of the error
Unique identifier for the request, useful for troubleshooting and support
Additional error details, typically used for validation errors to specify which fields failed validation
Error Codes
The API uses standard HTTP status codes along with specific error codes to indicate the type of error.UNAUTHORIZED
HTTP Status:401 Unauthorized
Returned when authentication is missing or invalid.
Example Response
Example Response
- Missing
Authorizationheader - Invalid or expired access token
- Attempting to access a resource you don’t own
internal/auth/middleware.go:27 and internal/versions/handler.go:35
NOT_FOUND
HTTP Status:404 Not Found
Returned when the requested resource does not exist.
Example Response
Example Response
- Requesting a prompt that doesn’t exist
- Requesting a version that doesn’t exist
- Using an invalid prompt or version ID
internal/versions/handler.go:50
CONFLICT
HTTP Status:409 Conflict
Returned when the request conflicts with existing data.
Example Response
Example Response
- Attempting to create a prompt that already exists
- Attempting to create a version that already exists
- Duplicate resource creation
internal/versions/handler.go:68 and internal/prompts/handler.go:64
VALIDATION_FAILED
HTTP Status:400 Bad Request
Returned when request validation fails. This error includes a details object with field-specific error messages.
Example Response
Example Response
- Missing required fields
- Invalid field formats
- Field values outside allowed ranges
- Missing OAuth parameters
The
details field provides specific information about which fields failed validation and why.internal/server/respond.go:33 (RespondValidationError function)
INTERNAL_ERROR
HTTP Status:500 Internal Server Error
Returned when an unexpected server error occurs.
Example Response
Example Response
- Database connection failures
- Storage service failures
- Unexpected server-side errors
If you encounter internal errors repeatedly, please contact support with the
request_id for investigation.internal/versions/handler.go:83 and internal/server/server.go:56
Best Practices
Always Check the Error Code
Use thecode field to programmatically handle different error types:
Log Request IDs
Always log therequest_id when errors occur. This helps with debugging and support inquiries:
Handle Validation Errors Gracefully
ForVALIDATION_FAILED errors, iterate through the details object to display field-specific errors: