v1.0 · Live

API Reference

A simple, powerful REST API to summarize any text in seconds. Supports 10+ languages, multiple output styles, and real-time streaming.

Overview

SummarizeAPI provides a single HTTP endpoint that accepts raw text and returns a concise, high-quality summary. The API is designed to be minimal and predictable — one endpoint, JSON in, JSON out.

Base URL

Base URL https://summarizeapi.com/api

Key capabilities

Authentication

All requests must include a valid API key in the Authorization header using the Bearer scheme.

HTTP Header
Authorization: Bearer YOUR_API_KEY
🔑
Get your API key Create a free account at summarizeapi.com/signup — your API key is available immediately in the dashboard. Free tier includes 100 requests/month with no credit card required.

API key format

API keys follow the format sk_live_xxxxxxxxxxxxxxxxxxxxxxxx (production) or sk_test_xxxxxxxxxxxxxxxxxxxxxxxx (test environment). Keep your key secret — treat it like a password.

Quick Start

Send a POST request to /api/summarize with your text. You'll get a summary back in under 10 seconds.

# Install: curl is available on all platforms

curl -X POST https://summarizeapi.com/api/summarize \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "Your text here..."}'
const summarize = async (text) => {
  const res = await fetch('https://summarizeapi.com/api/summarize', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ text })
  });
  const data = await res.json();
  console.log(data.summary);
};

summarize('Your text here...');
import requests

response = requests.post(
    "https://summarizeapi.com/api/summarize",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={"text": "Your text here..."}
)

data = response.json()
print(data["summary"])
<?php
$response = file_get_contents('https://summarizeapi.com/api/summarize', false,
    stream_context_create(['http' => [
        'method'  => 'POST',
        'header'  => "Authorization: Bearer YOUR_API_KEY\r\nContent-Type: application/json",
        'content' => json_encode(['text' => 'Your text here...'])
    ]])
);
$data = json_decode($response, true);
echo $data['summary'];

Example response

JSON Response · 200 OK
{
  "success": true,
  "summary": "A concise summary of your text.",
  "keywords": null,
  "original_length": 1234,
  "summary_length": 287,
  "processing_time": 3.14,
  "requests_remaining": 98
}

Endpoint

The API exposes a single summarization endpoint.

POST /api/summarize

Summarizes the provided text and returns a structured JSON response.

Request headers

HeaderValueRequired
Authorization Bearer YOUR_API_KEY Required
Content-Type application/json Required

Request Parameters

Send a JSON body with the following fields. Only text is required.

ParameterTypeDefaultDescription
text
required
string Text to summarize. Minimum 50 characters, maximum 50,000 characters.
length
optional
string medium Output length.
short — 2–3 sentences
medium — 1 paragraph
long — 2–3 paragraphs
extensive — 4–5 paragraphs
style
optional
string professional Writing style.
professional casual academic technical simple
format
optional
string paragraph Output format.
paragraph — flowing prose
bullets — bullet point list
mixed — short paragraph + key bullets
outputLang
optional
string auto Output language. Use auto to match the source language, or specify:
en fr es de it pt ar zh ja ru
includeKeywords
optional
boolean false When true, extracts 5–7 key terms and returns them in the keywords field.

Full request example

JSON Request Body
{
  "text": "Artificial intelligence is transforming industries...",
  "length": "medium",
  "style": "professional",
  "format": "paragraph",
  "outputLang": "en",
  "includeKeywords": true
}

Response Format

All responses are JSON. A successful request returns HTTP 200.

Success · 200 OK
{
  "success": true,
  "summary": "Generated summary text.",
  "keywords": "AI, machine learning, automation, data, neural networks",
  "original_length": 1842,
  "summary_length": 312,
  "processing_time": 2.85,
  "requests_remaining": 4997
}

Response fields

FieldTypeDescription
successbooleanAlways true on success.
summarystringThe generated summary text.
keywordsstring | nullComma-separated key terms. null when includeKeywords is false.
original_lengthintegerCharacter count of the input text.
summary_lengthintegerCharacter count of the summary.
processing_timefloatRequest duration in seconds.
requests_remainingintegerRemaining requests in the current billing period.

Streaming (SSE)

Append ?stream=1 to receive the summary as a real-time stream of Server-Sent Events. Useful for displaying output progressively in a UI.

ℹ️
NoteThe streaming endpoint uses the same URL and body as the standard endpoint — only the query parameter differs.
POST /api/summarize?stream=1

Event format

The stream emits data: lines. Each chunk has a type field:

typeFieldsDescription
summarycontentIncremental text token. Append these to build the full summary.
donesummaryStream complete. The summary field contains the full text.
errorerrorAn error occurred. The stream will close after this event.

JavaScript streaming example

JavaScript · Fetch + ReadableStream
const streamSummary = async (text, onChunk, onDone) => {
  const res = await fetch('https://summarizeapi.com/api/summarize?stream=1', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ text })
  });

  const reader = res.body.getReader();
  const decoder = new TextDecoder();

  while (true) {
    const { done, value } = await reader.read();
    if (done) break;

    const lines = decoder.decode(value).split('\n');
    for (const line of lines) {
      if (!line.startsWith('data: ')) continue;
      const event = JSON.parse(line.slice(6));
      if (event.type === 'summary') onChunk(event.content);
      if (event.type === 'done')    onDone(event.summary);
    }
  }
};

// Usage
streamSummary(
  'Your text here...',
  chunk => process.stdout.write(chunk),
  full  => console.log('\n\nDone. Full summary:', full)
);

Errors

Error responses include an error field describing what went wrong. HTTP status codes follow standard conventions.

Error Response
{
  "error": "Invalid API key"
}
StatusErrorDescription
400 Invalid parameters Missing text, text too short (<50 chars), or malformed JSON body.
401 Unauthorized Missing, expired, or invalid API key. Check the Authorization header.
405 Method not allowed Only POST requests are accepted.
429 Rate limit exceeded Monthly request quota reached. Upgrade your plan or wait until the next billing period.
500 Server error An unexpected error occurred. Retry with exponential backoff. If the problem persists, contact support.

cURL Examples

Complete examples using curl — available on Linux, macOS, and Windows.

Standard request

cURL
curl -X POST https://summarizeapi.com/api/summarize \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Artificial intelligence is reshaping modern industries. From predictive analytics in finance to computer vision in healthcare, AI applications are becoming integral to business strategy. Natural language processing enables machines to understand and generate human text, while reinforcement learning allows systems to optimize complex decisions through trial and error.",
    "length": "short",
    "style": "professional",
    "format": "paragraph",
    "outputLang": "en",
    "includeKeywords": true
  }'

With streaming

cURL · Streaming
curl -X POST "https://summarizeapi.com/api/summarize?stream=1" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  --no-buffer \
  -d '{"text": "Your long text here..."}'

# Output (streamed):
# data: {"type":"summary","content":"AI is"}
# data: {"type":"summary","content":" transform"}
# ...
# data: {"type":"done","summary":"Full summary text."}
# data: [DONE]

JavaScript Examples

Works in browsers and Node.js (v18+). For Node.js <18, install node-fetch.

class SummarizeAPI {
  constructor(apiKey) {
    this.apiKey = apiKey;
    this.baseURL = 'https://summarizeapi.com/api';
  }

  async summarize(text, options = {}) {
    const res = await fetch(`${this.baseURL}/summarize`, {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${this.apiKey}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({ text, ...options })
    });

    if (!res.ok) {
      const err = await res.json();
      throw new Error(err.error);
    }
    return res.json();
  }
}

// Usage
const client = new SummarizeAPI('YOUR_API_KEY');

const result = await client.summarize(
  'Your long text here...',
  { length: 'medium', style: 'professional', includeKeywords: true }
);

console.log('Summary:', result.summary);
console.log('Keywords:', result.keywords);
console.log('Compression:', Math.round((1 - result.summary_length / result.original_length) * 100) + '%');
// npm install axios
const axios = require('axios');

const client = axios.create({
  baseURL: 'https://summarizeapi.com/api',
  headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
});

async function summarize(text, options = {}) {
  const { data } = await client.post('/summarize', { text, ...options });
  return data;
}

summarize('Your long text here...', { length: 'short' })
  .then(r => console.log(r.summary))
  .catch(e => console.error(e.response?.data?.error));

Python Examples

Requires Python 3.7+ and the requests library (pip install requests).

import requests

class SummarizeAPI:
    BASE_URL = "https://summarizeapi.com/api"

    def __init__(self, api_key: str):
        self.session = requests.Session()
        self.session.headers.update({"Authorization": f"Bearer {api_key}"})

    def summarize(self, text: str, **kwargs) -> dict:
        response = self.session.post(
            f"{self.BASE_URL}/summarize",
            json={"text": text, **kwargs}
        )
        response.raise_for_status()
        return response.json()


# Usage
client = SummarizeAPI("YOUR_API_KEY")

result = client.summarize(
    text="Artificial intelligence is reshaping industries...",
    length="medium",
    style="academic",
    output_lang="en",
    include_keywords=True
)

print(f"Summary: {result['summary']}")
print(f"Keywords: {result['keywords']}")
print(f"Reduced by {100 - round(result['summary_length'] / result['original_length'] * 100)}%")
# pip install httpx
import asyncio
import httpx

async def summarize(api_key: str, text: str, **kwargs) -> dict:
    async with httpx.AsyncClient() as client:
        response = await client.post(
            "https://summarizeapi.com/api/summarize",
            headers={"Authorization": f"Bearer {api_key}"},
            json={"text": text, **kwargs}
        )
        response.raise_for_status()
        return response.json()

# Usage
result = asyncio.run(summarize(
    "YOUR_API_KEY",
    text="Your long text here...",
    length="short"
))
print(result["summary"])

PHP Examples

Works with PHP 7.4+. Uses cURL (enabled by default in most PHP installations).

<?php

class SummarizeAPI {
    private string $apiKey;
    private string $baseUrl = 'https://summarizeapi.com/api';

    public function __construct(string $apiKey) {
        $this->apiKey = $apiKey;
    }

    public function summarize(string $text, array $options = []): array {
        $payload = json_encode(array_merge(['text' => $text], $options));
        $ch = curl_init($this->baseUrl . '/summarize');
        curl_setopt_array($ch, [
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_POST           => true,
            CURLOPT_POSTFIELDS     => $payload,
            CURLOPT_HTTPHEADER     => [
                'Authorization: Bearer ' . $this->apiKey,
                'Content-Type: application/json'
            ],
            CURLOPT_TIMEOUT        => 60
        ]);
        $body     = curl_exec($ch);
        $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        curl_close($ch);

        if ($httpCode !== 200) {
            $err = json_decode($body, true);
            throw new \RuntimeException($err['error'] ?? 'API error');
        }
        return json_decode($body, true);
    }
}

// Usage
$client = new SummarizeAPI('YOUR_API_KEY');

$result = $client->summarize(
    text: 'Artificial intelligence is reshaping industries...',
    options: ['length' => 'medium', 'includeKeywords' => true]
);

echo $result['summary'] . PHP_EOL;
echo $result['keywords'] . PHP_EOL;
<?php
// composer require guzzlehttp/guzzle
use GuzzleHttp\Client;

$client = new Client([
    'base_uri' => 'https://summarizeapi.com/api/',
    'headers'  => ['Authorization' => 'Bearer YOUR_API_KEY']
]);

$response = $client->post('summarize', [
    'json' => [
        'text'           => 'Your long text here...',
        'length'         => 'medium',
        'includeKeywords' => true
    ]
]);

$data = json_decode($response->getBody(), true);
echo $data['summary'];

Rate Limits

Request limits are enforced per calendar month and reset on the 1st of each month.

PlanRequests / monthAPI access
Free 100 Full API access
Professional — €4.99/mo 5,000 Full API access + priority queue
Business — €19/mo Unlimited Full API access + dedicated support + SLA 99.9%

When you exceed your monthly limit, the API returns HTTP 429. The requests_remaining field in every successful response lets you track usage programmatically.

ℹ️
When you exceed your monthly limit, upgrade to a paid plan to continue using the API without interruption.

Changelog

2025-01
v1.0 Latest
  • Initial public release
  • REST API with JSON request/response
  • Real-time SSE streaming
  • 10 output languages
  • 5 writing styles, 4 output formats
  • API key authentication
  • Free tier — 100 requests/month

Have a feature request or found a bug? Contact us — we read every message.