# Convert a text into base64 or base64url or URL or HTML encoding

`POST /v1/convert/string/to/{codec}`

Encodes a text as base64, base64url, url_component, url or html entities. base64url can drop the padding on request.

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| codec | one of: base64, base64url, url_component, url, html | yes |  |

## Request body

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| text | string | yes | The text to encode |
| charset | string | no | How characters become bytes for base64 and URL encodings, for example utf-8 or iso-8859-1 (default `"utf-8"`) |
| padding | boolean | no | For base64url: keep the = padding at the end (default `true`) |

## Example request

A request body that works, as JSON.

```json
{
  "text": "License Agreement"
}
```

## Response

The fields inside `data` of a successful response.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| text | string | yes | The result |

## Example response

A real answer from the operation, as JSON. The fields in the table above are inside `data`.

```json
{
  "data": {
    "text": "TGljZW5zZSBBZ3JlZW1lbnQ="
  },
  "errors": null,
  "meta": {
    "request_id": "5e78c811-74db-4e5d-9b8a-b7599301acbb",
    "timestamp": "2026-10-27T07:19:42.048274Z",
    "version": "2026-03-26"
  },
  "pagination": null
}
```

## Responses

| Status | When it happens |
| --- | --- |
| 200 | Successful Response |
| 400 | The body respects the operation schema, but the use case rejected it. Each problem is one ApiError entry |
| 413 | The request is larger than the request size limit of the API allows |
| 422 | The body does not respect the operation schema. Each problem is one ApiError entry with the code validation_error |
| 500 | Something failed inside the server and was not an input problem. The same envelope, errors may be empty |

---
Source: https://skillfulsardine.com/developers/api/encode-text/