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

# Documents

> Document upload, download, and management

## Documents Endpoints

Base URL: `https://api.casexchange.com/api/public/v1`

***

### GET /cases/{caseId}/documents

Returns all documents attached to the specified case.

**Tier:** `read_only`

```bash theme={null}
curl -X GET "https://api.casexchange.com/api/public/v1/cases/d3f8a1b2-4c56-7def-8901-abcdef234567/documents" \
  -H "X-API-Key: cxp_ro_your_key_here"
```

**Response `200`**

```json theme={null}
{
  "data": [
    {
      "id": "e4a91c2d-5b67-8f09-a1b2-c3d4e5f60718",
      "caseId": "d3f8a1b2-4c56-7def-8901-abcdef234567",
      "fileName": "medical-records-2025.pdf",
      "mimeType": "application/pdf",
      "sizeBytes": 2458190,
      "uploadedBy": "jthompson@sterlinglaw.example.com",
      "createdAt": "2026-02-14T10:32:00.000Z"
    },
    {
      "id": "f5b02d3e-6c78-9a10-b2c3-d4e5f6a71829",
      "caseId": "d3f8a1b2-4c56-7def-8901-abcdef234567",
      "fileName": "police-report-incident-4491.pdf",
      "mimeType": "application/pdf",
      "sizeBytes": 874520,
      "uploadedBy": "mreeves@sterlinglaw.example.com",
      "createdAt": "2026-02-15T14:05:00.000Z"
    }
  ],
  "meta": {
    "requestId": "req_3a7b8c9d0e1f2345",
    "timestamp": "2026-03-31T16:00:00.000Z"
  }
}
```

***

### POST /cases/{caseId}/documents

Uploads a file and attaches it to the specified case. Accepts `multipart/form-data`. Maximum file size is 50 MB.

**Tier:** `standard`

```bash theme={null}
curl -X POST "https://api.casexchange.com/api/public/v1/cases/d3f8a1b2-4c56-7def-8901-abcdef234567/documents" \
  -H "X-API-Key: cxp_std_your_key_here" \
  -F "file=@document.pdf"
```

**Response `201`**

```json theme={null}
{
  "data": {
    "id": "a6c13e4f-7d89-0b21-c3d4-e5f6a7b83940",
    "caseId": "d3f8a1b2-4c56-7def-8901-abcdef234567",
    "fileName": "document.pdf",
    "mimeType": "application/pdf",
    "sizeBytes": 1048576,
    "uploadedBy": "jthompson@sterlinglaw.example.com",
    "createdAt": "2026-03-31T16:01:00.000Z"
  },
  "meta": {
    "requestId": "req_4b8c9d0e1f234567",
    "timestamp": "2026-03-31T16:01:00.000Z"
  }
}
```

***

### GET /cases/{caseId}/documents/{docId}/download

Returns a short-lived pre-signed S3 URL for downloading the specified document.

**Tier:** `read_only`

```bash theme={null}
curl -X GET "https://api.casexchange.com/api/public/v1/cases/d3f8a1b2-4c56-7def-8901-abcdef234567/documents/e4a91c2d-5b67-8f09-a1b2-c3d4e5f60718/download" \
  -H "X-API-Key: cxp_ro_your_key_here"
```

**Response `200`**

```json theme={null}
{
  "data": {
    "downloadUrl": "https://casexchange-documents.s3.amazonaws.com/d3f8a1b2-4c56-7def-8901-abcdef234567/e4a91c2d-5b67-8f09-a1b2-c3d4e5f60718/medical-records-2025.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=EXAMPLE&X-Amz-Expires=3600&X-Amz-Signature=EXAMPLE",
    "fileName": "medical-records-2025.pdf"
  },
  "meta": {
    "requestId": "req_5c9d0e1f23456789",
    "timestamp": "2026-03-31T16:02:00.000Z"
  }
}
```

***

### DELETE /cases/{caseId}/documents/{docId}

Permanently deletes the specified document from the case and S3.

**Tier:** `full`

```bash theme={null}
curl -X DELETE "https://api.casexchange.com/api/public/v1/cases/d3f8a1b2-4c56-7def-8901-abcdef234567/documents/f5b02d3e-6c78-9a10-b2c3-d4e5f6a71829" \
  -H "X-API-Key: cxp_full_your_key_here"
```

**Response `204 No Content`**

No response body.
