# Base64 Transcode — strict, both alphabets, per-item errors

> Encodes and decodes base64 in either alphabet. Decoding is strict: input that is not well-formed base64 is refused with a reason and a position, instead of being silently repaired into bytes you did not send.

- Called as: `text.base64.transcode`
- Availability: Callable on Apify Store: https://apify.com/telyvar/text-base64-transcode
- Version: 0.1.0
- Page: https://telyvar.com/c/text-base64/

## What it accepts

One direction, one alphabet, and the strings to transcode. Every item gets its own result: a bad item is reported and not billed, and it does not stop the ones after it.

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `direction` | string | yes | Encode turns text into base64. Decode turns base64 back into text, and refuses anything that is not well-formed. One of: encode, decode. |
| `alphabet` | string | yes | Standard uses + and / and pads with =. URL-safe uses - and _ and no padding, which is what makes the value usable in a query string or a filename. Decoding refuses the other alphabet's characters, so a mismatch is an error rather than a surprise. One of: standard, url-safe. |
| `items` | array (max 2,000) | yes | The strings to transcode, in order. Results carry the index they came from. At most 2,000 per call: at 50 ms an item that is 102 seconds, inside the platform's hard 300-second window for a synchronous call. A larger job is several calls, which is deliberate. |

## Example input

```json
{
  "direction": "decode",
  "alphabet": "standard",
  "items": [
    "VGVseXZhcg==",
    "VGVseXZhc$==",
    "VGVseXZhcg="
  ]
}
```

## What comes back

One row per item, in the order they were given, each carrying the index it came from. A row for an item that failed is written too, with the rule it broke and where.

| Field | Type | Always present |
| --- | --- | --- |
| `index` | integer | yes |
| `ok` | boolean | yes |
| `value` | string | no |
| `reason` | string | no |
| `detail` | string | no |

## Example output

What this capability really returns for the example input above. It is not written by hand: the capability's own test re-runs it and fails if this disagrees.

```json
{
  "results": [
    {
      "index": 0,
      "ok": true,
      "value": "Telyvar"
    },
    {
      "index": 1,
      "ok": false,
      "reason": "illegal-character",
      "detail": "position 9 is not a character of the standard alphabet"
    },
    {
      "index": 2,
      "ok": false,
      "reason": "bad-padding",
      "detail": "1 padding character does not complete a group of 10"
    }
  ],
  "report": {
    "delivered": 3,
    "succeeded": 1,
    "failed": 2,
    "notAttempted": 0,
    "stoppedEarly": false
  }
}
```

## What it costs

- $0.001 per call, charged when the run opens
- $0.0002 per item delivered
- An item that fails is not billed, and one bad item does not stop the ones after it
- A call of 100 items therefore costs $0.021

## What would end it

Either the channel absorbs it as a free built-in function, or monthly revenue falls below the cost of keeping it running for two months in a row. Neither is a prediction: both are thresholds checked at every review.

Written before it happens, on purpose.

---

Telyvar — https://telyvar.com/ · How to call one: https://telyvar.com/docs.md · Prices: https://telyvar.com/pricing.md
