---
url: /errors/invalid_text_encoding.md
---
# `INVALID_TEXT_ENCODING`

`INVALID_TEXT_ENCODING`

## Description

The `document` part of the request is declared as `text/plain`, but its bytes are not valid UTF-8. The context decodes a plain text to compute its canonical form: no byte order mark, `LF` line ends, Unicode NFC form.

## HTTP Status

`422 Unprocessable Entity`

## `doc_url` Format

The `doc_url` value is an absolute URL and changes by environment:

`<docs-base-url>/errors/invalid_text_encoding`

## Typical Causes

* The text is encoded in Windows-1252, ISO-8859-1 or UTF-16.
* The file is binary (for example, a Word document) with a `.txt` name.

## Example

Request: `POST /v1/certification/certifications` with a `document` part declared `text/plain` that holds the byte `0xFF`.

Response:

```json
{
  "errors": [
    {
      "code": "INVALID_TEXT_ENCODING",
      "message": "The document is declared as text/plain, but it is not valid UTF-8",
      "doc_url": "https://docs.example.com/errors/invalid_text_encoding"
    }
  ]
}
```

## How To Fix

1. Encode the text in UTF-8.
2. Send the request again with a new idempotency key.
