Navigation
POST text

truncate

1 credit

Truncate text to a given length with optional ellipsis

Endpoint

POST /api/v1/tools/text/truncate

Body Parameters

text string required
length integer optional default: 100
ellipsis string optional default: "..."
word_boundary boolean optional default: false

Example

input Request
{
    "text": "The quick brown fox jumps over the lazy dog",
    "length": 20,
    "word_boundary": true
}
output Response
"The quick brown..."

Response Format

HTTP/1.1 200 OK SUCCESS
{
  "success": true,
  "data": "The quick brown...",
  "meta": {
    "tool": "truncate",
    "credits_consumed": 1
  }
}
HTTP/1.1 422 Unprocessable Entity ERROR
{
  "success": false,
  "data": null,
  "error": {
    "code": "validation_error",
    "message": "The given data was invalid."
  }
}

Sign in to try this tool directly from the docs.

Code Examples
Request Example
lightbulb Developer Tip

Credits are deducted before execution. If the upstream tool fails, credits are automatically refunded to your account.