Everything you need to integrate AI-powered text summarization into your application.
Get started in under 5 minutes:
Sign up for free at /pricing to get your API key instantly.
curl -X POST https://api.textsummarize.io/api/summarize \\
-H "Content-Type: application/json" \\
-H "X-API-Key: your-api-key-here" \\
-d '{
"text": "Your long article or document text here...",
"maxLength": 3
}'
{
"success": true,
"data": {
"original_length": 1250,
"summary_length": 320,
"compression_ratio": 26,
"summary": "The condensed version of your text...",
"sentence_count": 3
},
"usage": {
"used": 1,
"limit": 100,
"remaining": 99
}
}
All API requests require an API key passed in the X-API-Key header.
curl -H "X-API-Key: ts_yourapikey123" ...
Summarize text using AI-powered extractive summarization.
| Header | Value | Required |
|---|---|---|
X-API-Key |
Your API key | Required |
Content-Type |
application/json | Required |
| Parameter | Type | Description | Required |
|---|---|---|---|
text |
string | The text to summarize (50-50,000 characters) | Required |
maxLength |
integer | Maximum number of sentences in summary (1-10, default: 3) | Optional |
minLength |
integer | Minimum number of sentences (default: 1) | Optional |
{
"success": true,
"data": {
"original_length": 1250,
"summary_length": 320,
"compression_ratio": 26,
"summary": "The condensed version of your text...",
"sentence_count": 3
},
"usage": {
"used": 42,
"limit": 10000,
"remaining": 9958
}
}
Check your current API usage and remaining quota.
curl https://api.textsummarize.io/api/usage \\ -H "X-API-Key: ts_yourapikey123"
No authentication required. Check API status.
curl https://api.textsummarize.io/health
The API uses standard HTTP status codes:
| Status | Meaning |
|---|---|
200 |
Success |
400 |
Bad request (invalid input) |
401 |
Unauthorized (missing or invalid API key) |
429 |
Rate limit exceeded (upgrade your plan) |
500 |
Server error |
Error responses include a message:
{
"error": "Usage limit exceeded",
"message": "You have reached your monthly API call limit",
"upgrade": "/pricing"
}
SUMMARIZE_API_KEY in your environment.
const summarize = async (text) => {
const response = await fetch('https://api.textsummarize.io/api/summarize', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': process.env.SUMMARIZE_API_KEY,
},
body: JSON.stringify({ text, maxLength: 3 }),
});
const data = await response.json();
return data.data.summary;
};
import requests
import os
def summarize(text):
response = requests.post(
'https://api.textsummarize.io/api/summarize',
headers={
'Content-Type': 'application/json',
'X-API-Key': os.environ['SUMMARIZE_API_KEY'],
},
json={'text': text, 'maxLength': 3}
)
return response.json()['data']['summary']
<?php
function summarize($text) {
$ch = curl_init('https://api.textsummarize.io/api/summarize');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['text' => $text]));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'X-API-Key: ' . getenv('SUMMARIZE_API_KEY'),
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = json_decode(curl_exec($ch), true);
return $response['data']['summary'];
}
Ready to get started?
View Pricing Plans →