Comprehensive guides and API references for MyDocumentsAccount
Welcome to the MyDocumentsAccount documentation. This comprehensive guide will help you integrate and use our digital document signing platform effectively.
MyDocumentsAccount provides a powerful API and various SDKs to help you automate your document workflows, integrate with your existing systems, and create custom signing experiences for your users.
Whether you're looking to send documents for signature programmatically, create templates, manage users, or build a complete white-labeled signing solution, our documentation will guide you through the process.
This documentation is for the latest version of the MyDocumentsAccount API (v2.0). If you're using an older version, please refer to the legacy documentation or consider upgrading to access the latest features.
Get started with MyDocumentsAccount API in minutes. This guide will walk you through the basic steps to send your first document for signature programmatically.
Log in to your MyDocumentsAccount account, go to Settings > API, and generate a new API key. Keep this key secure, as it provides access to your account.
While you can use our REST API directly, our SDKs make integration easier. Install the SDK for your preferred language:
npm install MyDocumentsAccount-sdk
pip install MyDocumentsAccount-sdk
composer require MyDocumentsAccount/MyDocumentsAccount-sdk
Here's a simple example of sending a document for signature using our JavaScript SDK:
// Initialize the SDK with your API key
const MyDocumentsAccount = require('MyDocumentsAccount-sdk');
const client = new MyDocumentsAccount.Client('YOUR_API_KEY');
// Send a document for signature
async function sendDocument() {
try {
const document = await client.documents.create({
name: 'Contract Agreement',
file: fs.readFileSync('path/to/document.pdf'),
signers: [
{
email: 'signer@example.com',
name: 'John Doe',
role: 'Signer'
}
],
fields: [
{
type: 'signature',
page: 1,
x: 100,
y: 100,
width: 200,
height: 50,
signer: 0 // Index of the signer in the signers array
}
]
});
console.log('Document sent successfully!');
console.log('Document ID:', document.id);
console.log('Signing URL:', document.signingUrl);
} catch (error) {
console.error('Error sending document:', error);
}
}
sendDocument();
You can track the status of your document using the document ID:
async function getDocumentStatus(documentId) {
try {
const document = await client.documents.get(documentId);
console.log('Document Status:', document.status);
console.log('Signers:', document.signers);
} catch (error) {
console.error('Error getting document:', error);
}
}
getDocumentStatus('document_id_here');
All API requests to MyDocumentsAccount require authentication. We support two authentication methods:
The simplest way to authenticate is using your API key in the Authorization header:
curl -X GET https://api.MyDocumentsAccount.com/v2/documents \
-H "Authorization: Bearer YOUR_API_KEY"
For more secure applications, especially those acting on behalf of users, we recommend using OAuth 2.0:
curl -X GET https://api.MyDocumentsAccount.com/v2/documents \
-H "Authorization: Bearer OAUTH_ACCESS_TOKEN"
For detailed instructions on implementing OAuth 2.0, refer to our OAuth 2.0 Guide.
The MyDocumentsAccount API is organized around REST principles. It uses standard HTTP methods, returns JSON responses, and uses standard HTTP status codes to indicate the success or failure of requests.
All API requests should be made to the following base URL:
https://api.MyDocumentsAccount.com/v2/
For POST and PUT requests, the request body should be in JSON format with the Content-Type header set to application/json.
All responses are returned in JSON format. A typical response structure looks like this:
{
"data": {
// Response data specific to the endpoint
},
"meta": {
"pagination": {
"total": 100,
"count": 10,
"per_page": 10,
"current_page": 1,
"total_pages": 10
}
}
}
When an error occurs, the API returns an appropriate HTTP status code and a JSON response with error details:
{
"error": {
"code": "invalid_request",
"message": "The request was invalid",
"details": [
{
"field": "email",
"message": "Invalid email format"
}
]
}
}
The API has rate limits to ensure fair usage. The current limits are:
Rate limit information is included in the response headers:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1620000000
The Documents API allows you to create, send, and manage documents for signature.
Send a document for signature:
curl -X POST https://api.MyDocumentsAccount.com/v2/documents \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Contract Agreement",
"file": "BASE64_ENCODED_FILE",
"signers": [
{
"email": "signer@example.com",
"name": "John Doe",
"role": "Signer"
}
],
"fields": [
{
"type": "signature",
"page": 1,
"x": 100,
"y": 100,
"width": 200,
"height": 50,
"signer": 0
}
]
}'
Retrieve information about a specific document:
curl -X GET https://api.MyDocumentsAccount.com/v2/documents/DOCUMENT_ID \
-H "Authorization: Bearer YOUR_API_KEY"
Retrieve a list of documents:
curl -X GET https://api.MyDocumentsAccount.com/v2/documents \
-H "Authorization: Bearer YOUR_API_KEY"
Cancel a document that has not been completed:
curl -X POST https://api.MyDocumentsAccount.com/v2/documents/DOCUMENT_ID/cancel \
-H "Authorization: Bearer YOUR_API_KEY"
Send a reminder to signers who have not yet signed:
curl -X POST https://api.MyDocumentsAccount.com/v2/documents/DOCUMENT_ID/remind \
-H "Authorization: Bearer YOUR_API_KEY"
Download the signed document:
curl -X GET https://api.MyDocumentsAccount.com/v2/documents/DOCUMENT_ID/download \
-H "Authorization: Bearer YOUR_API_KEY" \
--output signed_document.pdf
The Templates API allows you to create and manage reusable document templates.
Create a new template:
curl -X POST https://api.MyDocumentsAccount.com/v2/templates \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Employment Contract",
"file": "BASE64_ENCODED_FILE",
"roles": [
{
"name": "Employee",
"order": 1
},
{
"name": "Manager",
"order": 2
}
],
"fields": [
{
"type": "signature",
"page": 1,
"x": 100,
"y": 100,
"width": 200,
"height": 50,
"role": "Employee"
},
{
"type": "signature",
"page": 1,
"x": 100,
"y": 200,
"width": 200,
"height": 50,
"role": "Manager"
}
]
}'
Retrieve information about a specific template:
curl -X GET https://api.MyDocumentsAccount.com/v2/templates/TEMPLATE_ID \
-H "Authorization: Bearer YOUR_API_KEY"
Retrieve a list of templates:
curl -X GET https://api.MyDocumentsAccount.com/v2/templates \
-H "Authorization: Bearer YOUR_API_KEY"
Create a document from a template:
curl -X POST https://api.MyDocumentsAccount.com/v2/templates/TEMPLATE_ID/use \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "John Doe Employment Contract",
"signers": [
{
"email": "employee@example.com",
"name": "John Doe",
"role": "Employee"
},
{
"email": "manager@example.com",
"name": "Jane Smith",
"role": "Manager"
}
]
}'
The Users API allows you to manage users in your MyDocumentsAccount account.
Add a new user to your account:
curl -X POST https://api.MyDocumentsAccount.com/v2/users \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"name": "John Doe",
"role": "admin"
}'
Retrieve information about a specific user:
curl -X GET https://api.MyDocumentsAccount.com/v2/users/USER_ID \
-H "Authorization: Bearer YOUR_API_KEY"
Retrieve a list of users in your account:
curl -X GET https://api.MyDocumentsAccount.com/v2/users \
-H "Authorization: Bearer YOUR_API_KEY"
Update a user's information:
curl -X PUT https://api.MyDocumentsAccount.com/v2/users/USER_ID \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "John Smith",
"role": "member"
}'
Remove a user from your account:
curl -X DELETE https://api.MyDocumentsAccount.com/v2/users/USER_ID \
-H "Authorization: Bearer YOUR_API_KEY"
Webhooks allow you to receive real-time notifications when events occur in your MyDocumentsAccount account.
document.created - A new document has been createddocument.sent - A document has been sent for signaturedocument.viewed - A signer has viewed a documentdocument.signed - A signer has signed a documentdocument.completed - All signers have signed a documentdocument.declined - A signer has declined to sign a documentdocument.expired - A document has expired without being completedRegister a new webhook endpoint:
curl -X POST https://api.MyDocumentsAccount.com/v2/webhooks \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-server.com/webhook",
"events": ["document.completed", "document.declined"],
"secret": "your_webhook_secret"
}'
When an event occurs, we'll send a POST request to your webhook URL with a JSON payload:
{
"event": "document.completed",
"data": {
"document": {
"id": "doc_123456",
"name": "Contract Agreement",
"status": "completed",
"completed_at": "2023-05-01T12:00:00Z"
}
}
}
To ensure the webhook is coming from MyDocumentsAccount, we include a signature in the X-MyDocumentsAccount-Signature header. You should verify this signature using your webhook secret:
const crypto = require('crypto');
function verifyWebhookSignature(payload, signature, secret) {
const hmac = crypto.createHmac('sha256', secret);
const digest = hmac.update(payload).digest('hex');
return crypto.timingSafeEqual(
Buffer.from(digest),
Buffer.from(signature)
);
}
Our JavaScript SDK provides a convenient way to interact with the MyDocumentsAccount API in Node.js and browser environments.
npm install MyDocumentsAccount-sdk
const MyDocumentsAccount = require('MyDocumentsAccount-sdk');
// Initialize the client
const client = new MyDocumentsAccount.Client('YOUR_API_KEY');
// Send a document for signature
async function sendDocument() {
try {
const document = await client.documents.create({
name: 'Contract Agreement',
file: fs.readFileSync('path/to/document.pdf'),
signers: [
{
email: 'signer@example.com',
name: 'John Doe',
role: 'Signer'
}
],
fields: [
{
type: 'signature',
page: 1,
x: 100,
y: 100,
width: 200,
height: 50,
signer: 0
}
]
});
console.log('Document sent successfully!');
console.log('Document ID:', document.id);
} catch (error) {
console.error('Error sending document:', error);
}
}
// List documents
async function listDocuments() {
try {
const { data, meta } = await client.documents.list({
limit: 10,
page: 1,
status: 'pending'
});
console.log(`Found ${meta.pagination.total} documents`);
data.forEach(doc => {
console.log(`- ${doc.name} (${doc.status})`);
});
} catch (error) {
console.error('Error listing documents:', error);
}
}