---
title: Document
description: Document protocol schemas
---

{/* ⚠️  AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs go in content/docs/guides/. */}

Document Version Schema

Represents a single version of a document in a version-controlled system.

Each version is immutable and maintains its own metadata and download URL.

@example

```json

\{

"versionNumber": 2,

"createdAt": 1704067200000,

"createdBy": "user_123",

"size": 2048576,

"checksum": "a1b2c3d4e5f6",

"downloadUrl": "https://storage.example.com/docs/v2/file.pdf",

"isLatest": true

\}

```

<Callout type="info">
**Source:** `packages/spec/src/data/document.zod.ts`
</Callout>

## TypeScript Usage

```typescript
import { Document, DocumentTemplate, DocumentVersion, ESignatureConfig } from '@objectstack/spec/data';
import type { Document, DocumentTemplate, DocumentVersion, ESignatureConfig } from '@objectstack/spec/data';

// Validate data
const result = Document.parse(data);
```

---

## Document

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **id** | `string` | ✅ | Document ID |
| **name** | `string` | ✅ | Document name |
| **description** | `string` | optional | Document description |
| **fileType** | `string` | ✅ | File MIME type |
| **fileSize** | `number` | ✅ | File size in bytes |
| **category** | `string` | optional | Document category |
| **tags** | `string[]` | optional | Document tags |
| **versioning** | `Object` | optional | Version control |
| **template** | `Object` | optional | Document template |
| **eSignature** | `Object` | optional | E-signature config |
| **access** | `Object` | optional | Access control |
| **metadata** | `Record<string, any>` | optional | Custom metadata |


---

## DocumentTemplate

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **id** | `string` | ✅ | Template ID |
| **name** | `string` | ✅ | Template name |
| **description** | `string` | optional | Template description |
| **fileUrl** | `string` | ✅ | Template file URL |
| **fileType** | `string` | ✅ | File MIME type |
| **placeholders** | `Object[]` | ✅ | Template placeholders |


---

## DocumentVersion

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **versionNumber** | `number` | ✅ | Version number |
| **createdAt** | `number` | ✅ | Creation timestamp |
| **createdBy** | `string` | ✅ | Creator user ID |
| **size** | `number` | ✅ | File size in bytes |
| **checksum** | `string` | ✅ | File checksum |
| **downloadUrl** | `string` | ✅ | Download URL |
| **isLatest** | `boolean` | ✅ | Is latest version |


---

## ESignatureConfig

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **provider** | `Enum<'docusign' \| 'adobe-sign' \| 'hellosign' \| 'custom'>` | ✅ | E-signature provider |
| **enabled** | `boolean` | ✅ | E-signature enabled |
| **signers** | `Object[]` | ✅ | Document signers |
| **expirationDays** | `number` | ✅ | Expiration days |
| **reminderDays** | `number` | ✅ | Reminder interval days |


---

