API Documentation

Text Summarization API

Create concise summaries of longer content with customizable modes and lengths. This endpoint helps you extract key information while maintaining context and readability.

Token Usage

This endpoint consumes tokens from your token balance based on the length of the input text and generated summary.

Learn more about billing

Endpoint Details

Endpoint

POST /api/summarize

Headers

Content-Type: application/json X-API-Key: your_api_key_here

Request Body

{ "text": "Your long text to summarize...", "mode": "general", "length": "short" }
ParameterTypeRequiredDescription
textstringYesThe text to summarize (must be at least 50 characters).
modestringYesThe summarization mode to use (e.g., "general").
lengthstringYesDesired summary length: "short" or "long".

Success Response (200 OK)

{ "id": "summary-id", "originalText": "Original text that was summarized...", "summary": "Summarized version of the text...", "mode": "general", "length": "short", "createdAt": "2023-06-15T10:30:00Z", "wordCount": { "original": 500, "summary": 120 }, "tokensUsed": 350 }

Field Descriptions

Field PathTypeDescription
idstringUnique identifier for the summary.
originalTextstringThe original input text.
summarystringThe generated summary text.
modestringThe summarization mode used.
lengthstringThe summary length setting used.
createdAtstringTimestamp when the summary was generated (ISO 8601).
wordCount.originalnumberWord count of the original text.
wordCount.summarynumberWord count of the generated summary.
tokensUsednumberNumber of tokens consumed by this operation.

Error Responses

Example error for invalid input:

{ "error": "Text must be at least 50 characters long" // Example error }

Refer to the Error Handling section for details on other potential errors.

Code Examples

Use the following examples to integrate the Text Summarization API.

curl -X POST https://your-api-domain.com/api/summarize \ -H "Content-Type: application/json" \ -H "X-API-Key: your_api_key_here" \ -d '{ "text": "Your long text to summarize...", "mode": "general", "length": "short" }'

Input Requirements

The text must be at least 50 characters long to generate a meaningful summary. For best results with the "long" length option, provide detailed text with multiple paragraphs.