SmartDMS
// Getting started

The SmartDMS Guide

Everything from your first upload to approval chains and plain-English search — in thirteen short chapters.

// Chapter 13

The API

Connect another system to SmartDMS. Push documents in, read the fields that were extracted back out, and keep your own database in step.

Available on Team and up

Everything on this page is live today at https://api.smartdms.ai/v1. If your system can send a file or read JSON, it can work with SmartDMS.

Authenticating

The account owner generates a key in the product under Settings, then Connections. Send it as a bearer token on every request:

Header
Authorization: Bearer smdms_your_key_here
The key is shown once, when you create it. Copy it then and store it somewhere safe. If it is lost, revoke it and generate another. A revoked key stops working immediately.

Every key is either read-only or read and write, chosen when you create it. A read-only key can list and download but can never upload or change anything, which makes it the right choice for a backup client, a reporting tool or a dashboard. Scope is checked on every request against the live setting, so tightening a key takes effect at once rather than at the next sign in.

Documents

GET /v1/documents lists them. All parameters are optional.

ParameterNotes
limit1 to 200. Defaults to 50
offsetSimple paging
cursorOpaque cursor for delta paging. Preferred when syncing
updated_sinceISO 8601 timestamp. Only documents changed since then
folder_idRestrict to one folder
Request
curl -H "Authorization: Bearer $SMARTDMS_KEY" \
  "https://api.smartdms.ai/v1/documents?limit=50&updated_since=2026-10-01T00:00:00Z"
Response
{
  "items": [
    {
      "id": "7b2f...",
      "filename": "invoice-4471.pdf",
      "document_type": "invoice",
      "status": "ready",
      "folder_id": "a19c...",
      "created_at": "2026-10-08T14:02:11",
      "updated_at": "2026-10-08T14:02:48",
      "content_hash": "9f86d0..."
    }
  ],
  "total": 128,
  "limit": 50,
  "offset": 0,
  "next_cursor": "eyJ1Ijoi..."
}
When syncing, page with the cursor rather than the offset. Pass the next_cursor you were given back as cursor on the next call and keep going while it is not null. Offset paging can miss or repeat a row if documents change while you are part way through a long list. The cursor cannot.

status is pending while a document is being read, ready once processing has finished, and failed if it could not be processed. Extracted fields are only reliable once a document is ready.

Reading the extracted fields

This is the one most integrations want. GET /v1/documents/{id} returns everything above, plus a summary and the fields SmartDMS read off the document.

Response, additional keys
{
  "summary": "Invoice from Trent Plumbing Supplies, due 30 November.",
  "extracted_fields": {
    "invoice_number": "4471",
    "total": "1284.50",
    "due_date": "2026-11-30",
    "vendor": "Trent Plumbing Supplies"
  }
}

extracted_fields is a plain object whose keys depend on the document type. An invoice carries invoice fields, a certificate carries its expiry and issuer, and so on. Read it defensively. Treat a missing key as “not found on this document” rather than an error, because the set of fields grows as more document types are added.

Uploading a document

POST /v1/documents as a multipart form. Requires a read and write key.

Request
curl -X POST \
  -H "Authorization: Bearer $SMARTDMS_KEY" \
  -F "file=@invoice-4471.pdf" \
  -F "folder_id=a19c..." \
  https://api.smartdms.ai/v1/documents

folder_id is optional. Leave it out and your filing rules decide where the document lands.

It returns 202 Accepted, not 200. The document exists immediately with status: pending and processing happens behind the scenes. Poll GET /v1/documents/{id} until the status is ready, or list with updated_since if you are handling a batch.

GET /v1/documents/{id}/file returns the bytes of the original file, exactly as it was uploaded.

PATCH /v1/documents/{id} corrects a document that is already here — rename it, describe it, move it, change its type, or fix a field SmartDMS read wrongly. Send only the keys you want to change: { "name": "Invoice 4417", "folder_id": "a19c...", "move_reason": "filed by accounts" }. Returns the updated document. Needs a read_write key.

The fields are name, description, folder_id, move_reason, document_type and fields, the last being { "due_date": "2026-11-30" } — one entry per value you are correcting. Sending null clears a value; omitting the key leaves it alone. The two are different on purpose, because clearing is the only way to undo a wrong name. A folder_id of null moves the document to the top level rather than clearing anything.

Every one of those goes through the same path the app uses, so a move is audited with both folder names and a corrected field is recorded as a correction the classifier learns from. move_reason is read only when you also send folder_id, and it is what the audit log shows beside the move.

POST /v1/documents/{id}/retry tries a failed document again — the same thing the Retry button does in the app. Only a document whose status is error qualifies; pending, processing and ready return 409 naming the states that do. Re-uploading the same file instead works no better for a permanent failure and loses the history of the document you already have. Needs a read_write key.

DELETE /v1/documents/{id} removes a document your key uploaded. It goes to the trash, where anyone in your account can restore it for thirty days — the API has no permanent delete, and deleting for good stays something a person does deliberately in the app. Returns 204 with no body. Needs a read_write key.

A key can only delete what that same key uploaded. Anything filed in the app, or uploaded by one of your other keys, returns 403 and is left alone. That is deliberate: an integration should be able to tidy up after itself and nothing more, so a loop that goes wrong can only undo its own work.

Folders

GET /v1/folders takes the same limit and offset. Asking for a single folder with GET /v1/folders/{id} adds document_count.

Folders are a tree. parent_id is the folder this one sits inside, and null at the top level. Two folders can share a name under different parents, so build your structure from parent_id rather than from names.

POST /v1/folders creates one, with { "name": "Colorado", "parent_id": "a19c..." } — omit parent_id for a top-level folder. Folders nest two levels deep: a folder and one level inside it. Going deeper returns 422 and names the limit. Creating needs a read_write key.

Response
{
  "items": [
    {
      "id": "a19c...",
      "name": "Supplier invoices",
      "parent_id": null,
      "description": "Anything we owe money on",
      "color": "blue",
      "icon": "receipt",
      "created_at": "2026-08-02T09:14:00"
    }
  ],
  "total": 22,
  "limit": 50,
  "offset": 0
}

PATCH /v1/folders/{id} renames a folder, moves it, or changes its description, colour or icon. Send only the fields that change. parent_id moves it: a folder id puts it inside that folder, and null puts it back at the top level. Leaving parent_id out leaves the folder where it is, which is not the same as sending null. Needs a read_write key.

Folder changes are not limited to folders your key created, unlike documents. A key can rename or delete any folder in its organization, because most of a structure is built by a person in the app and an integration that could only touch its own folders could not tidy anything. What keeps that safe is the next paragraph.

DELETE /v1/folders/{id} deletes the folder and never the documents inside it. They move to Uncategorized, and any sub-folders are promoted to the top level rather than deleted. There is no option to delete the contents, on purpose: a key can only delete documents it uploaded itself, so a folder cascade would be a way around that limit rather than a bigger version of it.

The response says what happened rather than coming back empty, so you can tell documents that survived from documents that did not without going looking for them. documents_deleted is always 0 and always present, so a future endpoint that does destroy something cannot be mistaken for this one.

Response
{
  "id": "a19c...",
  "name": "Colorado",
  "documents_moved": 12,
  "moved_to_folder_id": "7f31...",
  "moved_to_folder_name": "Uncategorized",
  "documents_deleted": 0,
  "subfolders_promoted": [
    {
      "id": "b204...",
      "name": "Denver",
      "parent_id": null,
      "description": null,
      "color": null,
      "icon": null,
      "created_at": "2026-09-14T11:02:00"
    }
  ]
}

Errors

CodeMeaning
401No Authorization header, or it is not a bearer token
401Unknown, revoked or expired key
403Upload attempted with a read-only key
404Wrong id, or the document belongs to another organization
422A folder move that would nest too deep, a folder put inside itself, or a change with no fields in it

A key only ever sees its own organization’s documents. A wrong id reads as a 404 rather than a 403, deliberately, so that ids cannot be probed to find out what exists.

Not available yet, stated plainly

Approval status is not exposed on this API. SmartDMS has approvals, approval rules and multi-stage sign-off inside the product, and version 1 cannot currently report whether a document was approved or rejected. If your system needs it, say so and it moves up the queue. It is already the most requested addition.

The status field above describes processing, not approval. A document can be ready and still be waiting for somebody to approve it.

A worked example

Pull everything that changed today and read the fields off each one:

Shell
KEY="smdms_your_key_here"
BASE="https://api.smartdms.ai/v1"

curl -s -H "Authorization: Bearer $KEY" \
  "$BASE/documents?updated_since=$(date -u +%Y-%m-%dT00:00:00Z)&limit=200" \
| jq -r '.items[] | select(.status=="ready") | .id' \
| while read -r id; do
    curl -s -H "Authorization: Bearer $KEY" "$BASE/documents/$id" \
    | jq '{id, filename, document_type, fields: .extracted_fields}'
  done

Good to know

  • Keys are per organization, not per person. A key keeps working when the person who made it leaves, which is usually what you want for a running integration, and is a reason to name keys after the system using them rather than after a colleague.
  • Prefer read-only wherever it will do. Most integrations only need to take a copy, and a read-only key cannot damage anything even if it leaks.
  • Set an expiry if the integration is temporary. A migration script does not need a key that lives forever.
  • This API is young and the feedback shapes it. If you are building against it and something is confusing or missing, that is worth telling us, and it tends to get built.