Documents and files
Manage documents and their file packs from a terminal, and print a document's OCR text as plain text.
A document is a titled pack of files. standards documents lists and edits documents, adds and removes files from a pack, and prints the pack's aggregated text. To upload a new file and attach it to a record, use records attach-document.
Commands
| Command | What it does | What it prints |
|---|---|---|
standards documents list --limit 20 | Lists documents. | { data, page }. |
standards documents get <documentId> | Reads one document. | The document. |
standards documents create --title "Q1 report" --object deals --record <recordId> --attribute contracts | Creates a document on a record's document attribute. All four options are required; an unknown object is refused with a 400. | The created document. |
standards documents update <documentId> --title "Q1 report (final)" | Renames the document. --title is required; it is stored trimmed, and a blank title or one containing a NUL character is refused with a 400. A folder id is refused with SCHEMA_VALIDATION_FAILED: the CLI has no folder command, so rename a folder in the app or through PATCH /folders/:id (see Group files into a document). | The renamed document. |
standards documents delete <documentId> | Deletes the document. | Nothing. |
standards documents preview <documentId> | Returns the pack's preview file. | The preview file. |
standards documents files <documentId> | Lists the pack. | One row per file. |
standards documents add-file <documentId> --file-id <fileId> | Appends an already uploaded file to the pack. | The updated pack. |
standards documents remove-file <documentId> <fileId> | Removes one file from the pack. | The updated pack. |
standards documents content <documentId> | Prints the pack's OCR text. | Plain text. |
Files in a pack
files lists the pack in position order. In table format each row shows id, position, type, size and ocrStatus; json and csv print the raw rows.
standards documents files <documentId> --format tableadd-file takes the id of a file that is already uploaded; remove-file takes the file id shown by files. The document survives an empty pack.
Content
documents content prints the OCR text of every file in the pack, in position order, as plain text. It ignores --format.
standards documents content <documentId> > report.txtFiles still being processed contribute nothing yet: check ocrStatus in documents files first.
Files
standards files reaches the uploaded files themselves.
| Command | What it does | What it prints |
|---|---|---|
standards files upload ./a.pdf ./b.png | Uploads up to 10 local files, private. | The stored files, with their ids. |
standards files list --limit 20 | Lists files a page at a time; --folder <path> and --mime-type <type> narrow it. | An array of files. |
standards files list --ids <id1>,<id2> | Exactly the files you can see, in the order named (at most 100). An unknown or invisible id is absent, never an error; the other filters and the page do not apply. | An array of files. |
standards files get <fileId> | Reads one file. | The file. |
standards files content <fileId> -o ./a.pdf | Downloads the bytes, to stdout without -o. It ignores --format. | The bytes. |
standards files delete <fileId> --yes | Deletes a file you uploaded and its stored bytes. Without --yes nothing is sent. A file in a pack is refused with 409 DOCUMENT_FILE_ALREADY_PACKED (remove it from the pack first); someone else's file with 403. | A confirmation line. |
A file the caller cannot see answers the same 404 as a missing one.
Next steps
- Records: upload a file and attach it to a record.
- Files and documents: packs, OCR and previews explained.
- CLI: output formats and exit codes.
- Book a demo