# Retrieve a document associated with a member

`GET /api/members/{memberId}/documents/{documentId}`

- **Success:** `200 OK`
- **Products:** Operator (`FOH`), Consumer (`CONSUMER`) (any one of these products, not all)
- **Features:** Online Bookings (`ONLINEBOOK`), Online Joining (`ONLINEJOIN`), Front of House Generic Access (`FOHGENERIC`) (any one of these features, not all)

HTML version: [Retrieve a document associated with a member](https://support.gladstonesoftware.cloud/reference/members/retrieve-a-document-associated-with-a-member)

## Overview

Returns the metadata for one document held against a member, together with a short-lived download link for the file itself.

The response is always JSON. The file content is never returned inline — there is no binary body and no base64 payload. Instead, `fileLink` holds a fully-qualified download URL with a read-only shared access signature (SAS) appended as a query string. To get the bytes, issue a second, plain `GET` to that URL with no `Authorization` header. The content type of that download is whatever was recorded when the file was uploaded; this API does not declare or convert it, so use `fileName` to work out how to render it.

The link is generated fresh on every call and is only valid for a short window — roughly 40 minutes, made up of a 20-minute access period plus 20 minutes of clock-skew allowance, with the start time back-dated by the same 20 minutes. Do not store `fileLink` or hand it to a queue that may process it hours later; call this endpoint again when you need a new one.

Reach for this endpoint when you already know the document id — typically from listing a member's documents, or from the id returned when you created the document. It does not filter on `isMemberVisible`, so a document flagged as hidden from the member is still returned here. Access is restricted to the member themselves: the member id in the path must match the member id in the access token, and linked members are not accepted.

## Endpoint

`GET {base_url}/api/members/{memberId}/documents/{documentId}`

`{base_url}` is the environment URL issued to your integration. See [Authenticating with Gladstone APIs](../../guides/authenticating-with-gladstone-apis.md).

## Path parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `memberId` | integer (int32) | Yes | The member who owns the document. Must match the member id in your access token — linked members are not accepted. Values of `0` or below are rejected with a `400`. |
| `documentId` | integer (int32) | Yes | The document to retrieve. The lookup is scoped to `memberId`, so an id that exists but belongs to a different member returns `404`. |

## Sample request

```bash title="cURL"
curl -X GET '{base_url}/api/members/{memberId}/documents/{documentId}' \
  -H 'Authorization: Bearer {accessToken}' \
  -H 'X-Use-SSO: true'
```

## Response fields

| Field | Type | Description |
|-------|------|-------------|
| `id` | integer (int32) | The document id, echoing the `documentId` you supplied. |
| `name` | string | The subject line recorded against the document when it was created — free-text, up to 255 characters. This is a human-readable title, not the file name. |
| `documentTypeId` | integer (int32) | The numeric id of the document type this document was filed under. Pair it with `documentTypeKey` and `documentTypeName`, which describe the same type. |
| `documentTypeName` | string | The description of that document type, as configured by the operator — suitable for display. |
| `documentTypeKey` | string | The stable key of the document type, up to 55 characters. Branch on this rather than on `documentTypeName` when you need to recognise a specific kind of document: for example, direct debit mandates carry the key `DDMandate`. |
| `fileName` | string | The original name of the uploaded file, up to 255 characters. If no original name was recorded, the generated storage file name is returned instead. Use its extension to decide how to render the download. |
| `isSensitive` | boolean | Whether the document is flagged as sensitive. The flag is inherited from the document type at upload time — a document filed under a sensitive type is always marked sensitive, even if the upload asked otherwise. It carries no access-control behaviour inside this endpoint; it is an operator-facing marker. |
| `dateValidTo` | string (date-time) | The date the document is valid until, or `null` when no expiry was recorded. Expired documents are still returned by this endpoint — it does not filter on this value, so enforce it yourself if it matters. Returned in the tenant's configured local time zone (`TimeZones_LocalWindowsTimeZoneName`), not UTC. |
| `dateAdded` | string (date-time) | When the document record was created. Recorded in the tenant's local time and returned in that same configured local time zone (`TimeZones_LocalWindowsTimeZoneName`), not UTC — do not assume the value is zero-offset. |
| `isMemberVisible` | boolean | Whether the document is flagged as visible to the member in consumer-facing apps. This endpoint returns the document either way; the flag is set when the document is created and is only used as a filter by the endpoint that lists a member's documents. |
| `fileLink` | string | A fully-qualified download URL with a read-only SAS query string appended. `GET` it directly, without an `Authorization` header, to download the file. It is minted per request and expires roughly 40 minutes later, so fetch the file promptly and never cache or persist the URL. If the link cannot be generated, the call fails with a `500` instead of returning a partial record. |

## Sample response

```json title="200 OK"
{
  "id": 12345,
  "name": "string",
  "documentTypeId": 12345,
  "documentTypeName": "string",
  "documentTypeKey": "string",
  "fileName": "string",
  "isSensitive": true,
  "dateValidTo": "2026-08-14T19:00:00Z",
  "dateAdded": "2026-08-14T19:00:00Z",
  "isMemberVisible": true,
  "fileLink": "string"
}
```

## Errors

| Status | Meaning | When |
|--------|---------|------|
| `400` | Bad request | `{memberId} is an invalid member ID` — the member id in the path is `0` (the reserved non-member id) or `-999` (a purged member). Rejected before the document is looked up. |
| `404` | Not found | `The member with the ID {memberId} doesn't exist`, or `Document with ID {documentId} does not exist` — the latter also covers a document that exists but belongs to a different member, since the lookup is scoped to `memberId`. |
| `500` | Internal server error | Returned both for any unexpected server-side failure and, less obviously, when the download link could not be generated (`Unable to generate file link for document with ID {documentId}` — usually a storage credential or connectivity problem on Gladstone's side). This endpoint never returns `422`; that failure arrives as `500`. |
