HTTP Status Codes
Success Codes
Code | Status | Description |
---|---|---|
200 | OK | Request succeeded |
304 | Not Modified | Resource hasn’t changed (ETag match) |
Client Error Codes
Code | Status | Description |
---|---|---|
400 | Bad Request | Invalid request format or parameters |
401 | Unauthorized | Missing or invalid authentication |
403 | Forbidden | Insufficient permissions |
404 | Not Found | Resource doesn’t exist |
429 | Too Many Requests | Rate limit exceeded |
Server Error Codes
Code | Status | Description |
---|---|---|
500 | Internal Server Error | Unexpected server error |
502 | Bad Gateway | Temporary server issue |
503 | Service Unavailable | Server temporarily unavailable |
Error Response Format
All error responses follow a consistent JSON structure:Example Error Responses
Authentication Errors
401 Unauthorized
Causes:- Missing
Authorization
header - Invalid or expired API key
- Malformed Bearer token
- Verify your API key is correct
- Check the Authorization header format:
Bearer YOUR_API_KEY
- Generate a new API key if the current one is expired
403 Forbidden
Causes:- Attempting to access another user’s resources
- API key lacks required permissions
- Resource access restrictions
- Verify you’re accessing your own projects/sessions
- Check API key permissions in the dashboard
- Ensure the resource ID is correct
Resource Errors
404 Not Found
Common scenarios:Project Not Found
Project Not Found
- Invalid project ID
- Project was deleted
- No access to the project
- Verify the project ID exists
- Check if you have access to the project
- Use
GET /api/v1/projects
to list available projects
Session Not Found
Session Not Found
- Invalid session ID
- Session was deleted
- Session belongs to a different project
- Verify the session ID and project ID combination
- Use
GET /api/v1/projects/{projectId}/sessions
to list sessions - Check if the session was recently deleted
Rate Limiting
429 Too Many Requests
The API implements rate limiting to ensure service quality:- REST API: 1000 requests per hour
- GraphQL API: 500 queries per hour
GraphQL Errors
GraphQL errors are returned in theerrors
array alongside any partial data:
Common GraphQL Error Codes
Code | Description | Solution |
---|---|---|
UNAUTHENTICATED | Missing or invalid authentication | Check Authorization header |
FORBIDDEN | Insufficient permissions | Verify resource access |
NOT_FOUND | Resource doesn’t exist | Check resource ID |
VALIDATION_ERROR | Invalid query or variables | Review query syntax |
RATE_LIMITED | Too many requests | Implement backoff strategy |
Validation Errors
400 Bad Request
Request validation failures:Invalid JSON
Invalid JSON
- Malformed JSON syntax
- Missing required Content-Type header
- Validate JSON syntax
- Include
Content-Type: application/json
header
Missing Required Fields
Missing Required Fields
- Required parameters not provided
- Incorrect parameter names
- Check API documentation for required fields
- Verify parameter spelling and case
Invalid Parameter Values
Invalid Parameter Values
- Parameter values outside allowed range
- Incorrect data types
- Check allowed values in API documentation
- Verify data types match expected format
Error Handling Best Practices
Implement Retry Logic
Log Errors for Debugging
Graceful Degradation
Troubleshooting Checklist
When encountering API errors:-
Check Authentication
- Verify API key is valid and not expired
- Ensure proper Authorization header format
- Test with a simple request like
GET /api/v1/projects
-
Validate Request Format
- Check JSON syntax and structure
- Verify required fields are included
- Ensure parameter values are within allowed ranges
-
Review Resource Access
- Confirm resource IDs exist and are accessible
- Check if you have permissions for the operation
- Verify project/session relationships
-
Monitor Rate Limits
- Check rate limit headers in responses
- Implement appropriate backoff strategies
- Consider caching frequently accessed data
-
Test with GraphQL Playground
- Use the interactive playground to test queries
- Validate GraphQL syntax and variables
- Explore schema documentation for available fields
Getting Help
If you’re still experiencing issues:- Check our status page for service incidents
- Search existing issues on GitHub
- Contact support at support@specstory.com
- Join our community on Slack
- Request URL and method
- Request headers and body
- Response status code and body
- Timestamp of the request
- Your API key ID (not the full key)