Generate Summary API Documentation
Why Use This API?
This API allows you to generate concise summaries of large text inputs, which is invaluable for creating abstracts, overviews, or synopses. By extracting key information, it enhances readability and saves time for your audience. Additionally, it provides SEO-friendly meta keywords, improving your content's discoverability on search engines.
Technical Details
The API is located at https://clusterify.ai/api/generate-summary
and accepts a POST request.
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
prompt | string | Yes | The text content to be summarized (minimum 100 characters, maximum 5000 characters). |
length | string | No | Desired length of the summary: short , medium , or long .medium . |
Response
The API returns a JSON object containing the generated summary and up to 8 meta keywords extracted from the content.
{
"summary": "This is the AI-generated summary...",
"keywords": "keyword1, keyword2, keyword3, ..."
}
Authentication
You need a JWT token to authenticate. Use the login API to get your token. Here’s an example with CURL:
curl -X POST https://clusterify.ai/api/login \
-H "Content-Type: application/json" \
-d '{"public_key": "your_public_key", "secret_key": "your_secret_key"}'
This call returns a JWT token to use for authentication in the API request.
Example API Call Using CURL
curl -X POST https://clusterify.ai/api/generate-summary \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your_token" \
-d '{
"prompt": "Your lengthy text content goes here...",
"length": "medium"
}'
Example API Call Using Python
import requests
url = "https://clusterify.ai/api/generate-summary"
headers = {
"Authorization": "Bearer your_token",
"Content-Type": "application/json"
}
data = {
"prompt": "Your lengthy text content goes here...",
"length": "medium"
}
response = requests.post(url, json=data, headers=headers)
print(response.json())
Example API Call Using Next.js (Fetch)
async function generateSummary() {
const res = await fetch('https://clusterify.ai/api/generate-summary', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer your_token',
},
body: JSON.stringify({
prompt: 'Your lengthy text content goes here...',
length: 'medium',
}),
});
const data = await res.json();
console.log(data);
}
Example API Call Using PHP
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://clusterify.ai/api/generate-summary");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Authorization: Bearer your_token",
"Content-Type: application/json"
));
$data = json_encode([
"prompt" => "Your lengthy text content goes here...",
"length" => "medium"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>