Creating a new document
Creating a new document will always be the starting point of any signing journey. This is done by sending an API request to
https://{host}/api/v2/documents/new
Click here to read more in our API documentation
which, if successful, will respond with the metadata of the created document.
You may also create a document from template by instead using
https://{host}/api/v2/newfromtemplate/{template_id}
Click here to read more in our API documentation
which will respond with metadata based on the template you are creating the document from.
You may also include a PDF as you are creating the document. This will apply the supplied PDF file as the main file. This is done by including a parameter named “file” and setting the value to the PDF file you wish to upload. Please note that the maximum size of a PDF file is 10MB.
To get started, see the code examples below which may help you.
Python
import requests
url = "https://api-testbed.scrive.com/api/v2/documents/new"
payload={}
headers = {
'Authorization': 'oauth_signature_method="PLAINTEXT", oauth_consumer_key="YOUR_TOKEN", oauth_token="YOUR_TOKEN", oauth_signature="YOUR_TOKEN&YOUR_TOKEN"',
'Cookie': 'lang="en"; lang-ssn="en"'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
C#
var client = new RestClient("https://api-testbed.scrive.com/api/v2/documents/new");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "oauth_signature_method=\"PLAINTEXT\", oauth_consumer_key=\"YOUR_TOKEN\", oauth_token=\"YOUR_TOKEN\", oauth_signature=\"YOUR_TOKEN&YOUR_TOKEN\"");
request.AddHeader("Cookie", "lang=\"en\"; lang-ssn=\"en\"");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
JavaScript
var myHeaders = new Headers();
myHeaders.append("Authorization", "oauth_signature_method=\"PLAINTEXT\", oauth_consumer_key=\"YOUR_TOKEN\", oauth_token=\"YOUR_TOKEN\", oauth_signature=\"YOUR_TOKEN&YOUR_TOKEN\"");
myHeaders.append("Cookie", "lang=\"en\"; lang-ssn=\"en\"");
var requestOptions = {
method: 'POST',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api-testbed.scrive.com/api/v2/documents/new", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
PHP
<?php
$client = new http\Client;
$request = new http\Client\Request;
$request->setRequestUrl('https://api-testbed.scrive.com/api/v2/documents/new');
$request->setRequestMethod('POST');
$request->setOptions(array());
$request->setHeaders(array(
'Authorization' => 'oauth_signature_method="PLAINTEXT", oauth_consumer_key="YOUR_TOKEN", oauth_token="YOUR_TOKEN", oauth_signature="YOUR_TOKEN&YOUR_TOKEN"',
'Cookie' => 'lang="en"; lang-ssn="en"'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();