API Documentation

Getting Started

Article Generator Pro API is accessed by submitting a HTTP POST with parameters to the API URL below.

https://api.articlegeneratorpro.com/api

POST Parameters

Here is a list of parameters that should be included in the post request to the API.

Key Value Description
apikey 16 digit API key API key is available under your account dashboard.
keyword 3 ~ 100 character alphanumeric string with spaces A few keywords, sentences or phrases that you wish to generate content for.
wordcount 50 ~ 1000 integer value The desired number of words for the article.
learndepth 0: Fast - Minimal (Default)
1: Moderate
2: Slow - Maximum
[Optional] Defines how much machine learning should be done before constructing your article, a higher value means better quality and uniqueness but takes more time. Increase the value if the generated article is under the word limit.
unique 0: Off
1: On (Default)
[Optional] Enable to generate different content every time, disable to generate one best piece of article for given keyword.
shuffle 0: Off (Default)
1: On
[Optional] This feature rearranges sentences to create uniqueness but article may no longer make sense.
rewrite 0: Off
1: On (Default)
[Optional] This feature replaces your article with random synonyms, higher ratio means more words will be replaced. Enable this for more uniqueness of article.
rewrite_ratio 1 ~ 100 integer value (Default 40) [Optional] If rewrite is enabled, specify how often the words should be rewritten from 1% to 100%, higher value means more words will be rewritten.
instanceid String [Optional] Provide a instanceid from an API response to re-generate article based on same keywords, providing this value will speed up re-generations significantly.
log 0: Off
1: On (Default)
[Optional] Enable or disable request/response logging which can be viewed from account dashboard.

Response

The API will return data encoded in JSON, an example of successful request:

{
    "result": "The US will start screening at three airports for passengers with the mysterious, novel poison begin in Wuhan........",
    "wordcount": 1530,
    "instanceID": "5e2aa7f45c01a",
    "executionTime": 10.403473854065,
    "computeTime": 10.402873039246,
    "responseID": "7090c0a12fe38f775be9e5feba0f2327",
    "quota": 9979
}

Example of failed request:

{
    "error": {
        "message": "Document not recognized",
        "code": 9
    },
    "executionTime": 0.0062239170074462890625,
    "computeTime": 0.005443096160888671875,
    "responseID": "45ca84e72040fcf060f6f20f76031cd0"
}
Key Description
result Generated article content
wordcount Number of words in generated article
instanceid An unique ID used for re-generating articles on same topic.
executionTime Time taken to upload the documents and compute result.
computeTime Time taken to compute result.
responseID A unique identifier to identify the request/response.
quota Remaining article credits for your account
error This field will only be returned if there was an error, containing the following array:
code
1: Invalid API Key
2: You have exhausted your quota, please purchase more quota.
3: Invalid 'wordcount'. Accepted value: 50 ~ 1000
4: Invalid 'learndepth'. Accepted value: 0, 1, 2
5: Invalid 'rewrite_ratio'. Accepted value: 1 ~ 100
6: Invalid instanceid
7: Invalid 'keyword'. Accepted value: 2 ~ 100 characters
8: No information found for given keyword.
99: Unexpected API error

message: Description of the error encountered.

Code Examples

<?php

$url = 'https://api.articlegeneratorpro.com/api';
$fields = array('keyword' => 'wuhan pneumonia', 'wordcount' => '600', 'apikey' => 'your api key');
$resource = curl_init();
curl_setopt($resource, CURLOPT_URL, $url);
curl_setopt($resource, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($resource, CURLOPT_POST, 1);
curl_setopt($resource, CURLOPT_POSTFIELDS, $fields);
$result = json_decode(curl_exec($resource),true);
curl_close($resource);

if($result['error']==0){
    //success
    print_r($result);
}else{
    //failed
    echo("Error #" . $result['error_code'] . " " . $result['error_message']);
}

?>