---
title: "Wrap a line for display"
method: POST
path: "/v1/wrap"
tags: ["Directionality"]
---

# Wrap a line for display

`POST /v1/wrap`

## Request

- Base URL: `https://hc.itsbaba.com`
- URL: `https://hc.itsbaba.com/v1/wrap`
- Auth: HTTP bearer

Render-ready bidirectional output for one display line. Every left-to-right unit (a Latin term, a price, a number with its unit, a range such as "10–20%", a date, a percentage, a comparison such as "<5") is kept whole and in order, so no digit, range or sign is reversed or mirrored inside a Hebrew line.

Pick `format` for the surface: `html` for the web, React and webviews; `isolate` (Unicode isolates) for iOS, Android 7+ and current browsers; `marks` (LRM/RLM) for older Android, embedded displays and any renderer you cannot test. Pass `base: "rtl"` for a Hebrew line even when it starts with a Latin term.

**Quota.** Deterministic, no model. Does not consume the character quota. Fast enough to call per line at render time.

**Limits.** `text` up to 20,000 characters. Idempotent.

## Request body

- WrapRequest
  - `text` string, required: The display line, up to 20,000 characters.
  - `format` 'html' | 'isolate' | 'marks': `html` for the web; `isolate` (Unicode isolates) for modern text engines; `marks` (LRM/RLM) for every renderer, including older Android.
  - `base` 'auto' | 'ltr' | 'rtl': Paragraph direction of the display surface. Pass `rtl` for a Hebrew line even when it starts with a Latin term.

## Response `200`

Wrapped output

- WrapResponse
  - `dir` 'ltr' | 'rtl', required: Paragraph direction used.
  - `format` string, required: Format used.
  - `output` string, required: Render-ready text: HTML with `dir` spans, or the text with Unicode isolates or direction marks inserted.
  - `runs` DirectionRun[], required: The display runs the output was built from.
    - `text` string, required: The run text. Equals `input.slice(start, end)`.
    - `dir` 'ltr' | 'rtl', required: Resolved direction of the run.
    - `script` string, required: ISO 15924 script of the run: `Hebr`, `Latn`, `Cyrl`, `Arab`, or `Zyyy` for digits and punctuation only.
    - `lang` string, required: Best-effort BCP 47 language of the run, from its script. `und` when undetermined (numbers, symbols).
    - `start` integer, required: UTF-16 offset of the first character, inclusive.
    - `end` integer, required: UTF-16 offset after the last character, exclusive.

## Other responses

- `400`: Invalid request: the body failed validation or a value is out of range.
- `401`: Missing, malformed, invalid or revoked API key.
- `402`: A new self-serve account must save a card in the console before it can use the API. Adding a card is free.
- `403`: The connection used TLS older than 1.2.
- `429`: Too many requests this minute. Retry after a short wait.
- `500`: Unexpected server error. Safe to retry.

---

[API](https://skmtc.dev/itsbaba/apis/hebrewcore-api.md) · [All operations](https://skmtc.dev/itsbaba/apis/hebrewcore-api/llms.txt) · [OpenAPI document](https://skmtc.dev/itsbaba/apis/hebrewcore-api/revisions/f54229695236?raw)
