---
title: "Turn the join link on or off, and set its role and expiry"
method: PUT
path: "/organizations/{organization_id}/join-link"
tags: ["Organization Join Links"]
---

# Turn the join link on or off, and set its role and expiry

`PUT /organizations/{organization_id}/join-link`

## Request

- Base URL: `https://api.purplegrain.com/api/v1`
- URL: `https://api.purplegrain.com/api/v1/organizations/{organization_id}/join-link`
- Auth: HTTP bearer

Turns the business's join link on or off, and sets the role a holder
joins with and when the link expires. Anyone holding the link can join
the business in that role, after they confirm a mobile number on
PurpleGrain's own page.

`enabled: true` turns it on. Enabling mints a new link with a fresh code
when the business has no link, or the current link is off. Enabling a
link that is already on keeps the code. `enabled: false` turns the live
link off and keeps the row. `role` and `expiry` change the live link in
place: the code stays the same, and a new `expiry` restarts its clock
from now. Switching off a business that has no link is a 404. Only an
**owner** may call this. API keys are refused. Read the current link
with `getOrganizationJoinLink`.

## Path parameters

- `organization_id` string, required

## Request body

- OrganizationJoinLinkUpdateModelAttributes: Flat attributes-adapter request body (Content-Type application/json): the same optional fields as `OrganizationJoinLinkUpdateModel`, directly under `data`.
  - `data` object, required
    - `enabled` boolean
    - `role` 'member' | 'viewer'
    - `expiry` '24h' | '7d' | '30d' | 'never'

## Response `200`

The join link after the change.

- OrganizationJoinLinkShowResponseAttributes
  - `data` OrganizationJoinLinkModelAttributes: A business's join link in attributes-adapter shape (`application/json`); fields at the top level.
    - `id` string
    - `type` string
    - `code` string
    - `url` string
    - `role` 'member' | 'viewer'
    - `expiry` '24h' | '7d' | '30d' | 'never'
    - `expires_at` string, date-time, nullable
    - `enabled` boolean
    - `status` 'active' | 'expired' | 'off'
    - `uses_count` integer
    - `created_at` string, date-time
    - `updated_at` string, date-time

## Other responses

- `401`: Unauthenticated
- `403`: Forbidden — caller is not an owner of the organization.
- `404`: Switching off a business that has no join link, or the business does not exist.
- `422`: An unknown role or expiry.

---

[API](https://skmtc.dev/purplegrain/apis/purple-grain-api.md) · [All operations](https://skmtc.dev/purplegrain/apis/purple-grain-api/llms.txt) · [OpenAPI document](https://skmtc.dev/purplegrain/apis/purple-grain-api/revisions/06540345bbbc?raw)
