---
title: "Create Document Share Link"
method: POST
path: "/v1/documents/{id}/shares/shareLinks"
tags: ["Documents Sharing"]
---

# Create Document Share Link

`POST /v1/documents/{id}/shares/shareLinks`

Creates a new share link on the provided document with the provided settings. The linkSecurity parameter is configurable only for enterprise license accounts but remains required for team accounts.

## Path parameters

- `id` string, uuid, required

## Request body

- object
  - `role` 'editandshare' | 'edit' | 'comment' | 'view', required — Roles determine what actions an invitation will grant on a document. Invitations to a document only grant the specified level of access to just that one document. If a link's role is changed, the new role applies immediately to all users who accessed via that link. - `editandshare`: View, comment on, edit, and control which users can access the document. - `edit`: View, comment on, and edit the document. - `comment`: View the document. Leave comments on the document. - `view`: View the document.
  - `linkSecurity` DocumentLinkSecurity, required
    - `restrictToAccount` boolean, required — Whether or not users outside the document's account can accept the share link. Changing this value to true will immediately revoke access for any external users who previously gained access through this link.
    - `expires` string, date-time — If defined, the date and time the share link expires.
    - `passcode` string — If defined, the required passcode to accept the share link. The passcode length must be between 1 – 80 characters.
    - `allowAnonymous` boolean, required — Whether or not the share link allows for anonymous guests.

## Response `201`

Created with a Document Share Link resource containing information about the created share link.

- DocumentShareLink
  - `shareLinkId` string, required — Id of the share link.
  - `documentId` string, uuid, required — Id of the document the share link belongs to.
  - `role` 'editandshare' | 'edit' | 'comment' | 'view', required — Roles determine what actions an invitation will grant on a document. Invitations to a document only grant the specified level of access to just that one document. If a link's role is changed, the new role applies immediately to all users who accessed via that link. - `editandshare`: View, comment on, edit, and control which users can access the document. - `edit`: View, comment on, and edit the document. - `comment`: View the document. Leave comments on the document. - `view`: View the document.
  - `linkSecurity` DocumentLinkSecurity, required
    - `restrictToAccount` boolean, required — Whether or not users outside the document's account can accept the share link. Changing this value to true will immediately revoke access for any external users who previously gained access through this link.
    - `expires` string, date-time — If defined, the date and time the share link expires.
    - `passcode` string — If defined, the required passcode to accept the share link. The passcode length must be between 1 – 80 characters.
    - `allowAnonymous` boolean, required — Whether or not the share link allows for anonymous guests.
  - `created` string, date-time, required — The date and time the share link was created.
  - `createdBy` number, required — User Id of the user that created the share link.
  - `lastModified` string, date-time, required — The date and time the share link was last modified.
  - `acceptUrl` string, uri, required — Link to accept the share link invitation.

## Other responses

- `400` — Bad Request if the document does not belong to an enterprise account and the `restrictToAccount` is set to true, defines a passcode, or defines an expiration or the `allowAnonymous` field is set to true on non-Lucidspark/Lucidchart documents.
- `403` — Forbidden if the app making the request does not have permission to the document, or if the document has been deleted, or does not exist.

---

[API](https://skmtc.net/lucid/apis/lucid-rest-api.md) · [All operations](https://skmtc.net/lucid/apis/lucid-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/lucid/lucid-rest-api/revisions/6a32cb9e1aa7/schema)
