# Subscribe to public collection

Subscribes the mailbox to a public collection and creates a read grant.

## `POST /api/v1/identities/{identityId}/pim/subscriptions/{publicId}`

### Path parameters

- `identityId` (string, required) — Identity ULID identifier
- `publicId` (string, required) — Public directory listing ULID identifier

### Responses

**200** — Subscribed successfully

`application/json` → PimPublicCollection

- `category` (string | null, required) — Public category tag, or null
- `collectionId` (string, required) — Public collection ULID
- `components` (array | null, required, min 1 items, max 2 items) — Supported primary components, in VEVENT then VTODO order; null for addressbooks. Legacy mixed calendars may also retain journals or unparsed resources. Narrowing refuses with components_conflict and a count of incompatible live and restorable trashed objects.
- `createdAt` (integer <int64>, required) — Creation timestamp in epoch seconds
- `description` (string | null, required) — Public description, or null
- `displayName` (string | null, required) — Public display name, or null
- `id` (string, required) — Directory entry id: the handle POST /subscriptions takes
- `kind` ("calendar" | "addressbook", required) — Collection type ('calendar' or 'addressbook')
- `ownerIdentityId` (string, required) — Identity ULID of the owner

**401** — unauthorized: the bearer credential is missing, malformed, expired, or revoked. Carries a `WWW-Authenticate: Bearer` challenge

`application/json` → ErrorBody

**404** — No such public collection, or it is no longer public

`application/json` → ErrorBody

**503** — temporary_failure: the platform's storage could not answer just now; retry after the Retry-After window. Any operation can answer this. A write that got it may have been applied, so retry it with the same idempotency key where it takes one, or read the state back first (see Transient failures in the API description)

`application/json` → ErrorBody

### Example request

```bash
curl -X POST 'https://api.open.email/api/v1/identities/{identityId}/pim/subscriptions/{publicId}' \
  -H 'Authorization: Bearer oek_…'
```

## TypeScript SDK

[`openemail.pim.subscribe`](/docs/sdks/typescript/pim/subscribe)

```ts
const pimPublicCollection = await openemail.pim.subscribe(identityId, publicId)
```
