Requests & Responses
This page covers the request and response formats used across the Gumnut API.Request Format
Headers
All requests should include:multipart/form-data:
Request Body
Send JSON payloads for most endpoints:Query Parameters
Use query parameters for filtering and pagination:Response Format
Successful Responses
Successful requests return JSON with appropriate HTTP status codes:200 OK- Request succeeded201 Created- Resource created204 No Content- Request succeeded with no content
Error Responses
Errors return a consistent JSON structure:400 Bad Request- Invalid request401 Unauthorized- Authentication required403 Forbidden- Insufficient permissions404 Not Found- Resource not found429 Too Many Requests- Rate limit exceeded (see Rate Limiting)500 Internal Server Error- Server error
Best Practices
Error Handling
- Implement exponential backoff for retries on 429 and 5xx errors
- Handle rate limits gracefully using the
Retry-Afterheader (see Rate Limiting) - Log errors with the request ID for debugging
- Validate input before sending requests
Security
- Never expose API keys in client-side code
- Use HTTPS for all requests
- Implement proper authentication flows
