> ## Documentation Index
> Fetch the complete documentation index at: https://docs.equa.cc/llms.txt
> Use this file to discover all available pages before exploring further.

# Document Endpoints

> File upload, directory management, and document generation

> **Source:** Cross-cutting guide — references endpoints in `organization-endpoints.ts`, `data-room-endpoints.ts`, `microsoft-endpoints.ts`, and `captable-endpoints.ts`

# Document Endpoints

Document management in Equa is handled through multiple endpoint groups depending on the storage backend. This page provides an overview of how documents flow through the system.

## Storage Backends

Equa supports multiple document storage backends:

| Backend          | Description                             | Endpoints                                                       |
| ---------------- | --------------------------------------- | --------------------------------------------------------------- |
| **Data Room**    | S3-based document storage (default)     | [Data Room Endpoints](/api/endpoints/data-room-endpoints)       |
| **Microsoft**    | OneDrive/SharePoint via Microsoft Graph | [Microsoft Endpoints](/api/endpoints/microsoft-endpoints)       |
| **Google Drive** | Google Drive sync integration           | [Google Drive Endpoints](/api/endpoints/google-drive-endpoints) |

The active backend depends on the organization's configuration. The `GET /organization/:organization/document` and `POST /organization/:organization/document` routes are shared — the server dispatches to the appropriate handler.

## Organization File Upload

Files can be uploaded directly to an organization (separate from the data room):

```
POST /v1/organization/:organization/file
```

| Field        | Value                 |
| ------------ | --------------------- |
| Auth         | Required              |
| Permission   | `canEditDocuments`    |
| Content-Type | `multipart/form-data` |

Max upload size is configurable via `AWS_S3_UPLOAD_SIZE_LIMIT_MB` (default 10 MB). See [Organization Endpoints](/api/endpoints/organization-endpoints#upload-organization-document).

## File Download

```
GET /v1/file/:file/content
```

| Field      | Value         |
| ---------- | ------------- |
| Auth       | Required      |
| Permission | `canViewFile` |

Downloads a file as an attachment. See [Organization Endpoints](/api/endpoints/organization-endpoints#download-file).

## File View Inline

```
GET /v1/file/:file/content/:name
```

| Field      | Value         |
| ---------- | ------------- |
| Auth       | Required      |
| Permission | `canViewFile` |

Serves a file inline for browser viewing. See [Organization Endpoints](/api/endpoints/organization-endpoints#view-file-inline).

## Document Generation

Equa generates documents programmatically (e.g., share certificates, legend certificates). These are generated on-demand through cap table endpoints:

| Document Type      | Endpoint                                               |
| ------------------ | ------------------------------------------------------ |
| Share Certificate  | `GET /v1/shareholding/:holding/certificate`            |
| Certificate Copy   | `GET /v1/shareholding/:holding/certificate/copy`       |
| Legend Certificate | `GET /v1/organization/:org/legend/:legend/certificate` |

See [Cap Table Endpoints](/api/endpoints/captable-endpoints) for details.

## CSV Import/Export

### Import Template

```
GET /v1/organization/:organization/import
```

Download a CSV import template or a previously uploaded import file for cap table data.

### Cap Table Export

```
GET /v1/organization/:organization/captable
```

Export the organization's full cap table as structured data.

### Site-Wide CSV Export (Admin)

```
GET /v1/site/captable
```

Admin-only export of all cap table data. See [Admin Endpoints](/api/endpoints/admin-endpoints).
