Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
713 changes: 713 additions & 0 deletions docs/TurboSign/API Bulk Signatures.md

Large diffs are not rendered by default.

1,102 changes: 732 additions & 370 deletions docs/TurboSign/API Signatures.md

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions docs/TurboSign/Setting up TurboSign.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ For each recipient, you'll need:

![Add recipients interface showing all options](/img/turbosign/AddRecipients.png)

**CC Emails (Optional):** You can also add CC email addresses for people who should receive a copy of the document. These individuals will get the final signed copy when everyone has completed signing, but they won't need to sign the document themselves.

<br/>

:::tip Recipient Best Practices
Expand Down
Binary file added static/img/turbosign/api/bulk-api.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions static/img/turbosign/api/types.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions static/scripts/turbosign/api/bulk/cancel-batch/nodejs/express.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const fetch = require('node-fetch');

// Configuration - Update these values
const API_TOKEN = "YOUR_API_TOKEN";
const ORG_ID = "YOUR_ORGANIZATION_ID";
const BASE_URL = "https://api.turbodocx.com";
const BATCH_ID = "YOUR_BATCH_ID"; // Replace with actual batch ID to cancel

// Send POST request to cancel batch
const response = await fetch(`${BASE_URL}/turbosign/bulk/batch/${BATCH_ID}/cancel`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_TOKEN}`,
'x-rapiddocx-org-id': ORG_ID,
'User-Agent': 'TurboDocx API Client',
'Content-Type': 'application/json'
}
});

const result = await response.json();

if (result.success) {
console.log('✅ Batch cancelled successfully');
console.log('Batch ID:', result.batchId);
console.log('Status:', result.status);
console.log('\n📊 Cancellation Summary:');
console.log('Cancelled Jobs:', result.cancelledJobs);
console.log('Succeeded Jobs (already completed):', result.succeededJobs);
console.log('Refunded Credits:', result.refundedCredits);
console.log('\n💰 Credits have been refunded to your account for cancelled jobs');
console.log('✅ Jobs that already succeeded remain completed');
} else {
console.error('❌ Error:', result.error || result.message);
if (result.code) {
console.error('Error Code:', result.code);
}
}
53 changes: 53 additions & 0 deletions static/scripts/turbosign/api/bulk/cancel-batch/nodejs/fastify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
const fetch = require('node-fetch');

// Configuration - Update these values
const API_TOKEN = "YOUR_API_TOKEN";
const ORG_ID = "YOUR_ORGANIZATION_ID";
const BASE_URL = "https://api.turbodocx.com";
const BATCH_ID = "YOUR_BATCH_ID"; // Replace with actual batch ID to cancel

// Fastify route handler example
async function cancelBatch(request, reply) {
try {
// Send POST request to cancel batch
const response = await fetch(`${BASE_URL}/turbosign/bulk/batch/${BATCH_ID}/cancel`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_TOKEN}`,
'x-rapiddocx-org-id': ORG_ID,
'User-Agent': 'TurboDocx API Client',
'Content-Type': 'application/json'
}
});

const result = await response.json();

if (result.success) {
return reply.send({
success: true,
batchId: result.batchId,
status: result.status,
message: result.message,
cancelledJobs: result.cancelledJobs,
succeededJobs: result.succeededJobs,
refundedCredits: result.refundedCredits
});
} else {
return reply.code(400).send({
success: false,
error: result.error || result.message,
code: result.code
});
}
} catch (error) {
console.error('Error cancelling batch:', error);
return reply.code(500).send({
success: false,
error: 'Internal server error',
message: error.message
});
}
}

// Export for use in Fastify app
module.exports = { cancelBatch };
71 changes: 71 additions & 0 deletions static/scripts/turbosign/api/bulk/cancel-batch/python/fastapi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import json
import requests
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel

# Configuration - Update these values
API_TOKEN = "YOUR_API_TOKEN"
ORG_ID = "YOUR_ORGANIZATION_ID"
BASE_URL = "https://api.turbodocx.com"
BATCH_ID = "YOUR_BATCH_ID" # Replace with actual batch ID to cancel

app = FastAPI()

class CancelBatchResponse(BaseModel):
success: bool
batchId: str
status: str
message: str
cancelledJobs: int
succeededJobs: int
refundedCredits: int

@app.post('/cancel-batch', response_model=CancelBatchResponse)
async def cancel_batch():
try:
# Prepare headers
headers = {
'Authorization': f'Bearer {API_TOKEN}',
'x-rapiddocx-org-id': ORG_ID,
'User-Agent': 'TurboDocx API Client',
'Content-Type': 'application/json'
}

# Send POST request to cancel batch
response = requests.post(
f'{BASE_URL}/turbosign/bulk/batch/{BATCH_ID}/cancel',
headers=headers
)

result = response.json()

if result.get('success'):
return CancelBatchResponse(
success=True,
batchId=result['batchId'],
status=result['status'],
message=result['message'],
cancelledJobs=result['cancelledJobs'],
succeededJobs=result['succeededJobs'],
refundedCredits=result['refundedCredits']
)
else:
raise HTTPException(
status_code=400,
detail={
'error': result.get('error', 'Failed to cancel batch'),
'code': result.get('code')
}
)

except HTTPException:
raise
except Exception as error:
print(f'Error cancelling batch: {error}')
raise HTTPException(
status_code=500,
detail={
'error': 'Internal server error',
'message': str(error)
}
)
58 changes: 58 additions & 0 deletions static/scripts/turbosign/api/bulk/cancel-batch/python/flask.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import json
import requests
from flask import Flask, jsonify

# Configuration - Update these values
API_TOKEN = "YOUR_API_TOKEN"
ORG_ID = "YOUR_ORGANIZATION_ID"
BASE_URL = "https://api.turbodocx.com"
BATCH_ID = "YOUR_BATCH_ID" # Replace with actual batch ID to cancel

app = Flask(__name__)

@app.route('/cancel-batch', methods=['POST'])
def cancel_batch():
try:
# Prepare headers
headers = {
'Authorization': f'Bearer {API_TOKEN}',
'x-rapiddocx-org-id': ORG_ID,
'User-Agent': 'TurboDocx API Client',
'Content-Type': 'application/json'
}

# Send POST request to cancel batch
response = requests.post(
f'{BASE_URL}/turbosign/bulk/batch/{BATCH_ID}/cancel',
headers=headers
)

result = response.json()

if result.get('success'):
return jsonify({
'success': True,
'batchId': result['batchId'],
'status': result['status'],
'message': result['message'],
'cancelledJobs': result['cancelledJobs'],
'succeededJobs': result['succeededJobs'],
'refundedCredits': result['refundedCredits']
}), 200
else:
return jsonify({
'success': False,
'error': result.get('error', 'Failed to cancel batch'),
'code': result.get('code')
}), 400

except Exception as error:
print(f'Error cancelling batch: {error}')
return jsonify({
'success': False,
'error': 'Internal server error',
'message': str(error)
}), 500

if __name__ == '__main__':
app.run(debug=True)
121 changes: 121 additions & 0 deletions static/scripts/turbosign/api/bulk/ingest/nodejs/express.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
const FormData = require('form-data');
const fs = require('fs');
const fetch = require('node-fetch');

// Configuration - Update these values
const API_TOKEN = "YOUR_API_TOKEN";
const ORG_ID = "YOUR_ORGANIZATION_ID";
const BASE_URL = "https://api.turbodocx.com";

// Prepare documents array - each document represents one signing job
const documents = [
{
recipients: [
{
name: 'John Smith',
email: 'john.smith@company.com',
signingOrder: 1
}
],
fields: [
{
recipientEmail: 'john.smith@company.com',
type: 'signature',
page: 1,
x: 100,
y: 200,
width: 200,
height: 80,
required: true
},
{
recipientEmail: 'john.smith@company.com',
type: 'date',
page: 1,
x: 100,
y: 300,
width: 150,
height: 30,
required: true
}
],
documentName: 'Employment Contract - John Smith',
documentDescription: 'Please review and sign your employment contract'
},
{
recipients: [
{
name: 'Jane Doe',
email: 'jane.doe@company.com',
signingOrder: 1
}
],
fields: [
{
recipientEmail: 'jane.doe@company.com',
type: 'signature',
page: 1,
x: 100,
y: 200,
width: 200,
height: 80,
required: true
},
{
recipientEmail: 'jane.doe@company.com',
type: 'date',
page: 1,
x: 100,
y: 300,
width: 150,
height: 30,
required: true
}
],
documentName: 'Employment Contract - Jane Doe',
documentDescription: 'Please review and sign your employment contract'
}
];

// Create form data
const formData = new FormData();
formData.append('sourceType', 'file');
formData.append('file', fs.createReadStream('./contract_template.pdf'));
formData.append('batchName', 'Q4 Employment Contracts');
formData.append('documentName', 'Employment Contract');
formData.append('documentDescription', 'Please review and sign your employment contract');
formData.append('senderName', 'HR Department');
formData.append('senderEmail', 'hr@company.com');
formData.append('documents', JSON.stringify(documents));

// Send request to bulk ingest endpoint
const response = await fetch(`${BASE_URL}/turbosign/bulk/ingest`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_TOKEN}`,
'x-rapiddocx-org-id': ORG_ID,
'User-Agent': 'TurboDocx API Client',
...formData.getHeaders()
},
body: formData
});

const result = await response.json();

if (result.success) {
console.log('✅ Bulk batch created successfully');
console.log('Batch ID:', result.batchId);
console.log('Batch Name:', result.batchName);
console.log('Total Jobs:', result.totalJobs);
console.log('Status:', result.status);
console.log('\n📧 Documents will be sent to recipients asynchronously');
console.log('💡 Tip: Use the batch ID to monitor progress and list jobs');
} else {
console.error('❌ Error:', result.error || result.message);
if (result.code) {
console.error('Error Code:', result.code);
}
if (result.data?.invalidDocuments) {
console.error('Invalid Documents:', JSON.stringify(result.data.invalidDocuments, null, 2));
}
}
Loading