sharepoint online – site page can not be created with JS

I wanted to use JavaScript to create a site page on my Sharepoint site. I use the following code to accomplish this without success.

var fields = {
"__metadata": {# type #: "SP.Data.PagesItem"},
"Title": "Test",
}

jQuery.ajax ({
URL: _spPageContextInfo.webAbsoluteUrl + "/ _api / web / lists / GetByTitle (& # 39; Pages & # 39;) / items",
Method: "POST",
contentType: "application / json; odata = verbose",
Headers: {
"accept": "application / json; odata = verbose",
"X-RequestDigest": document.getElementById ("__ REQUESTDIGEST"). Value,
"content-type": "application / json; odata = verbose"
},
Data: JSON.stringify (fields),
Success: Function (Data) {

console.log ("OK");
},
Error: Function (error) {
console.log ("ERRO");
console.log (JSON.stringify (error));
}
}); 

The problem here is, if I use this to create an item in a list, it works fine, but I get the following error message when I use to create a site page

{"readyState": 4, "responseText": "{" error  ": {" code  ":" - 2146232832, Microsoft.SharePoint.SPException  ", " message  ": {" lang  " :  "en-US ",  "value ":  "To add an item to a document library, use SPFileCollection.Add () "}}} "," responseJSON ": {" error ": {" code ":" - 2146232832, Microsoft.SharePoint.SPException "," message ": {" lang ":" en-US "," value ":" To add an item to a document library, use SPFileCollection.Add (). "} }}, "status": 500, "statusText": "error"}

How can I fix this?
Many Thanks