llms.txt Content
# DocSpring Integration Guide
## Quick Start
1. Install the official client library:
# Node.js
npm install docspring
# Python
pip install docspring
# Ruby
gem install docspring
# PHP
composer require docspring/docspring-php
# Java
<dependency>
<groupId>com.docspring</groupId>
<artifactId>docspring</artifactId>
<version>1.1.1</version>
</dependency>
2. Basic PDF generation (Python example):
import docspring
import urllib.request
client = docspring.Client()
client.api_client.configuration.username = "YOUR_API_TOKEN_ID"
client.api_client.configuration.password = "YOUR_API_TOKEN_SECRET"
response = client.generate_pdf({
"template_id": "tpl_xxx",
"test": True,
"data": {
"first_name": "John",
"last_name": "Smith"
}
})
urllib.request.urlretrieve(response.submission.download_url, "output.pdf")
## Core Concepts
1. Templates
- Manage at https://app.docspring.com
- Each template has a unique ID (e.g. tpl_xxx)
- Define field names, types, and validation
- Get the template_id from the URL or the “API” tab
2. Authentication
- Generate tokens at https://app.docspring.com/api_tokens
- Test tokens (test_xxx) produce watermarked PDFs
- Live tokens (live_xxx) produce production PDFs
- Use HTTP Basic auth with token_id:token_secret
- Don’t commit tokens to source control
3. PDF Generation
- Synchronous (recommended): sync.api.docspring.com returns the finished PDF immediately.
- Can use sync subdomain for all API requests.
- Append "?wait=false" to the URL to return a pending submission immediately.
- Asynchronous: api.docspring.com returns a submission ID, then you poll for completion
- For EU region: sync.api-eu.docspring.com or api-eu.docspring.com
## Advanced Features
1. Batch Processing
response = client.batch_generate_pdfs({
"template_id": "tpl_xxx",
"submissions": [