Technical guides and API references for integrating with DocumentsScanned
Welcome to the DocumentsScanned API. This guide will help you get started with integrating our digital document signing services into your application.
Before you begin, you'll need:
All API requests should be made to the following base URL:
https://api.documentsscanned.com/v1/
Rate limits vary by plan:
If you exceed these limits, the API will return a 429 Too Many Requests response.
All API requests require authentication using your API key.
Include your API key in the request headers:
GET /v1/documents HTTP/1.1
Host: api.documentsscanned.com
X-API-Key: your_api_key_here
Content-Type: application/json
Replace your_api_key_here with your actual API key.
Explore our API endpoints and learn how to integrate with our services.
POST /v1/documents
Upload a new document for signing.
{
"name": "Contract Agreement",
"file_content": "base64_encoded_file_content",
"file_type": "pdf",
"signers": [
{
"email": "signer1@example.com",
"name": "John Doe",
"role": "Client"
},
{
"email": "signer2@example.com",
"name": "Jane Smith",
"role": "Agent"
}
],
"signature_fields": [
{
"signer_index": 0,
"page": 1,
"x": 100,
"y": 100,
"width": 200,
"height": 50
},
{
"signer_index": 1,
"page": 1,
"x": 100,
"y": 200,
"width": 200,
"height": 50
}
]
}
{
"document_id": "doc_123abc456def",
"status": "created",
"signing_url": "https://sign.documentsscanned.com/doc_123abc456def",
"signers": [
{
"signer_id": "sgr_123abc",
"email": "signer1@example.com",
"status": "pending"
},
{
"signer_id": "sgr_456def",
"email": "signer2@example.com",
"status": "pending"
}
],
"created_at": "2023-07-15T14:30:00Z",
"expires_at": "2023-08-15T14:30:00Z"
}
GET /v1/documents
Retrieve a list of all documents.
{
"documents": [
{
"document_id": "doc_123abc456def",
"name": "Contract Agreement",
"status": "in_progress",
"created_at": "2023-07-15T14:30:00Z"
},
{
"document_id": "doc_789ghi101jkl",
"name": "NDA Document",
"status": "completed",
"created_at": "2023-07-10T09:15:00Z"
}
],
"total": 2,
"page": 1,
"page_size": 10
}
GET /v1/documents/{document_id}
Retrieve details of a specific document.
{
"document_id": "doc_123abc456def",
"name": "Contract Agreement",
"status": "in_progress",
"file_type": "pdf",
"signers": [
{
"signer_id": "sgr_123abc",
"email": "signer1@example.com",
"name": "John Doe",
"status": "signed",
"signed_at": "2023-07-15T15:45:00Z"
},
{
"signer_id": "sgr_456def",
"email": "signer2@example.com",
"name": "Jane Smith",
"status": "pending"
}
],
"created_at": "2023-07-15T14:30:00Z",
"expires_at": "2023-08-15T14:30:00Z"
}
| Endpoint | Method | Description |
|---|---|---|
/v1/documents/{document_id}/download |
GET | Download a signed document |
/v1/documents/{document_id}/cancel |
POST | Cancel a document signing process |
/v1/documents/{document_id}/remind |
POST | Send a reminder to pending signers |
/v1/templates |
GET | List available document templates |
/v1/templates/{template_id}/use |
POST | Create a document from a template |
For complete API documentation, download our API Reference PDF.
Get real-time notifications about document events using webhooks.
Configure webhook endpoints in your DocumentsScanned dashboard. We'll send HTTP POST notifications to your endpoint whenever specified events occur.
{
"event_type": "document.signed",
"document_id": "doc_123abc456def",
"signer_id": "sgr_123abc",
"signer_email": "signer1@example.com",
"timestamp": "2023-07-15T15:45:00Z"
}
document.created - Document createddocument.viewed - Document viewed by signerdocument.signed - Document signed by a signerdocument.completed - Document signed by all signersdocument.declined - Document declined by signerdocument.expired - Document signing period expiredUse our official client libraries to integrate more easily.
Our PHP client library for easy integration.
composer require documentsscanned/php-sdk
Our JavaScript client library for Node.js applications.
npm install documentsscanned-sdk
Our Python client library for easy integration.
pip install documentsscanned
Our Java client library for enterprise applications.
implementation 'com.documentsscanned:sdk:1.0.0'
Here are some code examples to help you get started with our API.
<?php
// Using the DocumentsScanned PHP SDK
require 'vendor/autoload.php';
use DocumentsScanned\Client;
use DocumentsScanned\Document;
// Initialize the client with your API key
$client = new Client('your_api_key_here');
// Prepare document data
$documentData = [
'name' => 'Contract Agreement',
'file_path' => '/path/to/your/document.pdf',
'signers' => [
[
'email' => 'signer1@example.com',
'name' => 'John Doe',
'role' => 'Client'
],
[
'email' => 'signer2@example.com',
'name' => 'Jane Smith',
'role' => 'Agent'
]
],
'signature_fields' => [
[
'signer_index' => 0,
'page' => 1,
'x' => 100,
'y' => 100,
'width' => 200,
'height' => 50
],
[
'signer_index' => 1,
'page' => 1,
'x' => 100,
'y' => 200,
'width' => 200,
'height' => 50
]
]
];
try {
// Create the document
$document = $client->documents->create($documentData);
// Get the document ID and signing URL
$documentId = $document->id;
$signingUrl = $document->signing_url;
echo "Document created with ID: $documentId\n";
echo "Signing URL: $signingUrl\n";
} catch (\Exception $e) {
echo "Error: " . $e->getMessage();
}
?>
// Using the DocumentsScanned JavaScript SDK
const DocumentsScanned = require('documentsscanned-sdk');
const fs = require('fs');
// Initialize the client with your API key
const client = new DocumentsScanned('your_api_key_here');
// Read the file content and encode as base64
const filePath = '/path/to/your/document.pdf';
const fileContent = fs.readFileSync(filePath);
const base64File = fileContent.toString('base64');
// Prepare document data
const documentData = {
name: 'Contract Agreement',
file_content: base64File,
file_type: 'pdf',
signers: [
{
email: 'signer1@example.com',
name: 'John Doe',
role: 'Client'
},
{
email: 'signer2@example.com',
name: 'Jane Smith',
role: 'Agent'
}
],
signature_fields: [
{
signer_index: 0,
page: 1,
x: 100,
y: 100,
width: 200,
height: 50
},
{
signer_index: 1,
page: 1,
x: 100,
y: 200,
width:.200,
height: 50
}
]
};
// Create the document
client.documents.create(documentData)
.then(document => {
console.log(`Document created with ID: ${document.document_id}`);
console.log(`Signing URL: ${document.signing_url}`);
})
.catch(error => {
console.error('Error:', error.message);
});
# Using the DocumentsScanned Python SDK
import documentsscanned
import base64
# Initialize the client with your API key
client = documentsscanned.Client('your_api_key_here')
# Read the file content and encode as base64
file_path = '/path/to/your/document.pdf'
with open(file_path, 'rb') as file:
file_content = file.read()
base64_file = base64.b64encode(file_content).decode('utf-8')
# Prepare document data
document_data = {
'name': 'Contract Agreement',
'file_content': base64_file,
'file_type': 'pdf',
'signers': [
{
'email': 'signer1@example.com',
'name': 'John Doe',
'role': 'Client'
},
{
'email': 'signer2@example.com',
'name': 'Jane Smith',
'role': 'Agent'
}
],
'signature_fields': [
{
'signer_index': 0,
'page': 1,
'x': 100,
'y': 100,
'width': 200,
'height': 50
},
{
'signer_index': 1,
'page': 1,
'x': 100,
'y': 200,
'width': 200,
'height': 50
}
]
}
try:
# Create the document
document = client.documents.create(document_data)
# Get the document ID and signing URL
document_id = document.document_id
signing_url = document.signing_url
print(f"Document created with ID: {document_id}")
print(f"Signing URL: {signing_url}")
except Exception as e:
print(f"Error: {str(e)}")
Common questions about using our API.
X-DocumentsScanned-Signature header. This signature is created using HMAC-SHA256 with your webhook secret as the key and the request body as the message. You should compute this signature on your server and compare it with the one in the header to verify the webhook came from DocumentsScanned.
https://sandbox-api.documentsscanned.com/v1/ for your test requests. You'll need a separate sandbox API key, which you can generate in your account dashboard under the Developer section.
Sign up for an account to get your API key and start developing.