Error Response

A request is successfully accepted with an HTTP status code of 2xx. Otherwise, it indicates that something goes wrong with an HTTP status code of 4xx or 5xx. Codes in the 5xx range indicate an error with YCloud's servers, while codes in the 4xx range indicate an error caused by clients.
A structured response body is returned when errors occur, here is an example of the response body for errors:

{
  "error": {
    "status": 400,
    "code": "PARAM_INVALID",
    "message": "Parameter 'limit' should be between 1 and 100.",
    "target": "limit",
    "docUrl": "https://example.com/errors#param_invalid"
}

Error Object

status

REQUIRED. The HTTP status code generated by the server for this occurrence of the problem. It conveys the HTTP status code used for the convenience of the consumer.

code

REQUIRED. One of the server-defined error codes. Some 4xx errors that could be handled programmatically include an error code that briefly explains the error reported.

message

A human-readable representation of the error. It is intended as an aid to developers and is not suitable for exposure to end users.

target

The target of the error. It could be the parameter field when a parameter is invalid.

docUrl

A URL to more information about the error.

requestId

Each API request has an associated request ID. It conveys the response header YCloud-Request-ID used for the convenience of the consumer. See also Request ID.

Error Codes

Below is a list of possible error codes, along with additional information about how to resolve them.

ACCOUNT_LIMITED

Some functions of the account are limited due to some reason. For example, trial accounts can only send messages to pre-verified phone numbers, this error code returns when trial accounts try to send to other phone numbers.

ACCOUNT_UNAVAILABLE

The account is unavailable. Contact our customer service for more help.

ALREADY_EXISTS

A resource already exists. Please check your owned resources and your request parameters.

BAD_REQUEST

Bad Request. Something goes wrong with the request parameters.

BALANCE_INSUFFICIENT

The account balance is insufficient. Please top-up.

CONTENT_PROHIBITED

The content is prohibited according to our terms.

CONTENT_TOO_LARGE

The content is too large. Please reduce the request body.

EMAIL_DOMAIN_UNVERIFIED

The email domain is unverified. It may take some minutes to verify the email domain, please wait.

FORBIDDEN

Usually occurs when you try to access a resource that you don't own.

INTERNAL_SERVER_ERROR

Something goes wrong with our servers. These are rare.

NOT_FOUND

The requested resource does not exist.

PARAM_INVALID

One or more of the parameters is invalid.

PARAM_INVALID_LENGTH

The parameter's length is out of range.

PARAM_MISSING

One or more of the parameters is missing.

PARAM_NOT_MATCH

One parameter does not match with another one.

SMS_SIGNATURE_UNAVAILABLE

The specified signature for Chinese Mainland SMS is not available, please check your signatures.

TOO_MANY_REQUESTS

Too many requests hit the API too quickly. We recommend an exponential backoff of your requests.

WHATSAPP_PHONE_UNAVAILABLE

The WhatsApp phone number is unavailable. It occurs when you try to send messages using the wrong phone number.

WHATSAPP_TEMPLATE_UNAVAILABLE

The WhatsApp template is unavailable. It occurs when you try to send template messages when the template does not exist or the template status is not approved.

WHATSAPP_WABA_UNAVAILABLE

The WhatsApp business account is unavailable. It occurs when you try to create a template with the wrong WhatsApp business account ID.