Error Handling
The Garmint API uses standard HTTP status codes and returns consistent JSON error responses.Error Response Format
All errors follow this structure:| Field | Type | Description |
|---|---|---|
code | string | Machine-readable error code |
message | string | Human-readable description |
details | object | Additional context (optional) |
Error Codes
Authentication Errors
| Code | Status | Description |
|---|---|---|
unauthorized | 401 | Missing or invalid API key |
forbidden | 403 | Key lacks permission for this action |
Request Errors
| Code | Status | Description |
|---|---|---|
invalid_request | 400 | Malformed request body or parameters |
not_found | 404 | Requested resource doesn’t exist |
Rate & Usage Errors
| Code | Status | Description |
|---|---|---|
rate_limited | 429 | Too many requests |
insufficient_tokens | 402 | Not enough tokens for operation |
Server Errors
| Code | Status | Description |
|---|---|---|
internal_error | 500 | Unexpected server error |
HTTP Status Codes
| Status | Meaning |
|---|---|
200 | Success |
201 | Created (new resource) |
400 | Bad Request |
401 | Unauthorized |
402 | Payment Required (no tokens) |
403 | Forbidden |
404 | Not Found |
429 | Rate Limited |
500 | Internal Server Error |
Handling Errors in Code
TypeScript
Python
Debugging Tips
Check request headers
Check request headers
Ensure you’re sending:
Authorization: Bearer gm_live_xxxContent-Type: application/jsonfor POST requests
Validate URLs
Validate URLs
Design and garment URLs must be:
- Publicly accessible (no auth required)
- HTTPS preferred
- Valid image formats (PNG, JPEG, WebP)
Check your token balance
Check your token balance
The
X-Tokens-Remaining header shows your current balance in every response.Review rate limit headers
Review rate limit headers
Monitor
X-RateLimit-Remaining to avoid hitting limits.Getting Help
If you encounter persistent errors:- Check our status page
- Search Discord for similar issues
- Email api@garmint.app with:
- Your request (redact API key)
- The error response
- Timestamp of the request