xtract.bot
POST /api/base64-encode

Encode arbitrary bytes as base64 (standard or URL-safe). Optional padding stripping for URL-friendly output.

Encodes any bytes as base64. Two flavours are supported: - `variant: "standard"` (default): standard base64 with `+` and `/` (RFC 4648 §4). - `variant: "urlsafe"`: URL-safe base64 with `-` and `_` (RFC 4648 §5) — safe to drop into URLs without further escaping. Set `padding: false` to strip the trailing `=` characters — the common convention for JWTs and similar URL-embedded tokens.

Inputs

NameTypeDefaultDescription
data*fileBytes to encode (any binary input).
alphabetenum (base64 | base64url)"base64"`base64` (standard) or `base64url` (URL-safe).
omitPaddingbooleanfalseStrip trailing `=` padding.

Response

Modes: json, text. Cache: yes (24h TTL).

Code samples

Built from the hello example.

# Download or substitute the example input:
#   curl -O https://xtract.bot/examples/base64-encode/hello.txt
DATA=$(base64 -w0 < hello.txt)

curl -X POST https://api.xtract.bot/api/base64-encode \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -H "X-Account-Id: $XTRACT_ACCOUNT_ID" \
  -H "X-Api-Key: $XTRACT_API_KEY" \
  -d '{
  "alphabet": "base64",
  "data": "'"$DATA"'"
}'