Skip to main content
All API responses follow a consistent response structure and include a status code that indicates whether the request was successful or failed.

Response Structure

All API endpoints return responses in the following JSON format:
{
  "code": 200,
  "msg": "success",
  "data": {}
}
FieldTypeDescription
codeintegerStatus code indicating the result of the request. 200 means success; other values indicate errors.
msgstringHuman-readable message describing the result of the request.
dataobjectThe 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 the code 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 code field.
Example:
HTTP/1.1 400 Bad Request
{
  "code": 400,
  "msg": "Invalid request parameters",
  "data": null
}
This means:
  • HTTP status code indicates the request result at the protocol level.
  • code field 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 code field.

Common Error Codes

CodeDescription
200Success
400Invalid request parameters
401Unauthorized (invalid or expired API key)
402Insufficient balance or credits
403Forbidden (account disabled or IP not allowed)
405Method not allowed
409Request conflict or duplicate request
415Unsupported media type
429Rate limit exceeded
500Internal server error

Error Response Examples

Below are common error scenarios you may encounter, along with their response bodies: Invalid or missing API key:
{
  "code": 401,
  "msg": "Unauthorized",
  "data": null
}
Asset not found:
{
  "code": 400,
  "msg": "Asset not found",
  "data": null
}
Insufficient account balance:
{
  "code": 402,
  "msg": "Insufficient balance or credits",
  "data": null
}
Unsupported file format:
{
  "code": 415,
  "msg": "Unsupported media type",
  "data": null
}
Rate limit exceeded:
{
  "code": 429,
  "msg": "Rate limit exceeded",
  "data": null
}
Internal server error:
{
  "code": 500,
  "msg": "Internal server error",
  "data": null
}

Troubleshooting FAQ

ProblemPossible CauseSolution
401 UnauthorizedAPI key is missing, invalid, or expiredVerify your API key in the Authorization header. Regenerate a new key from the Console if needed.
402 Insufficient balanceYour account balance is depletedTop up your account balance in the Console.
400 Asset not foundThe asset_id does not exist or has been deletedVerify the asset_id is correct. Re-upload the file if it was deleted.
415 Unsupported media typeThe uploaded file format is not supportedCheck the supported file formats in the Upload documentation.
429 Rate limit exceededToo many requests in a short timeImplement retry logic with exponential backoff. See Rate Limit for details.
500 Internal server errorServer-side issueRetry after a few seconds. If persistent, contact support@memories.ai.

Notes

  • The msg field provides a human-readable description of the request result.
  • The data field contains the response payload when the request succeeds.
  • When an error occurs, data will usually be null.
  • Clients should handle errors based on the returned status code.