Getting Started

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.

Prerequisites

Before you begin, you'll need:

  • A SwiftDocSign.com account (Professional or Enterprise plan)
  • API credentials (available in your account dashboard)
  • Basic understanding of REST APIs and HTTP requests

Quick Start

  1. Sign up for a SwiftDocSign.com account
  2. Navigate to API settings in your dashboard
  3. Generate your API key
  4. Make your first API call using the examples below

API Overview

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.

Base URL

https://api.SwiftDocSign.com/v1

Request Format

All requests should include the following headers:

Content-Type: application/json
Authorization: Bearer YOUR_API_KEY

Response Format

All responses are returned in JSON format:

{
  "status": "success",
  "data": {

  }
}

Authentication

The SwiftDocSign.com API uses API keys to authenticate requests. You can view and manage your API keys in your account dashboard.

API Key Authentication

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"
Keep your API keys secure! Do not share them in publicly accessible areas such as GitHub, client-side code, or in your application's source code.

Documents

The Documents endpoint allows you to create, retrieve, and manage document signing requests.

Create a Document

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"
      }
    ]
  }'

List Documents

To retrieve a list of all documents:

curl -X GET https://api.SwiftDocSign.com/v1/documents \
  -H "Authorization: Bearer YOUR_API_KEY"

Get Document Status

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

Templates allow you to reuse document structures and signing workflows.

Create a Template

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"
      }
    ]
  }'

Use a Template

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"
      }
    ]
  }'

Signatures

The Signatures API provides methods for retrieving and verifying signature information.

Verify a Signature

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

Webhooks allow you to receive real-time notifications when events happen in your SwiftDocSign.com account.

Configure Webhooks

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"]
  }'

Webhook Payload Example

{
  "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"
  }
}

Error Handling

The SwiftDocSign.com API uses conventional HTTP response codes to indicate the success or failure of an API request.

HTTP Status Codes

  • 200 - OK: Request succeeded
  • 400 - Bad Request: Invalid request format or parameters
  • 401 - Unauthorized: Missing or invalid API key
  • 403 - Forbidden: Valid API key but insufficient permissions
  • 404 - Not Found: The requested resource doesn't exist
  • 429 - Too Many Requests: Rate limit exceeded
  • 500, 502, 503, 504 - Server Errors: Something went wrong on our end

Error Response Format

{
  "status": "error",
  "code": "invalid_request",
  "message": "The request was unacceptable, often due to missing a required parameter.",
  "details": {
    "missing_field": "signers"
  }
}

Code Examples

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)

Need Additional Help?

Our support team is ready to assist you with any questions about our API.

  • Email our API support team at [email protected]
  • Chat with our developers on our community forum
  • Schedule a one-on-one integration consultation
Contact Support