Skip to main content

Shares API

Share a file or folder, choose who can reach it, and set what each recipient may do. Two base paths are involved: shared lists what has been shared with you, and shares manages the shares you provide.

Base URL and scope​

/api/external/v1/shared
/api/external/v1/shares

Listing, reading a share, searching users, and reading share types need api:read. Creating, changing, removing a share, and setting recipients additionally need api:write.

Share types​

A share has one type, which decides who can reach the resource.

TypeWho can reach the resource
SPECIFIC_USERSOnly the users you name as recipients
ORG_LINKAnyone inside the organization
PUBLIC_LINKAnyone with the link

Every resource in the same hierarchy must use the same share type. Call the share-types endpoint before creating a share to find out which types the resource allows.

Permission flags​

Permissions are five booleans. They appear at two levels: on the share row itself (cv to cs in the request body) and on each recipient in ts.

FlagPermission
cvView
ceEdit
cdDownload
cuUpload
csRe-share
  • cv is the prerequisite for the others. If cv is false, the request fails with PERMISSION_003 regardless of the other values.
  • For ORG_LINK and PUBLIC_LINK, the share-row permissions apply and all five must be sent. A missing flag fails with SHARE_009 on create and SHARE_005 (500) on change. A flag the share type does not allow, sent as true, fails with PERMISSION_005 (403).
  • For SPECIFIC_USERS, the share-row permissions are neither used nor validated; only the per-recipient permissions apply.
  • Per-recipient permissions are not limited by the share type, except that upload cannot be granted on a file.

In responses the same permissions appear under their long names: canView, canEdit, canDownload, canUpload, canDelete, and canShare.

List what is shared with you​

GET /api/external/v1/shared
ParameterTypeRequiredDescription
psintegerYesPage size, minimum 1
rtenumNoFILE or FOLDER
ftenumNoFile type - document, spreadsheet, presentation, pdf, image, note
oistringNoOwner id, up to 254 characters; matches the exact id, not a partial match
sddateNoStart of the modified-date range; ignored unless ed is also sent
eddateNoEnd of the modified-date range; ignored unless sd is also sent
sbenumNoSort field - name, size, update, open, share; ignored unless so is also sent
soenumNoSort order; ignored unless sb is also sent
cilongNoCursor id from the previous page
cvobjectNoCursor value from the previous page
ctenumNoCursor type from the previous page
List shared
curl -X GET "https://drive.example.com/api/external/v1/shared?ps=10" \
-H "Authorization: Bearer replace-with-your-USER-API-KEY"
cv means two different things

As a query parameter on this endpoint, cv is the pagination cursor value. In a share request body, cv is the view permission. The two never appear in the same request.

Each entry reports the resource, its owner and tenant, when it was shared, your effective permissions, and who registered or last changed the share. It also carries isStarred and starredSeq, so a shared item can be starred like any other resource.

Without sb and so, entries are sorted by share time (share) descending. Folders always come before files, whatever the sort. When hasNext is true, the response carries nextCursor (the last resourceSeq), nextCursorValue (the value of the sort field), and nextCursorType (the resource type); send them as ci, cv, and ct on the next request. See Common conventions.

Read the share types a resource allows​

GET /api/external/v1/shares/{resourceSeq}/share-types
ParameterTypeRequiredDescription
resourceSeqlongYesPath parameter - the resource to check
ssintegerNoOwner seq; null when you own the resource
Share types response
{
"result": true,
"code": 200,
"message": "OK",
"data": {
"editable": true,
"allowSpecificUsers": true,
"allowOrgLink": true,
"allowPublic": true,
"shareTypes": [
{
"code": "SPECIFIC_USERS",
"name": "특정 사용자만",
"allowedPermissions": ["DOWNLOAD", "EDIT", "SHARE", "VIEW"]
},
{
"code": "ORG_LINK",
"name": "조직 내부 공개",
"allowedPermissions": ["DOWNLOAD", "EDIT", "VIEW"]
},
{
"code": "PUBLIC_LINK",
"name": "전체 공개",
"allowedPermissions": ["DOWNLOAD", "EDIT", "VIEW"]
}
]
}
}

name is a fixed string and is not localized.

allowedPermissions is a fixed rule per share type and resource kind, not an administrator setting: upload is offered only on folders and never for PUBLIC_LINK, and re-share only for SPECIFIC_USERS. The example is for a file, so no type lists UPLOAD. This limit applies only to the share-row permissions of a link share, not to per-recipient permissions. What the tenant settings decide is allowSpecificUsers, allowOrgLink, and allowPublic.

Create a share​

Requires api:write

Only the owner of the resource can create a share; for anyone else the request fails with RESOURCE_005. Read the allowed share types first.

POST /api/external/v1/shares
ParameterTypeRequiredDescription
rslongYesThe file or folder to share
stenumYesShare type - SPECIFIC_USERS, ORG_LINK, or PUBLIC_LINK
cvbooleanNoView permission; must be true for ORG_LINK and PUBLIC_LINK
cebooleanNoEdit permission; required for ORG_LINK and PUBLIC_LINK
cdbooleanNoDownload permission; required for ORG_LINK and PUBLIC_LINK
cubooleanNoUpload permission; required for ORG_LINK and PUBLIC_LINK
csbooleanNoRe-share permission; required for ORG_LINK and PUBLIC_LINK
tsarrayNoRecipients; allowed with any share type if the tenant settings allow SPECIFIC_USERS (otherwise SHARE_011)

Each entry in ts names one recipient and their permissions:

FieldTypeRequiredDescription
usintegerYesRecipient user seq
cvbooleanYesView permission; must be true
cebooleanYesEdit permission
cdbooleanYesDownload permission
cubooleanYesUpload permission
csbooleanYesRe-share permission
sebooleanNoSend a notification email to this recipient
Create share
curl -X POST "https://drive.example.com/api/external/v1/shares" \
-H "Authorization: Bearer replace-with-your-USER-API-KEY" \
-H "Content-Type: application/json" \
-d '{"rs": 5125, "st": "SPECIFIC_USERS", "cv": true, "ce": true, "cd": false, "cu": true, "cs": false, "ts": [{"us": 21, "cv": true, "ce": true, "cd": false, "cu": false, "cs": false, "se": true}]}'

The response returns the new shareSeq and the resulting permissions. Keep the shareSeq; every later operation on this share uses it.

Read a share​

GET /api/external/v1/shares/{shareSeq}
ParameterTypeRequiredDescription
shareSeqlongYesPath parameter - the share to read
ssintegerNoOwner seq; required when you are not the owner

Returns the share type, the share-level permissions, password and isPasswordEnabled, expireDate, and a targets array of recipients with their own permissions and tenant.

modifiable reports whether the share type can still be changed. When it is false, the type is fixed - usually because another resource in the same hierarchy already set it.

Change a share​

Requires api:write

Only the user who created the share can change it; for anyone else the request fails with SHARE_004. Recipients can be sent with any share type, as long as the tenant settings allow SPECIFIC_USERS (otherwise SHARE_011).

PATCH /api/external/v1/shares/{shareSeq}
ParameterTypeRequiredDescription
shareSeqlongYesPath parameter - the share to change
stenumYesShare type
cvbooleanNoView permission; must be true for ORG_LINK and PUBLIC_LINK
cebooleanNoEdit permission; required for ORG_LINK and PUBLIC_LINK
cdbooleanNoDownload permission; required for ORG_LINK and PUBLIC_LINK
cubooleanNoUpload permission; required for ORG_LINK and PUBLIC_LINK
csbooleanNoRe-share permission; required for ORG_LINK and PUBLIC_LINK
tsarrayNoRecipients, in the same shape as on create; replaces the whole list
Change share
curl -X PATCH "https://drive.example.com/api/external/v1/shares/36" \
-H "Authorization: Bearer replace-with-your-USER-API-KEY" \
-H "Content-Type: application/json" \
-d '{"st": "SPECIFIC_USERS", "cv": true, "ce": true, "cd": true, "cu": true, "cs": false, "ts": [{"us": 25, "cv": true, "ce": true, "cd": true, "cu": false, "cs": false, "se": true}]}'
ts replaces every recipient

If you omit ts or send an empty list, every existing recipient is removed and receives an unshare notification. To change only the type or permissions, send the current recipients again in ts.

Set recipients​

Requires api:write

Replaces the recipient list without changing the share type or its share-level permissions. Unlike the change endpoint, a user who was granted re-share permission may call this, not only the owner.

PUT /api/external/v1/shares/{shareSeq}/targets
ParameterTypeRequiredDescription
shareSeqlongYesPath parameter - the share to set recipients on
tsarrayNoRecipients, in the same shape as on create
ssintegerNoSharing user seq; null for your own resource

The list is replacing, not additive: a recipient you leave out loses access. If you omit ts or send an empty list, every existing recipient is removed and receives an unshare notification.

The request fails with SHARE_012 when sharing is disabled for the tenant, and with SHARE_013 when the share's existing type is no longer allowed by the tenant settings.

Remove a share​

Requires api:write
DELETE /api/external/v1/shares/{shareSeq}
ParameterTypeRequiredDescription
shareSeqlongYesPath parameter - the share to remove

Only the user who created the share can remove it; for anyone else the request fails with SHARE_004.

Everyone loses access, and any link for this share stops resolving. The resource itself is untouched.

Find recipients​

GET /api/external/v1/shares/{shareSeq}/users

Lists the current recipients of a share with their id, name, status, and tenant. Pass ss when you are not the owner.

To find users who could be added, search instead. Use the first form when the share already exists and the second when you are still composing one:

GET /api/external/v1/shares/{shareSeq}/users/search
GET /api/external/v1/shares/users/search
ParameterTypeRequiredDescription
skstringYesSearch keyword - an email address or account name
ssintegerNoOwner seq; required when you are not the owner

Matches are returned under data.items. The caller needs share permission on the resource. The search fails with SHARE_012 when sharing is disabled and with SHARE_011 when SPECIFIC_USERS is not allowed. Results exclude the owner and include only active (ACTIVE) regular users (USER); when external sharing is not allowed, only users in the same tenant are returned.

GET /api/external/v1/shares/link/{token}
ParameterTypeRequiredDescription
tokenstringYesPath parameter - the token from the share URL

Returns the resource the link points to, its owner, isPublicLink, and a redirectUrl to send the browser to. Get the link itself from the share-link endpoint in Common conventions.

A public link still requires a key here

The Drive web app lets anonymous visitors use this operation, but this endpoint does not allow anonymous access. It always requires an API Key, and it checks view permission against the account the key represents - even for a PUBLIC_LINK share. A link that works anonymously in a browser will return PERMISSION_002 here if the key's account cannot view the resource. An unknown or revoked token returns SHARE_007.

Errors​

A failure uses the common envelope:

Share failure
{
"result": false,
"code": 403,
"errorCode": "SHARE_011",
"message": "..."
}
CodeStatusMeaning
REQUEST_001400A request value failed validation
RESOURCE_005404The resource was not found, or you do not own it (create)
PERMISSION_002403You do not have access to the resource
PERMISSION_003400cv is false
PERMISSION_004-The permission check failed
PERMISSION_005403A permission the share type does not allow was set to true
SHARE_004404The share was not found, or you did not create it
SHARE_005500The share could not be changed
SHARE_007404No share link matches that token
SHARE_008400A parent or child resource already has a share of a different type
SHARE_009500The share could not be created
SHARE_011403SPECIFIC_USERS is not allowed by the tenant settings
SHARE_012403Sharing is disabled for the tenant
SHARE_013403The share type is not allowed by the tenant settings
SHARE_014403External sharing is not allowed
SHARE_TARGET_001500The recipients could not be set
RESPONSE_001500Unexpected server error

A recipient who is the owner or who does not exist fails with SHARE_009 on create, SHARE_005 on change, and SHARE_TARGET_001 on set recipients. A recipient in another tenant requires external sharing to be allowed (SHARE_014). See Errors for every code.