Quickstart
Your first document, read in three steps.
- Create a free account.
- In the app, open API keys and create a key. Copy it now: it is shown only once.
- Send your first document:
export SANDS_API_KEY=sand_live_...
curl https://api.100sands.com/v1/text \
-H "Authorization: Bearer $SANDS_API_KEY" \
-F [email protected]Authentication
Send your key as Authorization: Bearer sand_live_… or as X-API-Key. Keys start with sand_live_, so they are easy to spot if one leaks. Delete a key in the app at any time; it stops working immediately.
Endpoints
The base address is https://api.100sands.com. Send a file as a file field in multipart/form-data, or send JSON with a fileUrl. Responses are JSON.
| Endpoint | Fields | Returns |
|---|---|---|
| GET /v1/me | none | The account the key belongs to: its email and plan. Use it to test a key. |
| GET /v1/document-types | none | Your document types that have a live version, with their fields. |
| POST /v1/text | file | fileUrl | The file's text: lines in reading order, cells separated by tabs, pages by a form feed. |
| POST /v1/document-types/{id}/extract | file | fileUrl, fileName, version | The fields of one of your document types, as JSON. Uses the live version unless you pass version. |
| POST /v1/classify | file | fileUrl, extract | Which of your document types the file is, with a score. With extract=true, its fields too. |
| GET /v1/extractions | documentTypeId, limit | Your recent results, newest first, up to 100 at a time. |
| POST /v1/webhooks | url, documentTypeId, source | Subscribes a URL to document.extracted events. Returns the webhook's id and signing secret. |
| DELETE /v1/webhooks/{id} | none | Removes a webhook subscription. |
| GET /v1/webhooks/sample | documentTypeId | One example result with a document type's fields, for setting up an integration. |
Files and limits
Every endpoint that reads a file takes the same files, and counts one document per file, whatever its page count.
- PDF files that contain text. A PDF where only some pages have text is read with the other pages left blank.
- HTML
- HTML pages and files (.html, .htm).
- Size
- Up to 50 MB per file. Samples for a document type: up to 10 MB each, at most 5 per type.
- By link
- Instead of uploading, send JSON with fileUrl. The link must be https, at most 50 MB, and on a public address. It is fetched with a 20-second timeout.
Scans, photos and images are not read. A PDF without a text layer, such as a scan, is refused with 422 NO_TEXT_IN_FILE, and a password-protected PDF with 422 ENCRYPTED_PDF. Other kinds of file, including Word, Excel, CSV and text files, are refused with 415 UNSUPPORTED_FILE. Refused files are not counted.
Text
POST /v1/text returns the number of pages and the whole text as one string. Each line comes back in reading order, including right-to-left lines. Table cells on the same line are separated by a tab (\t), and pages by a form feed (\f).
curl https://api.100sands.com/v1/text \
-H "Authorization: Bearer $SANDS_API_KEY" \
-F [email protected]
{
"pages": 3,
"text": "COMPANY EXTRACT\nCompany name\tHarbor Lane Logistics Ltd\nCompany number\t51-482913-6\nStatus\tActive\n..."
}The same call with a link instead of a file:
curl https://api.100sands.com/v1/text \
-H "Authorization: Bearer $SANDS_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "fileUrl": "https://example.com/files/company-extract.pdf" }'Document types
A document type returns named fields instead of raw text. Set one up in the app: upload 1 to 5 samples, check the fields and each sample's values that AI suggests, and let AI build the extraction. The build is ready only when every field matches on every sample, and the first version that is ready goes live.
curl https://api.100sands.com/v1/document-types/42/extract \
-H "Authorization: Bearer $SANDS_API_KEY" \
-F [email protected]
{
"id": "ext_8Kq2Vd",
"documentType": { "id": 42, "name": "Company registry extract" },
"version": 2,
"fileName": "company-extract.pdf",
"pages": 3,
"createdAt": "2026-12-04T09:12:44Z",
"fields": {
"companyName": "Harbor Lane Logistics Ltd",
"companyNumber": "51-482913-6",
"status": "Active",
"registeredOn": "2019-03-14",
"shareCapital": 1250.5,
"directors": ["Dana Levi", "Omar Haddad"],
"charges": [
{ "chargeNumber": "1", "holder": "Harbor Credit Ltd", "status": "Active" },
{ "chargeNumber": "2", "holder": "Quay Street Bank", "status": "Released" }
],
"liquidator": null
}
}Field values
- Text
- A string, or null when it isn't in the document.
- Number
- A JSON number, or null.
- Date
- A string, as YYYY-MM-DD when the date format is known, or null.
- Yes/no
- true or false, or null.
- List
- An array of strings, or [] when nothing is found.
- Table
- An array of rows, each an object with one value per column, or [] when nothing is found.
Field values are never guessed. A value that isn't in the document comes back as null, or as [] for list and table fields.
Versions
Every change to a document type's fields is a new version, built and checked against all its samples. Calls use the live version, and you choose in the app when a new version becomes live. The response says which version answered. To stay on one version while you change the type, pass it:
curl "https://api.100sands.com/v1/document-types/42/extract?version=1" \
-H "Authorization: Bearer $SANDS_API_KEY" \
-F [email protected]Your document types
GET /v1/document-types lists the document types that have a live version, with their ids and fields.
Classification
When files arrive mixed, POST /v1/classify tells which of your document types a file is. It compares the file with every document type that has a live version. Add extract=true to get the matched type's fields in the same call.
curl "https://api.100sands.com/v1/classify?extract=true" \
-H "Authorization: Bearer $SANDS_API_KEY" \
-F [email protected]
{
"result": "matched",
"documentType": { "id": 42, "name": "Company registry extract" },
"score": 0.94,
"candidates": [
{ "id": 42, "name": "Company registry extract", "score": 0.94 },
{ "id": 57, "name": "Supplier invoice", "score": 0.18 }
],
"pages": 3,
"extraction": {
"id": "ext_9Pw4Lc",
"documentType": { "id": 42, "name": "Company registry extract" },
"version": 2,
"fields": { "companyName": "Harbor Lane Logistics Ltd", "companyNumber": "51-482913-6" }
}
}- matched
- One type fits: documentType names it, with its score from 0 to 1.
- ambiguous
- Two or more types fit about as well as each other; they are at the top of candidates. Add a phrase in the app that only one type's documents contain, such as a supplier's name, to tell them apart.
- none
- No document type fits the file well enough.
- extract=true
- With a match, the result also has extraction, as /v1/document-types/{id}/extract returns it. If that part fails, the classification is still returned, with extraction.error and extraction.message.
candidates lists up to 5 document types, best first, each with its score.
Results
GET /v1/extractions returns your recent results, newest first, up to 100 at a time. Filter by documentTypeId and set limit. Results are kept for 30 days, or 90 days on Pro.
curl "https://api.100sands.com/v1/extractions?documentTypeId=42&limit=20" \
-H "Authorization: Bearer $SANDS_API_KEY"Webhooks
A webhook sends each result to your server as soon as a document is extracted. Add one in the app, or subscribe from code with POST /v1/webhooks, optionally for one document type. The URL must be https and on a public address. The response holds the signing secret, shown only once.
curl https://api.100sands.com/v1/webhooks \
-H "Authorization: Bearer $SANDS_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "url": "https://example.com/hooks/100sands", "documentTypeId": 42 }'
{ "id": 12, "secret": "whsec_..." }Delivery
- Each event is a POST with a JSON body and the header
X-100sands-Event: document.extracted. - A 2xx response counts as delivered. Otherwise it is sent again after 1 minute, 5 minutes, 30 minutes, 2 hours and 6 hours.
- In the app you can send a test event to check your endpoint.
POST /hooks/100sands
X-100sands-Event: document.extracted
X-100sands-Signature: t=1764839564,v1=5f2c…
{
"id": "evt_3Hn7Qa",
"type": "document.extracted",
"createdAt": "2026-12-04T09:12:44Z",
"data": {
"extractionId": "ext_8Kq2Vd",
"documentType": { "id": 42, "name": "Company registry extract" },
"version": 2,
"fileName": "company-extract.pdf",
"pages": 3,
"fields": { "companyName": "Harbor Lane Logistics Ltd", "companyNumber": "51-482913-6" }
}
}Checking the signature
Every delivery carries X-100sands-Signature: t=…,v1=…. v1 is the hex HMAC-SHA256 of the timestamp, a dot and the raw request body, keyed with your webhook's secret. Compute it yourself, compare, and reject old timestamps:
import crypto from "node:crypto";
// header: the X-100sands-Signature header; rawBody: the request body as received, before parsing.
export function isFrom100sands(header, rawBody, secret) {
const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
const age = Math.abs(Date.now() / 1000 - Number(parts.t));
if (!parts.t || !parts.v1 || age > 300) return false; // older than 5 minutes
const expected = crypto.createHmac("sha256", secret).update(`${parts.t}.${rawBody}`).digest("hex");
const a = Buffer.from(expected);
const b = Buffer.from(parts.v1);
return a.length === b.length && crypto.timingSafeEqual(a, b);
}Without code
Anyone on your account can read documents with a document type and get a spreadsheet back, without an API key.
- In the app, open Uploads and start a new upload for one of your document types.
- Add the files, or drop a whole folder. Up to 500 files and 500 MB in one upload, each file up to 50 MB.
- Start it. The files are read in the background, so you can close the page.
- Download the results as Excel or CSV.
The spreadsheet
- Rows
- One row per file, with its name.
- Columns
- One column per field, named as in the document type.
- Lists
- One cell, with each value on its own line.
- Tables
- In Excel, a sheet of their own. In CSV, one cell holding the rows as JSON.
Each file in an upload counts as one document. A file that can't be read is marked with the reason and isn't counted. Up to 2 uploads can be open or running at once.
Errors
Errors are JSON: { "error": "CODE", "message": "…" }. The message is a plain sentence you can show as it is. Refused and failed calls are not counted.
| Status | Code | Meaning |
|---|---|---|
| 400 | VALIDATION_FAILED, BAD_REQUEST | The request is invalid. With VALIDATION_FAILED, fields says what is wrong with each field. |
| 401 | INVALID_API_KEY | The API key is missing, wrong or deleted. |
| 403 | UPGRADE_REQUIRED | Your plan's limit is reached. reason says which: document_types, api_keys, ai_runs or documents. |
| 404 | NOT_FOUND | The document type, version, result or webhook doesn't exist. |
| 409 | CONFLICT | The request conflicts with the current state, for example a document type that isn't live yet. |
| 413 | FILE_TOO_LARGE | The file is larger than allowed. limitBytes gives the limit. |
| 415 | UNSUPPORTED_FILE | Only PDF and HTML files that contain text are read. |
| 422 | NO_TEXT_IN_FILE | The PDF has no text layer, such as a scan. |
| 422 | ENCRYPTED_PDF | The PDF is password-protected. |
| 422 | UNREADABLE_FILE | The file is damaged or can't be read. |
| 422 | EXTRACTION_FAILED | The document couldn't be read as that document type. |
| 429 | QUOTA_EXCEEDED | This month's documents are used up. limit, used and resetsAt say how many and when they start again. |
| 503 | SERVICE_BUSY, AI_UNAVAILABLE | The service is busy, or AI is briefly unavailable during setup. Try again in a moment. |
Each plan has a number of documents a month and of calls at the same time. See pricing for each plan's limits.