API Documentation
Detect signatures in images and PDFs with a single REST endpoint.
Machine-readable contract: OpenAPI 3.1. Official packages are coming soon. Call the API directly with the fetch, requests, and curl examples.
All API requests require authentication using an API key. Include your API key in the request header x-api-key.
x-api-key: your_api_key_hereEndpoints
Parameters
imageUrlImage URL. A PDF at this URL is detected automatically.imageBase64Image base64, raw or data URL. PDF magic bytes (%PDF) are detected automatically.pdfUrlhttp(s) URL of a PDF.pdfBase64PDF base64, raw or data:application/pdf;base64,...thresholdOptional image confidence cutoff from 0 to 1. Defaults to 0.1. PDFs stay at 0.1.Provide exactly one of the four fields. Image responses are unchanged from the original API.
Image request
{
"imageUrl": "https://example.com/document.jpg"
}Image response
{
"success": true,
"result": {
"detections": [
{
"bbox": { "x1": 321.23, "y1": 373.39, "x2": 647.21, "y2": 501.68 },
"confidence": 0.192,
"class": 0,
"class_name": "signature"
}
],
"count": 1,
"confidenceThreshold": 0.1
},
"creditsRemaining": 9999,
"detectionId": "clxxxx..."
}detectionId is omitted when the result could not be stored. cached is present and true when the result was served from cache and no credit was spent. Images default to a confidence threshold of 0.1 and accept an optional threshold. PDFs use 0.1.
PDF request
{
"pdfUrl": "https://example.com/contract.pdf"
}Or send pdfBase64. Sending the same bytes as imageUrl or imageBase64 also works: the server checks the %PDF header and Content-Type.
PDF response
{
"success": true,
"documentType": "pdf",
"signed": true,
"count": 1,
"pageCount": 2,
"confidenceThreshold": 0.1,
"pages": [
{
"page": 1,
"width": 1275,
"height": 1650,
"detections": [
{
"bbox": { "x1": 120.5, "y1": 980.2, "x2": 460.8, "y2": 1104.0 },
"confidence": 0.91,
"class": 0,
"class_name": "signature"
}
],
"count": 1
}
],
"creditsUsed": 2,
"creditsRemaining": 98,
"detectionId": "clxxxx..."
}signed is true when count (signatures on all pages) is greater than zero.
page is 1-based. width and height are pixels of the raster sent to the model. Each box is detections[].bbox in that pixel space, with confidence.
pages, count, and creditsUsed are top-level. A 5-page PDF costs 5 credits.
Pages are rendered at 150 DPI. The longest side is capped at 2000 pixels, so a US Letter page is 1275×1650.
The balance is checked against the page count before any page is rasterized or detected. If there are not enough credits, the API returns 402 and does not process or charge any page.
A repeated document is served from cache and costs 0 credits (cached: true). The cache is the whole file, the same as images, so a cached PDF is not charged again.
SDKs
Call POST /api/detect directly. The code examples use fetch, requests, and curl for images and PDFs.
Code Examples
Images
const response = await fetch('https://signature-detector.com/api/detect', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': 'your_api_key_here'
},
body: JSON.stringify({
imageUrl: 'https://example.com/document.jpg',
threshold: 0.1
})
});
const data = await response.json();
console.log('Signatures found:', data.result.count);PDFs
import { readFile } from 'node:fs/promises'
const pdfBase64 = (await readFile('contract.pdf')).toString('base64')
const response = await fetch('https://signature-detector.com/api/detect', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': 'your_api_key_here'
},
body: JSON.stringify({ pdfBase64 })
})
const data = await response.json()
if (!response.ok) {
throw new Error(data.error)
}
console.log(data.signed ? 'Signed' : 'Unsigned', data.count, 'signatures')
console.log('credits used', data.creditsUsed)
for (const page of data.pages) {
for (const hit of page.detections) {
console.log(
'page', page.page,
hit.confidence.toFixed(2),
hit.bbox
)
}
}1 credit per image
Unchanged
1 credit per PDF page
Checked before any page is processed
Cache hits are free
Same document hash and threshold