API documentation

Read the text or your own fields from PDF and HTML files with one HTTP call and an API key.

Last updated December 4, 2026 · The whole reference as Markdown, for AI tools

Quickstart

Your first document, read in three steps.

  1. Create a free account.
  2. In the app, open API keys and create a key. Copy it now: it is shown only once.
  3. Send your first document:
Example
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.

EndpointFieldsReturns
GET /v1/menoneThe account the key belongs to: its email and plan. Use it to test a key.
GET /v1/document-typesnoneYour document types that have a live version, with their fields.
POST /v1/textfile | fileUrlThe file's text: lines in reading order, cells separated by tabs, pages by a form feed.
POST /v1/document-types/{id}/extractfile | fileUrl, fileName, versionThe fields of one of your document types, as JSON. Uses the live version unless you pass version.
POST /v1/classifyfile | fileUrl, extractWhich of your document types the file is, with a score. With extract=true, its fields too.
GET /v1/extractionsdocumentTypeId, limitYour recent results, newest first, up to 100 at a time.
POST /v1/webhooksurl, documentTypeId, sourceSubscribes a URL to document.extracted events. Returns the webhook's id and signing secret.
DELETE /v1/webhooks/{id}noneRemoves a webhook subscription.
GET /v1/webhooks/sampledocumentTypeIdOne 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
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).

POST /v1/text
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:

POST /v1/text
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.

POST /v1/document-types/42/extract
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:

Example
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.

POST /v1/classify?extract=true
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.

GET /v1/extractions
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.

POST /v1/webhooks
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.
document.extracted
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:

Node.js
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.

  1. In the app, open Uploads and start a new upload for one of your document types.
  2. Add the files, or drop a whole folder. Up to 500 files and 500 MB in one upload, each file up to 50 MB.
  3. Start it. The files are read in the background, so you can close the page.
  4. 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.

StatusCodeMeaning
400VALIDATION_FAILED, BAD_REQUESTThe request is invalid. With VALIDATION_FAILED, fields says what is wrong with each field.
401INVALID_API_KEYThe API key is missing, wrong or deleted.
403UPGRADE_REQUIREDYour plan's limit is reached. reason says which: document_types, api_keys, ai_runs or documents.
404NOT_FOUNDThe document type, version, result or webhook doesn't exist.
409CONFLICTThe request conflicts with the current state, for example a document type that isn't live yet.
413FILE_TOO_LARGEThe file is larger than allowed. limitBytes gives the limit.
415UNSUPPORTED_FILEOnly PDF and HTML files that contain text are read.
422NO_TEXT_IN_FILEThe PDF has no text layer, such as a scan.
422ENCRYPTED_PDFThe PDF is password-protected.
422UNREADABLE_FILEThe file is damaged or can't be read.
422EXTRACTION_FAILEDThe document couldn't be read as that document type.
429QUOTA_EXCEEDEDThis month's documents are used up. limit, used and resetsAt say how many and when they start again.
503SERVICE_BUSY, AI_UNAVAILABLEThe 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.