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

# Repository Documents

> Upload and manage documents in your company's repository

The repository stores documents that result from completed legal requests or are uploaded independently.

## Uploading a document

Use the [Create repository document](/api-reference/repository-documents/create-repository-document) endpoint. You need a token with the `write` scope.

### Upload a file

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
curl -X POST https://app.simpledocs.com/api/v1/repository_documents \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -F "file=@/path/to/employment-agreement.pdf"
```

### Upload from a URL

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
curl -X POST https://app.simpledocs.com/api/v1/repository_documents \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -F "url=https://example.com/documents/agreement.pdf"
```

You must provide either `file` or `url` — not both.

### Attaching metadata

You can attach arbitrary metadata to a document using the `metadata` field:

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
curl -X POST https://app.simpledocs.com/api/v1/repository_documents \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -F "file=@/path/to/contract.pdf" \
  -F 'metadata={"department":"Legal","category":"Vendor"}'
```

### Response

```json theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
{
  "success": true,
  "message": "Document created successfully",
  "data": {
    "id": "0dbhXg",
    "name": "employment-agreement.pdf",
    "created_at": "2026-03-05T14:30:00Z"
  }
}
```

## Listing documents

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
curl https://app.simpledocs.com/api/v1/repository_documents \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
```

```json theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
{
  "data": [
    {
      "id": "0dbhXg",
      "type": "repository_document",
      "attributes": {
        "name": "Employment Agreement.pdf",
        "custom_fields": { "department": "Legal" },
        "created_at": "2026-03-05T14:30:00Z",
        "agreement_url": "https://app.simpledocs.com/documents/0dbhXg/download"
      },
      "relationships": {
        "legal_request": {
          "data": null
        }
      }
    }
  ],
  "pagination": {
    "current_page": 1,
    "per_page": 25,
    "total_pages": 1,
    "total_count": 1
  }
}
```

## Getting a document

Retrieve a single document by its hash ID:

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
curl https://app.simpledocs.com/api/v1/repository_documents/0dbhXg \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
```
