Capability Sources

Share a Google Drive file with a person or the organization

Changed on

Creates a Drive permission for one file using the calling member's Google Workspace account. To share with one person pass type=user plus emailAddress; to share with the entire organization pass type=domain plus the org's Google Workspace domain (e.g. openworklabs.com). Sharing files not created through OpenWork needs the Full Drive access feature enabled by an admin.

post/v1/capabilities/google-workspace/drive-file-share/{fileId}

Request

  • Base URL
    https://api.openworklabs.com
  • Auth
    • API key in header x-api-key
    • or HTTP bearer

Path parameters

fileId, string required

Google Drive file id.

Request body

GoogleWorkspaceShareDriveFileBody required
type, 'user' | 'domain' required

Use type=user to share with one person, or type=domain to share with the entire organization.

emailAddress, string email

Required when type=user; pass the person's email address, for example raghav@openworklabs.com.

domain, string

Required when type=domain; pass the organization's Google Workspace domain, for example openworklabs.com.

role, 'reader' | 'commenter' | 'writer'

Drive permission role to grant.

sendNotificationEmail, boolean

Whether Google should email the recipient about the new access.

Response

Google Drive file shared.

GoogleWorkspaceShareDriveFileResponse required
ok, true required
fileId, string required
permissionId, string required
type, string required
role, string required

Changes

    • warning

      changed the pattern of the request property emailAddress from ^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$ to ^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$

    • info

      response property details/items/path/items/ list-of-types was narrowed by removing types number from media type application/json of response 400

    • info

      added the optional property message to the response with the status