How Do Errors Look?
When a request fails, you get an HTTP status code and an error object:
| Field | Description |
|---|---|
code | A short code you can check in your code. These don't change. |
message | What went wrong, in plain English. Good for logs, but it may change, so don't check it in code. |
details | Extra information, for some errors. |
Invalid Fields
If a request has invalid fields, you get a 400 with the code validation_failed, and details.fields lists every problem at once:
Fields the endpoint doesn't know about are rejected too, so a typo like usrname fails instead of being silently ignored.
Error Codes
| Status | code | What it means | What to do |
|---|---|---|---|
400 | bad_request | The request couldn't be read, such as broken JSON or a bad orderBy. | Check the message. |
400 | validation_failed | One or more fields are invalid. | Fix the fields in details.fields. |
401 | unauthorized | The token is missing, wrong, expired or deactivated. | Check your Authorization header and token. |
403 | forbidden | The acting member isn't allowed to do this, or it needs premium. | Check the member's permissions, or your plan. |
404 | not_found | It doesn't exist, or it belongs to another server. | Check the ID. |
405 | method_not_allowed | The endpoint exists, but not with that method. | Check the method, such as POST or PATCH. |
408 | request_timeout | The request took too long. | Try again. For writes, check first. |
409 | conflict | It can't be done right now, such as ending a shift that already ended. | Get the latest state and try again if it makes sense. |
413 | payload_too_large | The body is over 64 KB. | Send less. |
415 | unsupported_media_type | The body isn't marked as JSON. | Add Content-Type: application/json. |
429 | rate_limited | You've hit a rate limit. | Wait for Retry-After seconds. |
500 | internal_error | Something broke on our end. | Try again later, and tell us if it keeps happening. |
502 | upstream_error | A write didn't get confirmed. | See below. |
503 | service_unavailable | Writes are paused. | Try again later. |
When a Write Fails
A 502 on a write means Melonly couldn't confirm it, but it may still have gone through. Before you try again, check whether it happened. For example, after a failed Create a Log, look for the log with List a Player's Logs.
Retrying without checking can create the log twice, and send the player two DMs.
Where to Go Next
Need help?
Still have questions? Join our Discord server for support from the Melonly Team.