📄 Text Summarization API Documentation
📌 Overview
The Text Summarization API in GreenMoon AI ToolBox helps you generate concise summaries from long-form text. This API is ideal for tasks like content summarization, document abstraction, and SEO meta description generation. The response includes the generated summary and the summarization method used (e.g., Extractive, Abstractive).
📝 Summarization Methods
- Extractive Summarization: This method selects the most important sentences directly from the original text, preserving their exact wording.
- Abstractive Summarization: This method rewrites the text in a more concise manner, generating new phrases that capture the original meaning.
🛠️ Endpoint
POST https://typhai-nlp-suite.p.rapidapi.com/api/v1/text-summarizations
📥 Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
text | string | ✅ | The input text to summarize. |
method | string | ❌ | The summarization method (Extractive or Abstractive ). |
📤 Response Examples
Extractive Summarization
{
"id": "abc12345-6789-def0-ghij-klmnopqrstuv",
"text": "The stock market is crashing today! Many investors are selling their shares rapidly, leading to a market decline.",
"summary": "The stock market is crashing due to rapid selling.",
"method": "Extractive"
}
Abstractive Summarization
{
"id": "xyz98765-4321-lmno-pqrs-tuvwxyz123456",
"text": "The stock market is crashing today! Many investors are selling their shares rapidly, leading to a market decline.",
"summary": "Investors panic sell, causing stock market downturn.",
"method": "Abstractive"
}
🚀 Usage Examples
1️⃣ cURL Request
curl -X POST "https://typhai-nlp-suite.p.rapidapi.com/api/v1/text-summarizations" \
-H "Content-Type: application/json" \
-H "X-RapidAPI-Host: greenmoon-ai-toolbox.p.rapidapi.com" \
-H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \
-d '{"text": "The stock market is crashing today! Many investors are selling their shares rapidly, leading to a market decline.", "method": "Extractive"}'
2️⃣ Fetch API (JavaScript)
fetch(
"https://typhai-nlp-suite.p.rapidapi.com/api/v1/text-summarizations",
{
method: "POST",
headers: {
"Content-Type": "application/json",
"X-RapidAPI-Host": "greenmoon-ai-toolbox.p.rapidapi.com",
"X-RapidAPI-Key": "YOUR_RAPIDAPI_KEY",
},
body: JSON.stringify({
text: "The stock market is crashing today! Many investors are selling their shares rapidly, leading to a market decline.",
method: "Extractive",
}),
}
)
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error(error));
3️⃣ Axios Request (JavaScript)
import axios from "axios";
const options = {
method: "POST",
url: "https://typhai-nlp-suite.p.rapidapi.com/api/v1/text-summarizations",
headers: {
"Content-Type": "application/json",
"X-RapidAPI-Host": "greenmoon-ai-toolbox.p.rapidapi.com",
"X-RapidAPI-Key": "YOUR_RAPIDAPI_KEY",
},
data: {
text: "The stock market is crashing today! Many investors are selling their shares rapidly, leading to a market decline.",
method: "Extractive",
},
};
axios
.request(options)
.then((response) => console.log(response.data))
.catch((error) => console.error(error));
🎮 Try It Yourself
const TestTextSummarizationAPI = () => {
const [apiKey, setApiKey] = useState("");
const [text, setText] = useState("");
const [method, setMethod] = useState("extractive");
const [response, setResponse] = useState(null);
const [loading, setLoading] = useState(false);
const handleRequest = async () => {
if (!apiKey) {
alert("Please enter your RapidAPI Key.");
return;
}
setLoading(true);
try {
const res = await axios.post(
"https://typhai-nlp-suite.p.rapidapi.com/api/v1/text-summarizations",
{ text, method },
{
headers: {
"Content-Type": "application/json",
"X-RapidAPI-Host":
"greenmoon-ai-toolbox.p.rapidapi.com",
"X-RapidAPI-Key": apiKey,
},
}
);
setResponse(res.data);
} catch (error) {
setResponse(error.message);
}
setLoading(false);
};
return (
<div>
<h3>Test Text Summarization API</h3>
<input
type="text"
placeholder="Enter RapidAPI Key"
value={apiKey}
onChange={(e) => setApiKey(e.target.value)}
/>
<input
type="text"
placeholder="Enter text"
value={text}
onChange={(e) => setText(e.target.value)}
/>
<button onClick={handleRequest} disabled={loading}>
{loading ? "Loading..." : "Send Request"}
</button>
{response && <pre>{JSON.stringify(response, null, 2)}</pre>}
</div>
);
};
📩 Need Help? Visit our FAQ .
🚀 Start summarizing text today with GreenMoon AI ToolBox on RapidAPI!
Last updated on