Getting started overview
Integrating the SignRequest API involves a sequence of steps designed to enable programmatic access to e-signature functionalities. This guide provides a structured approach, beginning with account setup and API key generation, progressing through environment configuration, and culminating in the execution of a basic API call. The SignRequest API is a RESTful service, supporting standard HTTP methods and JSON payloads for requests and responses. It allows for the creation, sending, signing, and retrieval of documents, facilitating the automation of signature workflows within custom applications.
The core process for getting started includes:
- Account Creation and API Key Generation: Setting up a SignRequest account and obtaining the necessary authentication credentials.
- Environment Setup: Configuring your development environment for making HTTP requests.
- First API Request: Executing a simple request to verify connectivity and authentication.
- Exploring Advanced Features: Understanding options for document management, webhook integration, and user management.
The following table summarizes the initial steps:
| Step | What to Do | Where |
|---|---|---|
| 1. Sign Up | Create a new SignRequest account. | SignRequest homepage |
| 2. Generate API Key | Access API settings in your account to generate a new API token. | SignRequest Dashboard > API Settings |
| 3. Install HTTP Client | Choose and install an HTTP client library for your preferred programming language. | Your project's package manager (e.g., pip, npm, composer) |
| 4. Make First Request | Construct and send a basic API request to retrieve account details. | Your code editor/IDE |
Create an account and get keys
To begin using the SignRequest API, you must first create a SignRequest account. SignRequest offers a free tier that includes up to 10 documents per month, which is sufficient for initial development and testing. Once your account is active, you will need to generate an API token, which serves as your primary authentication credential for API calls.
Account Creation
- Navigate to the SignRequest website.
- Click on the "Sign Up" or "Get Started Free" button.
- Follow the prompts to create your account, providing an email address and setting a password.
- Verify your email address if prompted.
Generating an API Token
After successfully creating and logging into your SignRequest account, follow these steps to generate your API token:
- From your SignRequest dashboard, navigate to the "API" section. This is typically found under your user profile or settings menu.
- Look for an option to "Generate new API token" or "Create API Key".
- Click the button to generate the token. A unique alphanumeric string will be displayed. This is your API token.
- Important: Copy this token immediately and store it securely. For security reasons, SignRequest typically only displays the token once upon creation. If you lose it, you will need to generate a new one, invalidating the old token.
The API token is a Bearer token and should be included in the Authorization header of all your API requests. For example, Authorization: Bearer YOUR_API_TOKEN.
Your first request
After obtaining your API token, the next step is to make your first API request to confirm your setup is correct. A common first request is to retrieve details about your authenticated user or account. This verifies both network connectivity and correct API token usage. The SignRequest API base URL is https://signrequest.com/api/v1/.
Example: Get Account Details
This example demonstrates how to make a GET request to the /api/v1/user/ endpoint to retrieve information about the currently authenticated user. We will use curl for simplicity, but you can adapt this to any programming language with an HTTP client.
Using curl
Replace YOUR_API_TOKEN with the actual API token you generated.
curl -X GET \
https://signrequest.com/api/v1/user/ \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Content-Type: application/json'
Expected Response (JSON)
A successful response (HTTP status 200 OK) will return a JSON object containing user details:
{
"email": "[email protected]",
"first_name": "Your",
"last_name": "Name",
"is_active": true,
"date_joined": "2023-01-01T12:00:00Z",
"uuid": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
"url": "https://signrequest.com/api/v1/user/a1b2c3d4-e5f6-7890-1234-567890abcdef/"
// ... other user details
}
Using Python with requests
If you prefer Python, you can use the requests library. First, ensure it's installed: pip install requests.
import requests
import json
API_TOKEN = 'YOUR_API_TOKEN'
BASE_URL = 'https://signrequest.com/api/v1/'
def get_user_details():
headers = {
'Authorization': f'Bearer {API_TOKEN}',
'Content-Type': 'application/json'
}
response = requests.get(f'{BASE_URL}user/', headers=headers)
if response.status_code == 200:
print("Successfully retrieved user details:")
print(json.dumps(response.json(), indent=4))
else:
print(f"Error: {response.status_code}")
print(response.text)
if __name__ == '__main__':
get_user_details()
Using Node.js with node-fetch
If you prefer Node.js, you can use node-fetch. First, ensure it's installed: npm install node-fetch.
const fetch = require('node-fetch');
const API_TOKEN = 'YOUR_API_TOKEN';
const BASE_URL = 'https://signrequest.com/api/v1/';
async function getUserDetails() {
const headers = {
'Authorization': `Bearer ${API_TOKEN}`,
'Content-Type': 'application/json'
};
try {
const response = await fetch(`${BASE_URL}user/`, {
method: 'GET',
headers: headers
});
if (response.ok) {
const data = await response.json();
console.log("Successfully retrieved user details:");
console.log(JSON.stringify(data, null, 4));
} else {
console.error(`Error: ${response.status}`);
console.error(await response.text());
}
} catch (error) {
console.error("Network or fetch error:", error);
}
}
getUserDetails();
Common next steps
Once you've successfully made your first API call, you can explore more advanced functionalities of the SignRequest API to integrate e-signatures into your applications. Here are some common next steps:
Document Upload and Creation
The primary use case for SignRequest is sending documents for signature. This typically involves uploading a PDF document and then defining the signers and signature fields. The API supports various options for document preparation, including pre-filling fields and setting up complex workflows.
- Upload a document: Use the
/api/v1/documents/endpoint to upload a file. - Create a SignRequest: After uploading, create a sign request using the
/api/v1/signrequests/endpoint, specifying the document, signers, and any required fields. - Refer to the SignRequest API documentation on SignRequests for detailed examples.
Webhooks for Event Notifications
To receive real-time updates on the status of your sign requests (e.g., document viewed, signed, declined), you should implement webhooks. Webhooks allow SignRequest to send automated HTTP POST requests to a specified URL in your application when certain events occur.
- Configure a webhook URL: Set up an endpoint in your application that can receive POST requests from SignRequest.
- Create a Webhook subscription: Use the
/api/v1/webhooks/endpoint to register your URL and specify the events you want to be notified about. - For security, it is recommended to validate webhook signatures to ensure requests originate from SignRequest.
Embedded Signing
SignRequest allows you to embed the signing process directly into your application, providing a seamless user experience. This involves generating a signing URL that can be embedded within an iframe or opened in a new window within your application.
- When creating a SignRequest, you can specify parameters to enable embedded signing and retrieve the necessary URLs.
- Consult the SignRequest API documentation for embedded signing for implementation details.
Error Handling and Logging
Implement robust error handling and logging in your application to manage API responses, particularly error codes (e.g., 4xx, 5xx). This helps in debugging and maintaining the stability of your integration.
Troubleshooting the first call
When making your initial API call, you might encounter common issues. Here's a guide to diagnose and resolve them:
401 Unauthorized
This is the most frequent error for initial API calls, indicating an authentication problem.
- Invalid API Token: Double-check that you have copied the API token correctly. Ensure there are no leading or trailing spaces.
- Missing Bearer Prefix: The
Authorizationheader must be formatted asBearer YOUR_API_TOKEN. Ensure the word "Bearer" and a space precede your token. - Expired or Revoked Token: If you generated multiple tokens, ensure you are using the most recently generated and active one. Tokens can be revoked from your SignRequest API settings.
- Incorrect Header Name: Confirm the header is exactly
Authorization, notX-Api-Keyor similar.
403 Forbidden
This error typically means your API token is valid, but it lacks the necessary permissions to access the requested resource.
- Insufficient Account Permissions: Ensure your SignRequest account has the required plan or permissions for the API endpoint you are trying to access. Some advanced features may require a paid plan.
- IP Whitelisting: If your SignRequest account has IP whitelisting enabled for API access, ensure the IP address of your server or development machine is added to the allowed list in your SignRequest API settings.
404 Not Found
This indicates that the API endpoint you are trying to reach does not exist.
- Incorrect URL: Verify the base URL (
https://signrequest.com/api/v1/) and the endpoint path (e.g.,user/) are typed correctly according to the SignRequest API documentation. - HTTP Method Mismatch: Ensure you are using the correct HTTP method (GET, POST, PUT, DELETE) for the endpoint. For example, trying to POST to an endpoint that only accepts GET will result in a 404.
Network Issues
If you receive no response or a connection error, it might be a network-related problem.
- Firewall Restrictions: Check if your local firewall or corporate network policies are blocking outgoing HTTP requests to
signrequest.com. - DNS Resolution: Ensure your system can resolve
signrequest.comto its IP address.
Debugging Tools
- Check HTTP Status Codes: Always inspect the HTTP status code returned by the API.
- Read Error Messages: The API often returns detailed error messages in the response body.
- Use a Proxy Tool: Tools like Postman, Insomnia, or browser developer tools can help inspect outgoing requests and incoming responses.