# Error codes

The invalid or error API calls have the following response structure:

```
{
    "message": "Failed to send a message because more than 24 hours have passed since the customer last replied",
    "type": "ERROR_TYPE_DEADLINE_EXCEEDED",
    "code": "ERROR_CODE_MESSAGE_OUTSIDE_OF_ELIGIBILITY_WINDOW",
    "userTitle": "Failed to send a message because more than 24 hours have passed since the customer last replied",
    "userMessage": "Pass along the connectly trace id 'cnct_trace_id' to the team for more information.",
    "cntTraceId": "11824978358485860716",
    "details": {}
}
```

* `message` - the description of the error
* `type` - the error type, please see the section [below](https://docs.connectly.ai/message-api/message-service-api/error-codes#error-types) for more details
* `code` - a specific error instance
* `userTitle` - an expanded error description
* `userMessage` - the user instructions for troubleshooting
* `cntTraceId` - Connectly trace ID, used by Connectly engineers for troubleshooting
* `details` - more details

### Error Codes

`ERROR_CODE_INVALID_SENDER_ID` - the phone number is not valid

`ERROR_CODE_PHONE_NUMBER_BAD_FORMAT` - bad phone format number

`ERROR_CODE_MESSAGE_ATTACHMENTS_NUMBER_INVALID` - invalid number of attachments, currently Connectly API supports only one attachment at a time

`ERROR_CODE_MESSAGE_TEXT_EMPTY` - message text is empty

`ERROR_CODE_MESSAGE_TEMPLATE_NOT_FOUND` - the template for the specified name and language does not exist, please create it first

`ERROR_CODE_MESSAGE_TEMPLATE_INPUT_INVALID` - message template inputs are not valid

`ERROR_CODE_MESSAGE_ATTACHMENT_EMPTY` - message attachment URL is empty

`ERROR_CODE_MESSAGE_ATTACHMENT_INVALID` - message attachment URL is invalid and can't be parsed

`ERROR_CODE_BUSINESS_MISSES_MATCHING_CHANNEL` - business is missing sender channel of matching channel type

`ERROR_CODE_MESSAGE_OUTSIDE_OF_ELIGIBILITY_WINDOW` - failed to send a message because more than 24 hours have passed since the customer last replied

`ERROR_CODE_BUSINESS_REACHED_LIMITS` - business reached the restrictions on how many messages can be sent from this channel. Too many previous messages were blocked or flagged as spam

`ERROR_CODE_MESSAGE_SELF_INVALID` - this message type can't be sent to yourself. Please use a different receiver

`ERROR_CODE_MESSAGE_PHONE_NUMBER_INVALID` - phone number is invalid

`ERROR_CODE_MESSAGE_CUSTOMER_OPTED_OUT` - customer opted out of receiving template messages

`ERROR_CODE_MESSAGE_CUSTOMER_NO_CONVERSATION_INITIATION` - you can not use the send message API when the customer has not performed the initial reach out, check out our send templated message API

`ERROR_CODE_BUSINESS_KEY_SECRET_ABSENT` - business API secret is not initialized. Please initialize it or contact Connectly team for more information

`ERROR_CODE_MESSAGE_TEMPLATE_DELETED` - new language content can't be added while the existing language content is being deleted. Try again in 4 weeks or consider creating a new message template

`ERROR_CODE_MESSAGE_TEMPLATE_INVALID_PARAM` - invalid message template parameter is provided, please check that all the template message variables, buttons, and parameters are present and correct

`ERROR_CODE_BUSINESS_RATE_LIMIT_REACHED` - business reached the rate limit

### Error Types

`ERROR_TYPE_UNSPECIFIED` - unexpected error type, please contact the team to understand more.\
`ERROR_TYPE_AUTHENTICATION` - invalid authentication credentials (e.g invalid API key).\
`ERROR_TYPE_AUTHORIZATION` - no authorization found for the resource (e.g API key does not have access to `business_id`).\
`ERROR_TYPE_RATE_LIMIT` - the API rate limit is exceeded, please wait for couple minutes and try again.\
`ERROR_TYPE_INVALID_REQUEST` - the request payload is not valid, please refer to the API documentation and fix the request payload.\
`ERROR_TYPE_DEADLINE_EXCEEDED` - request time out, please contact the team to understand more.\
`ERROR_TYPE_NOT_FOUND` - the requested resource does not exist.\
`ERROR_TYPE_CONFLICT` - the resource already exists and the new one can not be created, please use the update operation instead of create.\
`ERROR_TYPE_CONTEXT_CANCLED` - the client requested the timeout, please check your HTTP client parameters and increase the time-out limit.\
`ERROR_TYPE_BUSINESS_LIMIT` - the business has reached the account limits.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.connectly.ai/message-api/message-service-api/error-codes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
