Welcome to the SwiftDocSign.com Digital Document Signing API documentation. This guide will help you get started with integrating our document signing solution into your applications.
Before you begin, you'll need:
The SwiftDocSign.com API is organized around REST. Our API accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.
https://api.SwiftDocSign.com/v1
All requests should include the following headers:
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY
All responses are returned in JSON format:
{
"status": "success",
"data": {
}
}
The SwiftDocSign.com API uses API keys to authenticate requests. You can view and manage your API keys in your account dashboard.
Pass your API key in the Authorization header using the Bearer scheme:
curl -X GET https://api.SwiftDocSign.com/v1/documents \
-H "Authorization: Bearer YOUR_API_KEY"
The Documents endpoint allows you to create, retrieve, and manage document signing requests.
To create a new document for signing:
curl -X POST https://api.SwiftDocSign.com/v1/documents \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Sales Contract",
"description": "Contract for the sale of goods",
"file_base64": "JVBERi0xLjMKJcTl8uXrp/...", // Base64 encoded PDF
"signers": [
{
"email": "[email protected]",
"name": "John Doe",
"role": "Buyer"
},
{
"email": "[email protected]",
"name": "Jane Smith",
"role": "Seller"
}
]
}'
To retrieve a list of all documents:
curl -X GET https://api.SwiftDocSign.com/v1/documents \
-H "Authorization: Bearer YOUR_API_KEY"
To check the status of a specific document:
curl -X GET https://api.SwiftDocSign.com/v1/documents/{document_id} \
-H "Authorization: Bearer YOUR_API_KEY"
Templates allow you to reuse document structures and signing workflows.
curl -X POST https://api.SwiftDocSign.com/v1/templates \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "NDA Template",
"description": "Standard non-disclosure agreement",
"file_base64": "JVBERi0xLjMKJcTl8uXrp/...", // Base64 encoded PDF
"fields": [
{
"type": "signature",
"page": 1,
"x": 100,
"y": 200,
"width": 150,
"height": 50,
"role": "Signer"
},
{
"type": "date",
"page": 1,
"x": 300,
"y": 200,
"width": 150,
"height": 30,
"role": "Signer"
}
]
}'
To create a document from a template:
curl -X POST https://api.SwiftDocSign.com/v1/documents/from_template \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"template_id": "template_123456",
"title": "NDA with ABC Corp",
"signers": [
{
"email": "[email protected]",
"name": "John Doe",
"role": "Signer"
}
]
}'
The Signatures API provides methods for retrieving and verifying signature information.
curl -X GET https://api.SwiftDocSign.com/v1/signatures/{signature_id}/verify \
-H "Authorization: Bearer YOUR_API_KEY"
Response example:
{
"status": "success",
"data": {
"valid": true,
"signer": {
"name": "John Doe",
"email": "[email protected]"
},
"signed_at": "2023-08-15T10:30:45Z",
"ip_address": "192.168.1.1",
"verification_method": "email"
}
}
Webhooks allow you to receive real-time notifications when events happen in your SwiftDocSign.com account.
curl -X POST https://api.SwiftDocSign.com/v1/webhooks \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-app.com/webhook-handler",
"events": ["document.created", "document.signed", "document.completed"]
}'
{
"event": "document.signed",
"created_at": "2023-08-15T14:22:10Z",
"data": {
"document_id": "doc_123456",
"document_title": "Sales Contract",
"signer": {
"email": "[email protected]",
"name": "John Doe"
},
"signed_at": "2023-08-15T14:22:05Z"
}
}
The SwiftDocSign.com API uses conventional HTTP response codes to indicate the success or failure of an API request.
{
"status": "error",
"code": "invalid_request",
"message": "The request was unacceptable, often due to missing a required parameter.",
"details": {
"missing_field": "signers"
}
}
Here are some example implementations in popular programming languages.
// Create a document for signing
$apiKey = 'YOUR_API_KEY';
$url = 'https://api.SwiftDocSign.com/v1/documents';
$data = [
'title' => 'Sales Contract',
'description' => 'Contract for the sale of goods',
'file_base64' => base64_encode(file_get_contents('contract.pdf')),
'signers' => [
[
'email' => '[email protected]',
'name' => 'John Doe',
'role' => 'Buyer'
],
[
'email' => '[email protected]',
'name' => 'Jane Smith',
'role' => 'Seller'
]
]
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
$result = json_decode($response, true);
curl_close($ch);
print_r($result);
// Create a document for signing
const apiKey = 'YOUR_API_KEY';
const url = 'https://api.SwiftDocSign.com/v1/documents';
function fileToBase64(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => {
const base64String = reader.result.split(',')[1];
resolve(base64String);
};
reader.onerror = error => reject(error);
});
}
const fileInput = document.getElementById('fileInput');
const file = fileInput.files[0];
fileToBase64(file)
.then(fileBase64 => {
const data = {
title: 'Sales Contract',
description: 'Contract for the sale of goods',
file_base64: fileBase64,
signers: [
{
email: '[email protected]',
name: 'John Doe',
role: 'Buyer'
},
{
email: '[email protected]',
name: 'Jane Smith',
role: 'Seller'
}
]
};
return fetch(url, {
method: 'POST',
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
});
})
.then(response => response.json())
.then(result => {
console.log('Success:', result);
})
.catch(error => {
console.error('Error:', error);
});
import requests
import base64
# Create a document for signing
api_key = 'YOUR_API_KEY'
url = 'https://api.SwiftDocSign.com/v1/documents'
# Read the file and convert to base64
with open('contract.pdf', 'rb') as file:
file_base64 = base64.b64encode(file.read()).decode('utf-8')
data = {
'title': 'Sales Contract',
'description': 'Contract for the sale of goods',
'file_base64': file_base64,
'signers': [
{
'email': '[email protected]',
'name': 'John Doe',
'role': 'Buyer'
},
{
'email': '[email protected]',
'name': 'Jane Smith',
'role': 'Seller'
}
]
}
headers = {
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json'
}
response = requests.post(url, json=data, headers=headers)
result = response.json()
print(result)
Our support team is ready to assist you with any questions about our API.