# Share a page

`POST /v1/documents/{documentId}/grants`

Gives a user, a teamspace's members or everyone in the workspace (principalType workspace, principalId = workspace id) a level on the page and its subpages. Needs full access.

Scope: `docs:write`.

## Request

```bash
curl -X POST "https://api.lydie.co/v1/documents/01JCQ3V5MZ8G4ZK2X7T9R6N1PB/grants" \
  -H "Authorization: Bearer $LYDIE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "principalType": "user",
    "principalId": "01JCQ3V5MZ8G4ZK2X7T9R6N1PB",
    "level": "view"
  }'
```

## Path parameters

- `documentId` (ULID, required)

## Body

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

## Response

- `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"
}
```

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