# Sharing

Who can see a page: grants to people, teamspaces or the whole workspace, restricted pages, and public links.

## Endpoints

- [Share a page](https://developers.lydie.co/api/sharing/share-a-page.md): `POST /v1/documents/{documentId}/grants`
- [Stop sharing a page](https://developers.lydie.co/api/sharing/stop-sharing-a-page.md): `DELETE /v1/documents/{documentId}/grants/{grantId}`
- [Share a page with someone by email](https://developers.lydie.co/api/sharing/share-a-page-with-someone-by-email.md): `POST /v1/documents/{documentId}/invite`
- [Restrict or unrestrict a page](https://developers.lydie.co/api/sharing/restrict-or-unrestrict-a-page.md): `POST /v1/documents/{documentId}/restricted`
- [List a page's public links](https://developers.lydie.co/api/sharing/list-a-pages-public-links.md): `GET /v1/documents/{documentId}/share-links`
- [Create a public link](https://developers.lydie.co/api/sharing/create-a-public-link.md): `POST /v1/documents/{documentId}/share-links`
- [Get a page's sharing settings](https://developers.lydie.co/api/sharing/get-a-pages-sharing-settings.md): `GET /v1/documents/{documentId}/sharing`
- [Change a public link](https://developers.lydie.co/api/sharing/change-a-public-link.md): `PATCH /v1/share-links/{shareLinkId}`
- [Revoke a public link](https://developers.lydie.co/api/sharing/revoke-a-public-link.md): `DELETE /v1/share-links/{shareLinkId}`

## The DocumentGrant object

- `id` (string, required): (1–64 chars)
- `documentId` (string, required)
- `principalType` (string, required): One of: `user`, `teamspace`, `workspace`.
- `principalId` (string, required)
- `level` (string, required): One of: `view`, `comment`, `edit`, `full`.
- `createdBy` (string, required, nullable)
- `createdAt` (timestamp, required)

```json
{
  "id": "string",
  "documentId": "01JCQ3V5MZ8G4ZK2X7T9R6N1PB",
  "principalType": "user",
  "principalId": "01JCQ3V5MZ8G4ZK2X7T9R6N1PB",
  "level": "view",
  "createdBy": null,
  "createdAt": "2026-11-12T09:30:00.000Z"
}
```
