Comprehensive guides and API references to help you integrate with SignatureMills
Welcome to the SignatureMills documentation. Here you'll find comprehensive guides and documentation to help you start working with SignatureMills as quickly as possible.
SignatureMills provides a powerful API for integrating digital document signing into your applications. Follow these steps to get started:
npm install @signaturemills/sdk
All API requests must be authenticated using your API key. You can find your API key in the SignatureMills dashboard under Settings > API.
Include your API key in the Authorization header of your requests:
Authorization: Bearer YOUR_API_KEY
All API requests should be made to: https://api.signaturemills.com/v1
/documents
Creates a new document for signing.
{
"title": "Contract Agreement",
"file": "base64_encoded_file_content",
"signers": [
{
"email": "john@example.com",
"name": "John Doe",
"order": 1
},
{
"email": "jane@example.com",
"name": "Jane Smith",
"order": 2
}
],
"fields": [
{
"type": "signature",
"page": 1,
"x": 100,
"y": 200,
"width": 150,
"height": 50,
"signer_index": 0
}
]
}
{
"id": "doc_123456789",
"title": "Contract Agreement",
"status": "pending",
"created_at": "2023-04-01T12:00:00Z",
"expires_at": "2023-05-01T12:00:00Z",
"signers": [
{
"id": "signer_123",
"email": "john@example.com",
"name": "John Doe",
"status": "pending",
"order": 1
},
{
"id": "signer_456",
"email": "jane@example.com",
"name": "Jane Smith",
"status": "pending",
"order": 2
}
],
"signing_url": "https://sign.signaturemills.com/doc_123456789"
}
/documents/{document_id}
Retrieves the status and details of a document.
{
"id": "doc_123456789",
"title": "Contract Agreement",
"status": "completed",
"created_at": "2023-04-01T12:00:00Z",
"completed_at": "2023-04-02T15:30:00Z",
"signers": [
{
"id": "signer_123",
"email": "john@example.com",
"name": "John Doe",
"status": "signed",
"signed_at": "2023-04-02T14:20:00Z",
"order": 1
},
{
"id": "signer_456",
"email": "jane@example.com",
"name": "Jane Smith",
"status": "signed",
"signed_at": "2023-04-02T15:30:00Z",
"order": 2
}
],
"download_url": "https://api.signaturemills.com/v1/documents/doc_123456789/download"
}
SignatureMills can send webhook notifications to your application when certain events occur, such as when a document is signed or completed.
To set up webhooks, go to your SignatureMills dashboard under Settings > Webhooks and add your webhook URL.
| Event | Description |
|---|---|
document.created |
Triggered when a new document is created |
document.signed |
Triggered when a signer signs a document |
document.completed |
Triggered when all signers have signed a document |
document.expired |
Triggered when a document expires without being completed |
{
"event": "document.signed",
"timestamp": "2023-04-02T14:20:00Z",
"data": {
"document_id": "doc_123456789",
"signer": {
"id": "signer_123",
"email": "john@example.com",
"name": "John Doe"
}
}
}
We provide official SDKs for several programming languages to make integrating with SignatureMills easier.
npm install @signaturemills/sdk
pip install signaturemills
composer require signaturemills/signaturemills-php
gem install signaturemills
const SignatureMills = require('@signaturemills/sdk');
// Initialize the client with your API key
const client = new SignatureMills('your_api_key');
async function createDocument() {
try {
// Create a new document
const document = await client.documents.create({
title: 'Contract Agreement',
file: fs.readFileSync('contract.pdf').toString('base64'),
signers: [
{
email: 'john@example.com',
name: 'John Doe',
order: 1
},
{
email: 'jane@example.com',
name: 'Jane Smith',
order: 2
}
],
fields: [
{
type: 'signature',
page: 1,
x: 100,
y: 200,
width: 150,
height: 50,
signer_index: 0
}
]
});
console.log('Document created:', document.id);
console.log('Signing URL:', document.signing_url);
} catch (error) {
console.error('Error creating document:', error);
}
}
createDocument();
const express = require('express');
const bodyParser = require('body-parser');
const SignatureMills = require('@signaturemills/sdk');
const app = express();
const client = new SignatureMills('your_api_key');
// Parse JSON request body
app.use(bodyParser.json());
// Webhook endpoint
app.post('/webhooks/signaturemills', (req, res) => {
const event = req.body;
// Verify webhook signature (recommended)
if (!client.webhooks.verifySignature(req.body, req.headers['x-signature-mills-signature'])) {
return res.status(400).send('Invalid signature');
}
// Handle different event types
switch (event.event) {
case 'document.signed':
console.log(`Document ${event.data.document_id} signed by ${event.data.signer.name}`);
// Update your database or notify your users
break;
case 'document.completed':
console.log(`Document ${event.data.document_id} completed`);
// Process the completed document
break;
default:
console.log(`Received event: ${event.event}`);
}
// Acknowledge receipt of the webhook
res.status(200).send('Webhook received');
});
app.listen(3000, () => {
console.log('Server listening on port 3000');
});