Introduction

The GetDocumentSigned API provides a powerful and flexible way to integrate digital document signing capabilities into your application.

Our RESTful API allows you to:

  • Upload documents for digital signing
  • Create reusable document templates
  • Add signature fields and other form elements
  • Send documents for signature to one or multiple parties
  • Track document status and receive real-time notifications
  • Download completed documents with audit trails
The API is available on all paid plans. See our pricing page for more information about API access levels.

Authentication

All API requests must be authenticated using API keys. To obtain your API key, you need to:

  1. Log in to your GetDocumentSigned account
  2. Navigate to Settings > Developer
  3. Generate a new API key

API keys should be included in the request header as follows:

GET /api/v1/documents HTTP/1.1
Host: api.getdocumentsigned.com
Content-Type: application/json
X-API-Key: your_api_key_here
Never share your API key or include it directly in client-side code. Always make API calls from your server to protect your API key.

Quick Start Guide

Follow these steps to quickly integrate document signing into your application:

1. Upload a Document

// Using fetch API
const uploadDocument = async (fileData) => {
  const response = await fetch('https://api.getdocumentsigned.com/api/v1/documents', {
    method: 'POST',
    headers: {
      'X-API-Key': 'your_api_key_here',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: 'Contract.pdf',
      file: fileData, // base64 encoded file
      document_type: 'contract'
    })
  });
  
  return await response.json();
};

2. Add Signature Fields

const addSignatureFields = async (documentId) => {
  const response = await fetch(`https://api.getdocumentsigned.com/api/v1/documents/${documentId}/fields`, {
    method: 'POST',
    headers: {
      'X-API-Key': 'your_api_key_here',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      fields: [
        {
          type: 'signature',
          page: 1,
          x: 100,
          y: 200,
          width: 200,
          height: 50,
          required: true,
          signer_index: 0
        }
      ]
    })
  });
  
  return await response.json();
};

3. Send for Signature

const sendForSignature = async (documentId) => {
  const response = await fetch(`https://api.getdocumentsigned.com/api/v1/documents/${documentId}/send`, {
    method: 'POST',
    headers: {
      'X-API-Key': 'your_api_key_here',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      signers: [
        {
          email: 'signer@example.com',
          name: 'John Doe',
          message: 'Please sign this document'
        }
      ],
      expires_in: 7 // days
    })
  });
  
  return await response.json();
};

REST API Overview

Our API is organized around REST principles. All requests should be made to the base URL: https://api.getdocumentsigned.com/api/v1/

The API accepts and returns JSON-encoded data. All responses include a standard structure:

{
  "success": true,
  "data": {
    // Response data here
  },
  "meta": {
    // Pagination or additional info
  }
}

Error responses follow this format:

{
  "success": false,
  "error": {
    "code": "error_code",
    "message": "Human-readable error message",
    "details": {
      // Additional error details
    }
  }
}

Common HTTP status codes returned by the API:

Status Code Description
200 OK Request succeeded
201 Created Resource was successfully created
400 Bad Request Invalid request parameters
401 Unauthorized Authentication failed
403 Forbidden Permission denied
404 Not Found Resource not found
429 Too Many Requests Rate limit exceeded
500 Server Error Internal server error

Documents API

The Documents API allows you to create, manage, and track documents through the signing process.

List Documents

GET /api/v1/documents

Retrieves a list of documents in your account.

Query Parameters
Parameter Type Description
status string Filter by document status: draft, sent, completed, expired, declined
page integer Page number for pagination
limit integer Number of results per page (1-100)
Example Response
{
  "success": true,
  "data": [
    {
      "id": "doc_123456",
      "name": "Business Contract.pdf",
      "status": "sent",
      "created_at": "2023-05-15T14:22:00Z",
      "expires_at": "2023-05-22T14:22:00Z",
      "signers": [
        {
          "email": "john@example.com",
          "name": "John Doe",
          "status": "pending"
        }
      ]
    }
  ],
  "meta": {
    "total": 45,
    "page": 1,
    "limit": 10
  }
}

Create Document

POST /api/v1/documents

Uploads a new document to your account.

Request Body
Parameter Type Required Description
name string Yes Document name
file string Yes Base64 encoded file content
document_type string No Type of document (contract, nda, agreement, etc.)

Code Examples

Below are examples in various programming languages to help you integrate with our API.

// Complete workflow example
const apiKey = 'YOUR_API_KEY';
const baseUrl = 'https://api.getdocumentsigned.com/api/v1';

// Step 1: Upload document
async function uploadDocument(fileBase64) {
    const response = await fetch(`${baseUrl}/documents`, {
        method: 'POST',
        headers: {
            'X-API-Key': apiKey,
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({
            name: 'Employment Contract.pdf',
            file: fileBase64
        })
    });
    
    return await response.json();
}

// Step 2: Add signature fields
async function addSignatureFields(documentId) {
    const response = await fetch(`${baseUrl}/documents/${documentId}/fields`, {
        method: 'POST',
        headers: {
            'X-API-Key': apiKey,
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({
            fields: [
                {
                    type: 'signature',
                    page: 1,
                    x: 100,
                    y: 700,
                    width: 200,
                    height: 50,
                    required: true,
                    signer_index: 0,
                    label: 'Employee Signature'
                },
                {
                    type: 'signature',
                    page: 1,
                    x: 400,
                    y: 700,
                    width: 200,
                    height: 50,
                    required: true,
                    signer_index: 1,
                    label: 'Employer Signature'
                }
            ]
        })
    });
    
    return await response.json();
}

// Step 3: Send for signature
async function sendForSignature(documentId) {
    const response = await fetch(`${baseUrl}/documents/${documentId}/send`, {
        method: 'POST',
        headers: {
            'X-API-Key': apiKey,
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({
            signers: [
                {
                    email: 'employee@example.com',
                    name: 'John Employee',
                    message: 'Please sign your employment contract'
                },
                {
                    email: 'employer@example.com',
                    name: 'Mary Manager',
                    message: 'Please review and sign'
                }
            ],
            expires_in: 7,
            reminder_interval: 2 // Send reminder every 2 days
        })
    });
    
    return await response.json();
}

// Full workflow execution
async function executeWorkflow(fileBase64) {
    try {
        // Upload document
        const uploadResult = await uploadDocument(fileBase64);
        if (!uploadResult.success) throw new Error(uploadResult.error.message);
        
        const documentId = uploadResult.data.id;
        
        // Add signature fields
        const fieldsResult = await addSignatureFields(documentId);
        if (!fieldsResult.success) throw new Error(fieldsResult.error.message);
        
        // Send for signature
        const sendResult = await sendForSignature(documentId);
        if (!sendResult.success) throw new Error(sendResult.error.message);
        
        return sendResult.data;
    } catch (error) {
        console.error('Error in document signing workflow:', error);
        throw error;
    }
}
<?php
// Complete workflow example
$apiKey = 'YOUR_API_KEY';
$baseUrl = 'https://api.getdocumentsigned.com/api/v1';

// Helper function for API requests
function makeApiRequest($method, $endpoint, $data = null) {
    global $apiKey, $baseUrl;
    
    $curl = curl_init($baseUrl . $endpoint);
    
    $headers = [
        'X-API-Key: ' . $apiKey,
        'Content-Type: application/json',
        'Accept: application/json'
    ];
    
    curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
    curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    
    if ($data && ($method === 'POST' || $method === 'PUT')) {
        curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
    }
    
    $response = curl_exec($curl);
    $httpStatus = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    
    if (curl_errno($curl)) {
        throw new Exception('API Request Error: ' . curl_error($curl));
    }
    
    curl_close($curl);
    
    $responseData = json_decode($response, true);
    
    if ($httpStatus >= 400) {
        throw new Exception('API Error: ' . 
            ($responseData['error']['message'] ?? 'Unknown error'));
    }
    
    return $responseData;
}

// Step 1: Upload document
function uploadDocument($fileBase64) {
    $data = [
        'name' => 'Employment Contract.pdf',
        'file' => $fileBase64
    ];
    
    return makeApiRequest('POST', '/documents', $data);
}

// Step 2: Add signature fields
function addSignatureFields($documentId) {
    $data = [
        'fields' => [
            [
                'type' => 'signature',
                'page' => 1,
                'x' => 100,
                'y' => 700,
                'width' => 200,
                'height' => 50,
                'required' => true,
                'signer_index' => 0,
                'label' => 'Employee Signature'
            ],
            [
                'type' => 'signature',
                'page' => 1,
                'x' => 400,
                'y' => 700,
                'width' => 200,
                'height' => 50,
                'required' => true,
                'signer_index' => 1,
                'label' => 'Employer Signature'
            ]
        ]
    ];
    
    return makeApiRequest('POST', "/documents/{$documentId}/fields", $data);
}

// Step 3: Send for signature
function sendForSignature($documentId) {
    $data = [
        'signers' => [
            [
                'email' => 'employee@example.com',
                'name' => 'John Employee',
                'message' => 'Please sign your employment contract'
            ],
            [
                'email' => 'employer@example.com',
                'name' => 'Mary Manager',
                'message' => 'Please review and sign'
            ]
        ],
        'expires_in' => 7,
        'reminder_interval' => 2 // Send reminder every 2 days
    ];
    
    return makeApiRequest('POST', "/documents/{$documentId}/send", $data);
}

// Full workflow execution
function executeWorkflow($fileBase64) {
    try {
        // Upload document
        $uploadResult = uploadDocument($fileBase64);
        if (!$uploadResult['success']) {
            throw new Exception($uploadResult['error']['message']);
        }
        
        $documentId = $uploadResult['data']['id'];
        
        // Add signature fields
        $fieldsResult = addSignatureFields($documentId);
        if (!$fieldsResult['success']) {
            throw new Exception($fieldsResult['error']['message']);
        }
        
        // Send for signature
        $sendResult = sendForSignature($documentId);
        if (!$sendResult['success']) {
            throw new Exception($sendResult['error']['message']);
        }
        
        return $sendResult['data'];
    } catch (Exception $e) {
        error_log('Error in document signing workflow: ' . $e->getMessage());
        throw $e;
    }
}

// Usage example (with file reading)
// $filePath = 'path/to/document.pdf';
// $fileContent = file_get_contents($filePath);
// $fileBase64 = base64_encode($fileContent);
// $result = executeWorkflow($fileBase64);
// print_r($result);
?>
import requests
import json
import base64

# Complete workflow example
api_key = 'YOUR_API_KEY'
base_url = 'https://api.getdocumentsigned.com/api/v1'

# Helper function for API requests
def make_api_request(method, endpoint, data=None):
    url = f"{base_url}{endpoint}"
    
    headers = {
        'X-API-Key': api_key,
        'Content-Type': 'application/json',
        'Accept': 'application/json'
    }
    
    if method == 'GET':
        response = requests.get(url, headers=headers)
    elif method == 'POST':
        response = requests.post(url, headers=headers, json=data)
    elif method == 'PUT':
        response = requests.put(url, headers=headers, json=data)
    elif method == 'DELETE':
        response = requests.delete(url, headers=headers)
    else:
        raise ValueError(f"Unsupported HTTP method: {method}")
    
    response_data = response.json()
    
    if response.status_code >= 400:
        error_message = response_data.get('error', {}).get('message', 'Unknown error')
        raise Exception(f"API Error: {error_message}")
    
    return response_data

# Step 1: Upload document
def upload_document(file_base64):
    data = {
        'name': 'Employment Contract.pdf',
        'file': file_base64
    }
    
    return make_api_request('POST', '/documents', data)

# Step 2: Add signature fields
def add_signature_fields(document_id):
    data = {
        'fields': [
            {
                'type': 'signature',
                'page': 1,
                'x': 100,
                'y': 700,
                'width': 200,
                'height': 50,
                'required': True,
                'signer_index': 0,
                'label': 'Employee Signature'
            },
            {
                'type': 'signature',
                'page': 1,
                'x': 400,
                'y': 700,
                'width': 200,
                'height': 50,
                'required': True,
                'signer_index': 1,
                'label': 'Employer Signature'
            }
        ]
    }
    
    return make_api_request('POST', f'/documents/{document_id}/fields', data)

# Step 3: Send for signature
def send_for_signature(document_id):
    data = {
        'signers': [
            {
                'email': 'employee@example.com',
                'name': 'John Employee',
                'message': 'Please sign your employment contract'
            },
            {
                'email': 'employer@example.com',
                'name': 'Mary Manager',
                'message': 'Please review and sign'
            }
        ],
        'expires_in': 7,
        'reminder_interval': 2  # Send reminder every 2 days
    }
    
    return make_api_request('POST', f'/documents/{document_id}/send', data)

# Full workflow execution
def execute_workflow(file_base64):
    try:
        # Upload document
        upload_result = upload_document(file_base64)
        if not upload_result.get('success'):
            raise Exception(upload_result.get('error', {}).get('message', 'Upload failed'))
        
        document_id = upload_result['data']['id']
        
        # Add signature fields
        fields_result = add_signature_fields(document_id)
        if not fields_result.get('success'):
            raise Exception(fields_result.get('error', {}).get('message', 'Adding fields failed'))
        
        # Send for signature
        send_result = send_for_signature(document_id)
        if not send_result.get('success'):
            raise Exception(send_result.get('error', {}).get('message', 'Sending failed'))
        
        return send_result['data']
    except Exception as e:
        print(f"Error in document signing workflow: {str(e)}")
        raise

# Usage example (with file reading)
# def get_file_as_base64(file_path):
#     with open(file_path, 'rb') as file:
#         file_content = file.read()
#         return base64.b64encode(file_content).decode('utf-8')
#
# file_path = 'path/to/document.pdf'
# file_base64 = get_file_as_base64(file_path)
# result = execute_workflow(file_base64)
# print(json.dumps(result, indent=2))

Ready to integrate with our API?

Sign up and start developing with GetDocumentSigned.com today