Response Structure
All API endpoints return responses in the following JSON format:| Field | Type | Description |
|---|---|---|
code | integer | Status code indicating the result of the request. 200 means success; other values indicate errors. |
msg | string | Human-readable message describing the result of the request. |
data | object | The response payload returned by the API. When an error occurs, this field is usually null. |
HTTP Status Codes
In this API, the HTTP status code is consistent with thecode field in the response body.
For example:
- When a request succeeds, the server returns HTTP
200, and the response body contains"code": 200. - When a request fails, the server returns the corresponding HTTP status code, and the same value appears in the
codefield.
- HTTP status code indicates the request result at the protocol level.
codefield provides the same status information in the response body for easier client-side handling.- Clients can determine whether a request succeeded by checking either the HTTP status code or the
codefield.
Common Error Codes
| Code | Description |
|---|---|
200 | Success |
400 | Invalid request parameters |
401 | Unauthorized (invalid or expired API key) |
402 | Insufficient balance or credits |
403 | Forbidden (account disabled or IP not allowed) |
405 | Method not allowed |
409 | Request conflict or duplicate request |
415 | Unsupported media type |
429 | Rate limit exceeded |
500 | Internal server error |
Error Response Examples
Below are common error scenarios you may encounter, along with their response bodies: Invalid or missing API key:Troubleshooting FAQ
| Problem | Possible Cause | Solution |
|---|---|---|
401 Unauthorized | API key is missing, invalid, or expired | Verify your API key in the Authorization header. Regenerate a new key from the Console if needed. |
402 Insufficient balance | Your account balance is depleted | Top up your account balance in the Console. |
400 Asset not found | The asset_id does not exist or has been deleted | Verify the asset_id is correct. Re-upload the file if it was deleted. |
415 Unsupported media type | The uploaded file format is not supported | Check the supported file formats in the Upload documentation. |
429 Rate limit exceeded | Too many requests in a short time | Implement retry logic with exponential backoff. See Rate Limit for details. |
500 Internal server error | Server-side issue | Retry after a few seconds. If persistent, contact support@memories.ai. |
Notes
- The
msgfield provides a human-readable description of the request result. - The
datafield contains the response payload when the request succeeds. - When an error occurs,
datawill usually benull. - Clients should handle errors based on the returned status code.
