Skip to main content
Document metadata stores essential information about a KDDB document including its UUID, version, source information, labels, and custom properties.

Commands

Get Metadata

Retrieve all document metadata or a specific key:
# Get all metadata
kdx document metadata get <file.kddb>

# Get a specific key
kdx document metadata get <file.kddb> <key>
Example - All metadata:
kdx document metadata get invoice.kddb
┌──────────┬─────────────────────────────────────────────────────┐
│  FIELD   │                       VALUE                         │
├──────────┼─────────────────────────────────────────────────────┤
│ uuid     │ e25dab60-cbdf-499f-857e-ff9c82a19d87                │
│ version  │ 6.0.0                                               │
│ labels   │ []                                                  │
│ source   │ {}                                                  │
│ metadata │ {"connector":"folder","source_path":"/docs/invoice"}│
└──────────┴─────────────────────────────────────────────────────┘
Example - Specific key:
kdx document metadata get invoice.kddb source.connector
┌──────────────────┬────────┐
│      FIELD       │ VALUE  │
├──────────────────┼────────┤
│ source.connector │ folder │
└──────────────────┴────────┘

Set Metadata

Set or update a metadata key:
kdx document metadata set <file.kddb> <key> <json-value>
The value must be valid JSON. Strings must be quoted, objects use curly braces, etc.
Examples:
# Set a string value
kdx document metadata set invoice.kddb custom_field '"my value"'

# Set a number
kdx document metadata set invoice.kddb priority '1'

# Set a boolean
kdx document metadata set invoice.kddb reviewed 'true'

# Set an object
kdx document metadata set invoice.kddb config '{"enabled": true, "threshold": 0.8}'

# Set an array
kdx document metadata set invoice.kddb tags '["invoice", "processed"]'
Output:
Set metadata key: custom_field

Standard Metadata Fields

KDDB documents typically include these standard metadata fields:
FieldDescriptionExample
uuidUnique document identifier"e25dab60-cbdf-499f-857e-ff9c82a19d87"
versionKDDB format version"6.0.0"
labelsDocument labels/tags["invoice", "2024"]
sourceSource information{"connector": "folder"}
metadataNested metadata object{"title": "Invoice #123"}
mixinsApplied document mixins["spatial"]

Output Formats

Use the global -o flag for different output formats:
# JSON output
kdx document metadata get invoice.kddb -o json

# YAML output
kdx document metadata get invoice.kddb -o yaml
JSON output example:
{
  "uuid": "e25dab60-cbdf-499f-857e-ff9c82a19d87",
  "version": "6.0.0",
  "labels": [],
  "source": {},
  "metadata": {
    "connector": "folder",
    "source_path": "/docs/invoice.pdf",
    "title": "Invoice #123"
  }
}

Use Cases

Document Identification

Get the unique identifier for a document:
# Get UUID
kdx document metadata get invoice.kddb -o json | jq -r '.uuid'

Update Custom Properties

Add custom metadata for tracking:
# Add processing timestamp
kdx document metadata set invoice.kddb processed_at '"2024-01-15T10:30:00Z"'

# Add reviewer info
kdx document metadata set invoice.kddb reviewer '"[email protected]"'

Batch Metadata Updates

Update metadata across multiple documents:
# Add a label to all documents
for kddb in *.kddb; do
  kdx document metadata set "$kddb" batch_id '"batch-2024-01"'
done

Scripting Integration

Use metadata in automated workflows:
# Get document UUID for API calls
UUID=$(kdx document metadata get invoice.kddb -o json | jq -r '.uuid')
echo "Processing document: $UUID"

# Check document version
VERSION=$(kdx document metadata get invoice.kddb -o json | jq -r '.version')
if [[ "$VERSION" < "6.0.0" ]]; then
  echo "Warning: Old document format"
fi

Export Metadata

Export metadata for documentation or reporting:
# Export as JSON
kdx document metadata get invoice.kddb -o json > invoice_metadata.json

# Export as YAML
kdx document metadata get invoice.kddb -o yaml > invoice_metadata.yaml

Notes

Metadata is stored in a compressed format (MessagePack) in older KDDB files and as JSON in newer versions. The CLI handles both formats transparently.
Modifying metadata changes the KDDB file. Make backups before making changes to important documents.
The uuid and version fields are typically read-only and managed by the document creation process. Avoid modifying these unless you understand the implications.