Skip to main content
POST
/
summarization
/
abstractive
Summarize
curl --request POST \
  --url https://api.scaledown.xyz/summarization/abstractive \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "text": "<string>",
  "instructions": "<string>",
  "max_tokens": 20048
}
'
{
  "summary": "<string>",
  "input_chars": 123,
  "output_chars": 123,
  "latency_ms": 123
}

Overview

The /summarization/abstractive endpoint condenses text in the model’s own words without adding new information or commentary. Unlike extractive summarization, the output is a fluent rewrite — not a selection of lifted sentences.

Request

text
string
The input text to summarize. Can be an article, document, transcript, or any plain text string. Either text or document must be provided. If both are given, the OCR text is appended after text.
document
string
A base64-encoded file to summarize. Supported formats: JPEG, PNG, TIFF, single-page PDF, multi-page PDF. The file is processed via AWS Textract OCR and the extracted text is used as input. Either text or document must be provided.
document_mime_type
string
MIME type of the document (e.g. "image/jpeg", "application/pdf"). Required when document is provided.
instructions
string
Optional additional rules for the summary. These are appended to the base instructions — they extend, not replace, the default behaviour (no new information, no commentary).Examples:
  • "Use bullet points."
  • "Focus on financial figures only."
  • "Write in Spanish."
  • "Limit to 3 sentences."
max_tokens
number
default:2048
Maximum number of tokens in the generated summary.

Response

summary
string
The generated summary text.
input_chars
number
Character count of the input text.
output_chars
number
Character count of the generated summary.
latency_ms
number
End-to-end request latency in milliseconds.
ocr_text
string | null
The raw text extracted from the document via OCR. null if no document was provided.

Error responses

StatusMeaning
422 Unprocessable EntityMalformed request body, neither text nor document provided, or OCR failed.
500 Internal Server ErrorInference service unavailable.
504 Gateway TimeoutSummarization request timed out.

Authentication

Include your API key in every request using the x-api-key header.
-H "x-api-key: <your-api-key>"

Examples

Basic summary

curl -X POST https://api.scaledown.xyz/summarization/abstractive \
  -H "Content-Type: application/json" \
  -H "x-api-key: <your-api-key>" \
  -d '{
    "text": "Your long text here..."
  }'
Response:
{
  "summary": "The company reported strong Q3 results, approved a share buyback program, and announced plans for Southeast Asian expansion.",
  "input_chars": 8340,
  "output_chars": 142,
  "latency_ms": 3241
}

With instructions

Use instructions to control format, language, focus area, or length.
curl -X POST https://api.scaledown.xyz/summarization/abstractive \
  -H "Content-Type: application/json" \
  -H "x-api-key: <your-api-key>" \
  -d '{
    "text": "Your long text here...",
    "instructions": "Use bullet points. Focus on dates and key decisions only.",
    "max_tokens": 500
  }'
Response:
{
  "summary": "- The company reported Q3 revenue of $4.2B, up 12% year-over-year.\n- The board approved a $500M share buyback program on October 14.\n- CEO announced plans to expand into Southeast Asia by mid-2027.",
  "input_chars": 8340,
  "output_chars": 198,
  "latency_ms": 3241
}

Summarizing a document

Pass a base64-encoded image or PDF in the document field. The OCR text is extracted automatically and summarized. The raw OCR output is returned as ocr_text.
DOCUMENT=$(base64 -b 0 -i report.pdf)

curl -X POST https://api.scaledown.xyz/summarization/abstractive \
  -H "Content-Type: application/json" \
  -H "x-api-key: <your-api-key>" \
  -d '{
    "document": "'"$DOCUMENT"'",
    "document_mime_type": "application/pdf",
    "instructions": "Use bullet points. Focus on key figures and decisions only."
  }'
Response:
{
  "summary": "- Q3 revenue reached $4.2B, up 12% year-over-year.\n- Board approved a $500M share buyback program.\n- CEO announced Southeast Asian expansion by mid-2027.",
  "input_chars": 12480,
  "output_chars": 178,
  "latency_ms": 4103,
  "ocr_text": "Q3 2024 Earnings Report\nRevenue: $4.2 billion (+12% YoY)\n..."
}

Notes

  • The base instructions (no new information, no commentary) are always applied. The instructions field adds on top of them — it does not replace them.
  • Temperature, top-p, and other sampling parameters are fixed and not configurable via the API.

Authorizations

x-api-key
string
header
required

Body

application/json
text
string
required

The input text to summarize.

instructions
string

Optional additional rules for the summary.

max_tokens
number
default:20048

Maximum number of tokens in the generated summary.

Response

Successful summarization

summary
string
input_chars
number
output_chars
number
latency_ms
number