# Create a public link

`POST /v1/documents/{documentId}/share-links`

Creates a view-only public link to the page (and, by default, its unrestricted subpages). The token is returned only once. Needs full access.

Scope: `docs:write`.

## Request

```bash
curl -X POST "https://api.lydie.co/v1/documents/01JCQ3V5MZ8G4ZK2X7T9R6N1PB/share-links" \
  -H "Authorization: Bearer $LYDIE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'
```

## Path parameters

- `documentId` (ULID, required)

## Body

- `includeSubpages` (boolean, optional): Default: `true`.
- `expiresAt` (timestamp, optional, nullable): Default: `null`.
- `password` (string, optional, nullable): Default: `null`. (4–200 chars)

## Response

- `shareLink` (ShareLink, required)
  - `id` (string, required): (1–64 chars)
  - `documentId` (string, required)
  - `tokenHint` (string, required)
  - `includeSubpages` (boolean, required)
  - `expiresAt` (timestamp, required, nullable)
  - `hasPassword` (boolean, required)
  - `createdBy` (string, required, nullable)
  - `createdAt` (timestamp, required)
- `token` (string, required)
- `url` (string, required)

```json
{
  "shareLink": {
    "id": "string",
    "documentId": "01JCQ3V5MZ8G4ZK2X7T9R6N1PB",
    "tokenHint": "string",
    "includeSubpages": false,
    "expiresAt": null,
    "hasPassword": false,
    "createdBy": null,
    "createdAt": "2026-11-12T09:30:00.000Z"
  },
  "token": "string",
  "url": "string"
}
```

Errors use the envelope described at https://developers.lydie.co/errors.md.
