> For the complete documentation index, see [llms.txt](https://docs.caf.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.caf.io/caf-sdk/web-javascript/getting-started/document-detector/sdk-builder-options/messages.md).

# Messages

Here is a list of all parameters that are accepted in the **messages** object present in the Document Detector options.

**Enhanced in v6.8.3:** The messages configuration now uses a nested object format for better organization and readability.

{% hint style="warning" %}
The `messages` object is optional. If you don't pass it, the SDK will use the default messages based on the `language` parameter (the default values listed below are for the English language).
{% endhint %}

<table data-header-hidden><thead><tr><th width="468"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Type</strong></td></tr><tr><td><p><strong><code>general</code></strong></p><p>Customization of displayed general messages.</p></td><td><a href="#3az3ijcss0mo">General</a></td></tr><tr><td><p><strong><code>capture</code></strong></p><p>Customization of displayed messages ("manual" and "automatic" capture modes).</p></td><td><a href="#zcoihs13yycj">Capture</a></td></tr><tr><td><p><strong><code>upload</code></strong></p><p>Customization of displayed messages ("upload" capture mode).</p></td><td><a href="#guau2es7dwb3">Upload</a></td></tr></tbody></table>

## Configuration Format <a href="#configuration_format" id="configuration_format"></a>

The messages options use a **nested object format** for better organization:

```javascript
messages: {
  general: {
    wait: "Please wait...",
    errors: {
      poorQuality: "Image quality is too low. Please try again.",
      documentNotFound: "Document not found. Please try again.",
      invalidDocument: "This document is not valid.",
      generic: "Something went wrong. Please try again."
    }
  },
  capture: {
    title: "Capture your document",
    errors: {
      captureFailed: "Capture failed. Please try again."
    }
  },
  upload: {
    title: "Upload your document", // Note: For front/back sides, this becomes "Upload your document - Front" or "Upload your document - Back"
    details: "Please select a document to upload",
    button: "Upload",
    success: "Document uploaded successfully!",
    errors: {
      generic: {
        title: "Upload failed",
        details: "Please try again.",
        button: "Retry"
      },
      invalidFileFormat: {
        title: "Invalid format",
        details: "Please use JPG, PNG or PDF format."
      },
      invalidDocument: {
        title: "Invalid document",
        details: "This document is not valid."
      }
    }
  }
}
```

{% hint style="info" %}
If you're upgrading from a previous version, your existing dot notation configurations (e.g., `"general.wait": "Please wait..."`) will continue to work, but we recommend migrating to the nested object format shown above.
{% endhint %}

## General <a href="#id-3az3ijcss0mo" id="id-3az3ijcss0mo"></a>

<table data-header-hidden><thead><tr><th width="468"></th><th></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Type</strong></td><td><strong>Default Value</strong></td></tr><tr><td><p><strong><code>wait</code></strong></p><p>Loading message.</p><p><strong>Example:</strong> <code>general: { wait: "Please wait..." }</code></p></td><td>string</td><td><code>"Wait..."</code></td></tr><tr><td><p><strong><code>errors.poorQuality</code></strong></p><p>Message displayed when the captured image is with poor quality.</p><p><strong>Example:</strong> <code>general: { errors: { poorQuality: "Quality too low..." } }</code></p></td><td>string</td><td><code>"The quality of the capture was not good. Make sure you are in a bright environment and try again."</code></td></tr><tr><td><p><strong><code>errors.documentNotFound</code></strong></p><p>Message displayed when the document is not found.</p><p><strong>Example:</strong> <code>general: { errors: { documentNotFound: "Document not found..." } }</code></p></td><td>string</td><td><code>"Oops, it seems that this document is not supported."</code></td></tr><tr><td><p><strong><code>errors.invalidDocument</code></strong></p><p>Message displayed when the document is not supported.</p><p>Example: <code>"Oops, this document is not "Front of RG""</code></p><p><strong>Example:</strong> <code>general: { errors: { invalidDocument: "Invalid document..." } }</code></p></td><td>string</td><td><code>"Oops, this document is not "${expectedDocumentLabel}""</code></td></tr><tr><td><p><strong><code>errors.generic</code></strong></p><p>Generic error message.</p><p><strong>Example:</strong> <code>general: { errors: { generic: "Something went wrong..." } }</code></p></td><td>string</td><td><code>"Oops, something went wrong, please try again"</code></td></tr></tbody></table>

## Capture <a href="#zcoihs13yycj" id="zcoihs13yycj"></a>

<table data-header-hidden><thead><tr><th width="468"></th><th></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Type</strong></td><td><strong>Default Value</strong></td></tr><tr><td><p><strong><code>title</code></strong></p><p>Capture title.</p><p><strong>Example:</strong> <code>capture: { title: "Capture your document" }</code></p></td><td>string</td><td>The expected document label (e.g., "Front of RG")</td></tr><tr><td><p><strong><code>errors.captureFailed</code></strong></p><p>Message displayed when the capture fails.</p><p><strong>Example:</strong> <code>capture: { errors: { captureFailed: "Capture failed..." } }</code></p></td><td>string</td><td><code>"Oops! We had a problem processing your image."</code></td></tr></tbody></table>

## Upload <a href="#guau2es7dwb3" id="guau2es7dwb3"></a>

{% hint style="info" %}
**Important Behavior for Upload Titles**: When the SDK is configured to capture specific document sides (front or back), it automatically appends a side suffix to the upload title. For example, if you set `upload.title` to "Upload your document", the actual displayed titles will be:

* **Front side**: "Upload your document - Front"
* **Back side**: "Upload your document - Back"
* **Both sides**: Uses your custom title as-is

This ensures users always know which side of the document they need to upload, even with custom titles.
{% endhint %}

<table data-header-hidden><thead><tr><th width="468"></th><th></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Type</strong></td><td><strong>Default Value</strong></td></tr><tr><td><p><strong><code>title</code></strong></p><p>Customization of upload screen title.</p><p><strong>Important:</strong> When capturing specific document sides (front/back), the SDK automatically appends the side suffix to your custom title (e.g., "Your Custom Title - Front" or "Your Custom Title - Back").</p><p><strong>Example:</strong> <code>upload: { title: "Upload document" }</code></p></td><td>string</td><td><code>"Attach document"</code> (or with side suffix: <code>"Attach document - Front"</code>, <code>"Attach document - Back"</code>)</td></tr><tr><td><p><strong><code>details</code></strong></p><p>Customization of message below the upload screen title.</p><p><strong>Example:</strong> <code>upload: { details: "Select a document..." }</code></p></td><td>string</td><td><code>"Please allow access to your photos and attach your document"</code></td></tr><tr><td><p><strong><code>button</code></strong></p><p>Customization of the upload button text.</p><p><strong>Example:</strong> <code>upload: { button: "Upload" }</code></p></td><td>string</td><td><code>"Select file"</code></td></tr><tr><td><p><strong><code>success</code></strong></p><p>Customization of title displayed on the screen when the file was sent successfully.</p><p><strong>Example:</strong> <code>upload: { success: "Success!" }</code></p></td><td>string</td><td><code>"Photo sent successfully!"</code></td></tr><tr><td><p><strong><code>errors.generic.title</code></strong></p><p>Customization of title displayed on the screen when a generic error occurred in the upload process.</p><p><strong>Example:</strong> <code>upload: { errors: { generic: { title: "Error" } } }</code></p></td><td>string</td><td><code>"Error sending file"</code></td></tr><tr><td><p><strong><code>errors.generic.details</code></strong></p><p>Customization of message below the title displayed on the screen when a generic error occurred in the upload process.</p><p><strong>Example:</strong> <code>upload: { errors: { generic: { details: "Try again..." } } }</code></p></td><td>string</td><td><code>"Oops, something went wrong when sending your file. Please try again."</code></td></tr><tr><td><p><strong><code>errors.generic.button</code></strong></p><p>Customization of button text to perform the upload again.</p><p><strong>Example:</strong> <code>upload: { errors: { generic: { button: "Retry" } } }</code></p></td><td>string</td><td><code>"Try again"</code></td></tr><tr><td><p><strong><code>errors.invalidFileFormat.title</code></strong></p><p>Customization of title displayed on the screen when an error occurred in the format of the sent file.</p><p><strong>Example:</strong> <code>upload: { errors: { invalidFileFormat: { title: "Invalid format" } } }</code></p></td><td>string</td><td><code>"Invalid format"</code></td></tr><tr><td><p><strong><code>errors.invalidFileFormat.details</code></strong></p><p>Customization of message below the title displayed on the screen when an error occurred in the format of the sent file.</p><p><strong>Example:</strong> <code>upload: { errors: { invalidFileFormat: { details: "Use JPG, PNG or PDF" } } }</code></p></td><td>string</td><td><code>"It looks like your photo format is not supported. Try resending using JPG, PNG or PDF formats."</code></td></tr><tr><td><p><strong><code>errors.invalidDocument.title</code></strong></p><p>Customization of title displayed on the screen when an invalid document is sent.</p><p><strong>Example:</strong> <code>upload: { errors: { invalidDocument: { title: "Invalid document" } } }</code></p></td><td>string</td><td><code>"Invalid document"</code></td></tr><tr><td><p><strong><code>errors.invalidDocument.details</code></strong></p><p>Customization of message below the title displayed on the screen when an invalid document is sent.</p><p><strong>Example:</strong> <code>upload: { errors: { invalidDocument: { details: "Document not valid..." } } }</code></p></td><td>string</td><td><code>"Oops, this document is not ..."</code></td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.caf.io/caf-sdk/web-javascript/getting-started/document-detector/sdk-builder-options/messages.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
