Developers are able to implement SMMRY into applications that may require a summarization of a webpage or block of text. Developers will need a SMMRY API key in order to access the API.


To receive an API key, you'll need a Partner account. Firstly get a free account here. Once registered head to the partner page and click upgrade. An API key will be generated automatically.


There are two active modes of the SMMRY API, Free and Full:

Free: A limit of 100 free API requests can be made daily, and each request must be at least 10 seconds apart. If a request was made too soon, the API will wait the required time before fulfilling the request.

Full: An unlimited amount of requests can be made with no artificial time limit in between. 1 credit costs $0.001, or a tenth of a cent. It costs approximately 1 credit per 500 characters returned by the API (only summarized content is counted). It costs an additional 8 credits if the article has not been previously submitted and cached by the algorithm, that way re-summarizing the same article is cheaper. When credit costs are being calculated, decimals are rounded upwards.

You can switch between modes via your Partner account page. (you can also find your API key listed there!)


The API request must be made to The returned response will be encoded in JSON.

Here are the possible parameters placed in the request URL.
• SM_API_KEY=N       // Required, N represents your registered API key.
• SM_URL=X           // Optional, X represents the webpage to summarize.
• SM_LENGTH=N        // Optional, N represents the number of sentences returned, default is 7 
• SM_KEYWORD_COUNT=N // Optional, N represents how many of the top keywords to return
• SM_QUOTE_AVOID     // Optional, summary will not include quotations
• SM_WITH_BREAK      // Optional, summary will contain string [BREAK] between each sentence
Here are the possible indexes of the array returned in a JSON array.
$result = json_decode($response, true);
$result['sm_api_message'];        // Contains notices, warnings, and error messages.
$result['sm_api_character_count'];// Contains the amount of characters returned
$result['sm_api_title'];          // Contains the title when available
$result['sm_api_content'];        // Contains the summary
$result['sm_api_keyword_array'];  // Contains top ranked keywords in descending order
$result['sm_api_error'];          // Contains error code
cURL or an equivalent function/library must either send the article variable as POST data labeled sm_api_input or specify a URL with SM_URL=X. If both are given the latter is used.

The maximum number of sentences returned is 40. When using SM_WITH_BREAK, make sure to replace the [BREAK] strings with whatever you want to seperate each sentence ('/n', '<br>' etc). Also, make sure any webpage URL sent to summarize is accessible to SMMRY, pages requiring authentication won't do.

PHP Example - Summarize Text

Here is an example of PHP using cURL to summarize a block of text:
$long_article = "Long article text goes here";

$ch = curl_init("");
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Expect:")); // Important do not remove
curl_setopt($ch, CURLOPT_POST, true); 
curl_setopt($ch, CURLOPT_POSTFIELDS, "sm_api_input=".$long_article);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
$return = json_decode(curl_exec($ch), true);
Important: The option CURLOPT_HTTPHEADER is important and should not be removed.

You're summary will be stored in $return['sm_api_content'].

PHP Example - Summarize External Webpage

Here is an example of PHP using cURL to summarize an external webpage:
$ch = curl_init("");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,20);
curl_setopt($ch, CURLOPT_TIMEOUT,20);
$return = json_decode(curl_exec($ch), true);
Important: The variable &SM_URL= must always be at the end of the call.

You're summary will be stored in $return['sm_api_content'].

Error Codes
0 - Internal server problem which isn't your fault
1 = Incorrect submission variables
2 - Intentional restriction (low credits/disabled API key/banned API key)
3 - Summarization error


© 2018