# Base64 Encode / Decode (`convert.base64`)

Encode UTF-8 text to Base64 or decode Base64 back to text, standard or URL-safe alphabet.

- **Route:** `POST /v1/run/convert.base64`
- **Price:** $0.0002 per request ($0.20 per 1,000) · `cost_usd` on every response
- **Source:** GetAllAPIs compute (`compute`) · failover: no
- **Measured latency:** p50 0 ms · p95 0 ms · p99 0 ms (1 calls, 30d)
- **Heavy response:** no

## Input

| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
| `input` | string | yes |  | Text to encode, or Base64 to decode |
| `action` | string | no | "encode" | What to do |
| `url_safe` | boolean | no | false | Use the URL-safe alphabet (- and _, no padding) |

## Output (`output` in the run envelope)

| Field | Meaning |
|---|---|
| `output` | Encoded or decoded text. |
| `action` | encode or decode. |
| `bytes` | Size of the decoded data in bytes. |
| `is_utf8` | False when decoded bytes are not valid UTF-8 (output is then hex). |

## Example

```bash
curl -s -X POST https://getallapis.com/v1/run/convert.base64 \
  -H "Authorization: Bearer $GETALLAPIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input":"one key, one wallet","action":"encode"}'
```

```python
from getallapis_client import Client
client = Client()  # reads GETALLAPIS_API_KEY
result = client.run('convert.base64', {'input': 'one key, one wallet', 'action': 'encode'})
print(result['cost_usd'], result['output'])
```

```bash
getallapis run convert.base64 '{"input":"one key, one wallet","action":"encode"}'
```

Quote first (free, validates input): `POST /v1/quote/convert.base64` with the same body.
