# Get a preview link

Page: https://app.myclaimhouse.com/docs/api/getAttachmentDocumentUrl

`GET /api/v1/attachments/{id}/documents/{document_id}/url`

A link that shows one page of the document's image for 60 seconds (page, from 1: the first by default; a page the document does not have is not found; the answer says the page and the document's pages): ask for a new one each time it is shown. Do not store, log or share it. Needs a key with read.

Needs a key with `read` permission.

## Request

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | Yes | An attachment ID (att_...). |
| `document_id` | string | Yes | A document ID (doc_...). |

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `page` | string | No | The page to show, from 1 (the default). A page the document does not have is not found. |

## Response

The link. Status `200`.

| Name | Type | Description |
| --- | --- | --- |
| `object` | string | Always `attachment_document_url`. |
| `url` | string | A link that shows the page's image for 60 seconds. Do not store or log it. |
| `expires_at` | string (date-time) |  |
| `page` | integer | The page the link shows. At least 1. |
| `pages` | integer | How many pages the document has. At least 1. |

## Errors

| HTTP status | Code | What it means |
| --- | --- | --- |
| 401 | `UNAUTHORIZED` | A valid API key is required. Send it as "Authorization: Bearer <key>". |
| 403 | `PERMISSION_DENIED` | This API key is not allowed to do that. |
| 404 | `NOT_FOUND` | Not found. |
| 422 | `INVALID_REQUEST` | The request is not valid. |
| 429 | `TOO_MANY_REQUESTS` | Too many requests of this kind lately. Wait, then try again. |
| 504 | `TIMEOUT` | The request took too long. Send it again with the same Idempotency-Key and body after Retry-After seconds: a 409 means it is still finishing (wait and send again), and any other answer is final. If this 504 comes back, find what the request made by listing with ?idempotency_key=<the key>. |
| 500 | `INTERNAL` | Something went wrong on our side. Quote the request ID if you contact us. |

## Example

### Example request

```bash
curl "https://app.myclaimhouse.com/api/v1/attachments/att_01JM000000E00800000000003G/documents/doc_01JM000000E00800000000003H/url" \
  -H "Authorization: Bearer $CLAIMHOUSE_KEY"
```

### Example response: 200

```json
{
  "object": "attachment_document_url",
  "url": "https://storage.example.com/attachments/signed/EXAMPLE?token=EXAMPLE",
  "expires_at": "2026-09-24T21:00:59.000000+00:00",
  "page": 1,
  "pages": 1
}
```
