# Creating a new template via API
Source: https://docs.useinkless.com/api-reference/createNewTemplate
A guide on how to create a new template via API
### Create a Template via API Key: POST `/createNewTemplate`
Use this API to create a reusable template from a PDF. Optionally include `recipients` to immediately instantiate a document and send notifications.
## Endpoint and Auth
* **Method**: `POST`
* **Path**: `/createNewTemplate`
* **Auth**: Header `x-api-key: YOUR_API_KEY`
* **Content-Type**: `multipart/form-data`
## Multipart form fields
* **Required**
* `document` (file, binary): The template PDF or DOCX file to upload (Note: You can upload a DOCX file, it will be converted to a PDF).
* `templateName` (string): A human-readable name for the template.
* `fields` (JSON string): Array of arrays representing fields grouped by recipient index.
* Each inner array corresponds to a recipient’s field group.
* Field object shape:
* `id` (string): Stable ID for the field (e.g., `sig-1`).
* `x` (number), `y` (number): Position on the page.
* `page` (integer): 1-based page index.
* `type` (string): e.g., `Signature`, `Text`.
* `recipient` (integer): Group index this field belongs to.
* **Optional**
* `recipients` (JSON string): If provided, the server immediately creates a document instance from the template and notifies these recipients.
* Array of objects `{ name: string, email: string, phone?: string }`
* `autoReleaseSignatures` (boolean): Defaults to `true` if omitted; auto-finalize when all signatures are collected.
## Important notes
* Do NOT manually set the `Content-Type` header for multipart; let your HTTP client set the boundary.
* `fields` and `recipients` must be JSON-encoded strings in the form data.
* Coordinates `(x, y)` and `page` should match your PDF’s coordinate system (page is 1-based).
## Example: Node.js to upload PDF
```ts theme={null}
import fs from 'fs';
async function createNewTemplate() {
const url = 'http://api.useinkless/createNewTemplate';
const apiKey = 'your_api_key';
const form = new FormData();
// File: final.pdf
const fileBuffer = fs.readFileSync('final.pdf');
const pdfBlob = new Blob([fileBuffer], { type: 'application/pdf' });
form.append('document', pdfBlob, 'final.pdf');
// Template name
form.append('templateName', 'Example Template Name');
// Fields: 1 recipient group, 1 signature field
const fields = [[
{ id: 'sig-1', x: 144, y: 418, page: 1, type: 'Signature', recipient: 1 }
]];
form.append('fields', JSON.stringify(fields));
// Optional: recipients to immediately instantiate and notify
const recipients = [{ name: 'Michael', email: 'michael@useinkless.com' }];
form.append('recipients', JSON.stringify(recipients));
const resp = await fetch(url, {
method: 'POST',
headers: { 'x-api-key': apiKey },
body: form
});
const text = await resp.text();
const data = (() => { try { return JSON.parse(text); } catch { return text; } })();
console.log(resp.ok ? 'Success' : 'Error', resp.status, data);
}
```
## Example: Node.js to upload a DOCX
```ts theme={null}
import fs from 'fs';
async function createNewTemplate() {
const url = 'http://api.useinkless/createNewTemplate';
const apiKey = 'your_api_key';
const form = new FormData();
// File: Important_Contract.docx
const fileBuffer = fs.readFileSync('Important_Contract.docx');
const docxBlob = new Blob([fileBuffer], {
type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
});
// Server expects field name 'document' (multer.single('document'))
form.append('document', docxBlob, 'Important_Contract.docx');
// Template name
form.append('templateName', 'Example Template Name');
// Fields: 1 recipient group, 1 signature field
const fields = [[
{ id: 'sig-1', x: 144, y: 418, page: 1, type: 'Signature', recipient: 1 }
]];
form.append('fields', JSON.stringify(fields));
// Optional: recipients to immediately instantiate and notify
const recipients = [{ name: 'Michael', email: 'michael@useinkless.com' }];
form.append('recipients', JSON.stringify(recipients));
const resp = await fetch(url, {
method: 'POST',
headers: { 'x-api-key': apiKey },
body: form
});
const text = await resp.text();
const data = (() => { try { return JSON.parse(text); } catch { return text; } })();
console.log(resp.ok ? 'Success' : 'Error', resp.status, data);
}
```
## Example: cURL
```bash theme={null}
curl -X POST http://api.useinkless.com/createNewTemplate \
-H 'x-api-key: YOUR_API_KEY' \
-F 'document=@final.pdf;type=application/pdf' \
-F 'templateName=Template Name' \
-F 'fields=[[
{"id":"sig-1","x":144,"y":418,"page":1,"type":"Signature","recipient":1}
]]' \
-F 'recipients=[{"name":"Michael","email":"michael@useinkless.com"}]'
```
## Successful responses
* Template only (no recipients):
```json theme={null}
{
"message": "Template created successfully",
"template_id": "b4e2e25f-3a43-4e6c-9df9-3c6c1a2f13a1",
"s3_url": "templates/final.pdf",
"fields": [
[
{ "id": "sig-1", "x": 144, "y": 418, "page": 1, "type": "Signature", "recipient": 1 }
]
]
}
```
* Template created and document sent (with recipients):
```json theme={null}
{
"message": "Template created and PDF created successfully",
"template_id": "b4e2e25f-3a43-4e6c-9df9-3c6c1a2f13a1",
"pdf_id": "fdb3c602-ef01-43c7-9874-ff096443ff48",
"s3_url": "templates/final.pdf",
"fields": [
{
"id": "sig-1",
"x": 144,
"y": 418,
"page": 1,
"type": "Signature",
"recipient": { "email": "michael@useinkless.com", "name": "Michael" }
}
],
"recipients": ["michael@useinkless.com"]
}
```
## Error responses
* 400 Bad Request:
* `{ "message": "No file uploaded." }`
* `{ "message": "Template name is required." }`
* `{ "message": "Invalid fields data." }`
* `{ "message": "Recipients must be an array." }`
* 401 Unauthorized:
* `{ "message": "API key is required." }`
* `{ "message": "Invalid or expired API key." }`
* 500 Internal Server Error:
* `{ "message": "Internal Server Error" }`
# Create New Document To Sign From a Template
Source: https://docs.useinkless.com/api-reference/endpoint/create
POST /createFromTemplate
Sends a message using a predefined template to one or more recipients. We recommend selecting 'Auto-release signatures when complete' when creating your template on Inkless.
# Create a new template
Source: https://docs.useinkless.com/api-reference/endpoint/createNewTemplate
POST /createNewTemplate
Creates a template from an uploaded PDF or DOCX and template fields. If `recipients` are provided, a PDF instance is immediately created from the template and recipient notifications are sent. [See the guide for implementing createNewTemplate](/api-reference/createNewTemplate).
# Delete a webhook
Source: https://docs.useinkless.com/api-reference/endpoint/deleteWebhook
POST /deleteWebhook
Removes a webhook registration based on the provided URL for the authenticated user.
# Get all document details on the account
Source: https://docs.useinkless.com/api-reference/endpoint/getAllDocuments
GET /getAllDocuments
Returns all documents owned by the user associated with the provided API key. Each document includes its metadata, a presigned public URL, and recipient information.
# Get document details for one specific document ID
Source: https://docs.useinkless.com/api-reference/endpoint/getDocumentDetails
GET /getDocumentDetails
Fetch detailed information for a specific document by its ID. Includes document metadata, recipient information, and a temporary URL to the final signed PDF if the document has been completed.
# Register a webhook to get events
Source: https://docs.useinkless.com/api-reference/endpoint/registerWebhook
POST /registerWebhook
Subscribe to events (e.g., 'document.signed') by providing a URL where webhook notifications should be sent.
# Introduction
Source: https://docs.useinkless.com/api-reference/introduction
API reference for the Inkless e-sign tool
If you're not looking to build on top of the Inkless API, you should use the no-code webapp at [https://app.useinkless.com/](https://app.useinkless.com/)
## API overview
At a high level, our APIs allow you send out pre-created templates to recipients and receive webhook events when recipients sign.
We recommend selecting "Auto-release signatures when complete" when creating your template. When enabled, this setting automatically sends the final PDF with signatures once everyone has signed. If this is not enabled, you will need to manually review and release signatures even after everyone has signed.
Why pre-created templates? This is because setting the fields is easier in our UI. We will eventually build an API to create PDFs/templates by passing in the x,y coordinates but this may be a little harder to get right and would require some guess and checks.
When events happen, such as when recipients sign, you can opt to receive webhooks. This will let you know and allow you to trigger your own notifications, such as an email alert.
## Authentication
All API endpoints are authenticated using Bearer tokens. Email [hello@useinkless.com](mailto:hello@useinkless.com) to get started with your API key.
# Webhooks
Source: https://docs.useinkless.com/api-reference/webhooks
How to use webhooks with the e-sign API
If you're not looking to build on top of the API, you can use the no-code webapp at [https://app.useinkless.com/](https://app.useinkless.com/)
## Overview
Webhooks allow your application to receive real-time notifications when important events occur in your e-sign workflow, such as when a document is signed or a finalized PDF is generated. By registering a webhook, you can automate downstream actions (e.g., send emails, update your CRM, etc.) whenever these events happen.
## Registering a Webhook
To receive webhook notifications, you must first register your webhook endpoint using the `/registerWebhook` API.
### Endpoint
POST /registerWebhook
### Request Headers
* `x-api-key`: **(required)** Your API key for authentication.
### Request Body
```json theme={null}
{
"user_id": "your-user-id",
"url": "https://yourdomain.com/webhook-endpoint",
"eventType": "document.signed", // or "document.finalized"
"secret": "optional-secret-key"
}
```
* user\_id: Your user ID (provided when you sign up for API access).
* url: The HTTPS endpoint that will receive webhook events.
* eventType: The event to subscribe to. Supported values:
* document.signed — triggered when a recipient signs a document.
* document.finalized — triggered when the final, signed PDF is available.
* secret (optional): If provided, webhook payloads will be signed so you can verify authenticity.
Example Request
```
curl -X POST https://api.useinkless.com/registerWebhook \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"user_id": "user-123",
"url": "https://yourdomain.com/webhook",
"eventType": "document.signed"
}'
```
Response
```json theme={null}
{
"message": "Webhook registered",
"webhook": {
"webhook_id": "abc123",
"url": "https://yourdomain.com/webhook",
"eventType": "document.signed"
}
}
```
## Supported Webhook Events
| Event Name | Description |
| -------------------- | ---------------------------------------------------------- |
| `document.signed` | Triggered when a recipient signs a document. |
| `document.finalized` | Triggered when the final signed PDF is available to owner. |
## Webhook Payloads
When your webhook is triggered, your endpoint will receive a POST request with a JSON payload. The structure depends on the event.
### document.signed Event
```json theme={null}
{
"event": "document.signed",
"pdf_id": "pdf-123",
"recipient": {
"name": "Recipient Name",
"email": "recipient@example.com",
"recipientHash": "hash123"
},
"completed_fields": [
// ... array of completed field objects
],
"status": "signed"
}
```
* event: The event type.
* pdf\_id: The unique identifier for the document.
* recipient: The recipient who signed (name, email, and a unique hash).
* completed\_fields: Information about completed fields (see API reference for structure).
* status: The current status of the document.
### document.finalized Event
```json theme={null}
{
"event": "document.finalized",
"pdf_id": "pdf-123",
"final_pdf_url": "https://s3.amazonaws.com/your-bucket/final_document.pdf"
}
```
* event: The event type.
* pdf\_id: The unique identifier for the document.
* final\_pdf\_url: A secure, time-limited URL to download the finalized PDF.
## Authenticating Webhook Requests
If you provided a secret when registering your webhook, each webhook request will include a signature header (x-webhook-signature) that you can use to verify the authenticity of the payload. (See below for verification instructions.)
## Handling Webhooks
Your endpoint should:
Respond with HTTP 200 OK as soon as possible.
Validate the payload signature if a secret is used.
Process the event according to your business logic.
Example Webhook Handler (Node.js/Express)
```js theme={null}
app.post('/webhook', express.json(), (req, res) => {
const event = req.body.event;
if (event === 'document.signed') {
// Handle document signed
} else if (event === 'document.finalized') {
// Handle finalized PDF
}
res.status(200).send('OK');
});
```
## Authentication
All API endpoints are authenticated using Bearer tokens or API keys. Email [hello@useinkless.com](mailto:hello@useinkless.com) to get started with your API key.
If you need more details or want to see sample payloads for other events, please reach out to support.
# Introduction
Source: https://docs.useinkless.com/introduction
Welcome the Inkless's API docs for e-signing!
## Get started
Our APIs for e-signing are evolving - if you have any requests send an email to [hello@useinkless.com](mailto:hello@useinkless.com)
Get started with Inkless's API to send out docs for signatures
## Use Cases
With Inkless's APIs for e-signing, you can:
* Send sales contracts programatically via CRMs like Salesforce or Hubspot
* Send onboarding agreements for new SaaS customers via Inkless's API
* Send purchase agreements programatically to a large number of customers
We allow you to easily and programatically send PDF template contracts for signing at scale via API!
# Quickstart
Source: https://docs.useinkless.com/quickstart
Start building an integration with Inkless's e-sign tool
## Get your API key
Email [hello@useinkless.com](mailto:hello@useinkless.com) a request for an API key. Make sure to include:
* Your use case
* Your estimated monthly volume
* Any additional feature requests
### Create a template using our Inkless webapp
We recommend selecting "Auto-release signatures when complete". When enabled, this setting automatically sends the final PDF with signatures once everyone has signed. If this is not enabled, you will need to manually review and release signatures even after everyone has signed.
Create an account, login, upload a PDF, and create a template at [https://app.useinkless.com/templates](https://app.useinkless.com/templates). The webapp is so that you can use our UI to drag and drop fields, then you will use our API and the template to programatically send PDFs to recipients via email to sign.
### After creating a template, grab the template ID.
## Using your API key, call the `createFromTemplate` API
Call the `createFromTemplate` API and specify your templateId and list of recipients with their email and name. The number of recipients must match the number of recipients in the template you created!
```typescript theme={null}
import axios from 'axios';
async function sendTemplateEmail(): Promise {
const url = 'https://api.useinkless.com/createFromTemplate';
const apiKey = 'test_api_key';
const data = {
templateId: 'your_template_id',
recipients: [
{
email: 'hello@useinkless.com',
name: 'Test User'
}
]
};
try {
const response = await axios.post(url, data, {
headers: {
'Content-Type': 'application/json',
'x-api-key': apiKey
}
});
console.log('Response status:', response.status);
console.log('Response data:', response.data);
} catch (error: unknown) {
if (axios.isAxiosError(error)) {
console.error('API Error:');
console.error('Status:', error.response?.status);
console.error('Data:', error.response?.data);
} else {
console.error('Error during API test:', error);
}
}
}
sendTemplateEmail();
```