API reference

Split

Cut a text into whole items: emails, clauses, messages, entries. Every item is an exact slice of what you sent.

POST/v1/split

Base URL https://api.wity.alphanimble.com. Same authentication as decisions: Authorization: Bearer wity_…. For what split is for and the split-then-decide pattern, see Split.

Request body#

text
stringrequired
The document. 1 to 60,000 characters, plain text.
split
string | object
What one item is. Default "one item per paragraph". Either plain words (3 to 300 characters, e.g. "one item per email") or a split spec object, below. sentence, line, log, bullet / list item, speaker turn and paragraph are cut by rule; any other unit is read by the model.
split.unit
stringrequired
In a spec: what one item is, 2 to 80 characters ("email", "clause").
split.starts_at
string[]
In a spec: what a new item starts with. Up to 8 entries of up to 300 characters.
split.keep_together
string[]
In a spec: what stays inside one item. Up to 8.
split.never_split
string[]
In a spec: where an item never starts. Up to 8.
skill
string
Instead of split: a split skill's name or id. It splits the way its examples do; see Teach it your format. Give split or skill, not both.

Example#

curl https://api.wity.alphanimble.com/v1/split \
-H "Authorization: Bearer $WITY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "1. Term. This Agreement starts on the Effective Date...\n\n2. Renewal. This Agreement renews automatically...\n\n3. Fees. Customer shall pay...",
"split": { "unit": "clause", "starts_at": ["a numbered clause heading like 4. Liability."] }
}'

Response#

{
"items": [
{ "start": 0, "end": 112, "text": "1. Term. This Agreement starts on the Effective Date..." },
{ "start": 114, "end": 241, "text": "2. Renewal. This Agreement renews automatically..." },
{ "start": 243, "end": 380, "text": "3. Fees. Customer shall pay..." }
],
"how": "model",
"timing_ms": { "total": 84 },
"usage": { "input_tokens": 1412, "output_tokens": 0 }
}
items
array
Every item in document order. text is exactly text[start:end] of your input (character offsets, end exclusive), with surrounding whitespace trimmed. Together the items cover all of the document but the whitespace between them.
how
string
model, or rule:<kind> when the unit was cut by rule (rule:sentence, rule:line, …).
skill
object
With skill only: id, name, the version that split, answered_by (examples once it has learned from them and beats the plain instruction, else question) and active.
timing_ms.total
number
Time spent on the server.
usage
object
input_tokens is billed at $0.042 per million: about the text's tokens plus a few hundred (long texts are read in overlapping windows, up to about twice). output_tokens is always 0.

Errors#

400
invalid
Empty text, text over 60,000 characters, a split string outside 3 to 300 characters, a spec without unit or with too many entries, or both split and skill. The body says which.
404
not_found
No skill by that name or id in your account.
401
auth
Missing or unknown key.
402
credit
Your balance is zero. See Errors, limits & billing.
429
busy
Your key's rate limit, or too many splits in progress on the server. Retry after Retry-After seconds.

Note

Splits share capacity with decisions; long documents take longer. Use a client timeout of at least two minutes.

Previous

← Generate: POST /v1/generate

Next

Skills: /v1/skills →