Back to API Overview

Sharing API

Existing share links: change and revoke them, and read their activity; a new share is made with the Files tools.

8 endpoints

Endpoints

POST
/api/v1/sharing/getResourceShares

Get all shares for a resource. Params: resourceType, resourceId. Returns array of shares with tokens and settings; hasPassword says whether a password is set (the password itself is never returned).

Parameters

resourceTypestringrequired

Resource type

Allowed values: FILE, FLOW, BASE, FOLDER

resourceIdstringrequired

Resource ID

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/sharing/getResourceShares \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "resourceType": "example",
  "resourceId": "example"
}'
POST
/api/v1/sharing/getShareByResourceId

Public endpoint to check if resource is shared. Params: resourceType, resourceId, password (if the link is protected — send it in the request body, never a URL). An expired link answers like a resource that is not shared; a link that needs a password or sign-in shows nothing of the file or folder until it is given.

Parameters

resourceTypestringrequired

Resource type

Allowed values: FILE, FLOW, BASE, FOLDER

resourceIdstringrequired

Resource ID

passwordstring

Password if the link is protected (send it in the request body or the x-share-password header, never a URL)

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/sharing/getShareByResourceId \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "resourceType": "example",
  "resourceId": "example",
  "password": "example"
}'
POST
/api/v1/sharing/getShareByToken

Access share by token. Params: shareToken (from share URL), password (if protected — send it in the request body, never a URL). Wrong passwords slow down only the caller: after a few misses it answers TOO_MANY_REQUESTS with how long to wait.

Parameters

shareTokenstringrequired

Share token from the URL

passwordstring

Password if share is protected

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/sharing/getShareByToken \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "shareToken": "example",
  "password": "example"
}'
POST
/api/v1/sharing/updateShare

Modify share settings. Params: shareId (from getResourceShares), permission (the same or lower), accessType (only RESTRICTED), password (set or change it; never removed), expiresAt (an ISO date and time with its zone, e.g. 2026-11-13T23:59:59Z; a bare date or a time with no zone is refused; only sooner than the current expiry), allowDownload / allowCopy (only turned off), requireAuth (only turned on). A link can only be narrowed: it is never made public, made to last longer, stripped of its password or sign-in, opened to downloading or copying, or given a higher permission. A revoked or expired link can't be changed. No new link of this kind can be made: share a file or folder with files_setAccessRules / files_setFolderAccessRules instead (this tool only manages links that already exist).

Parameters

shareIdstringrequired

Share ID to update

accessTypestring

New access type: only RESTRICTED (a link is never made public here)

Allowed values: RESTRICTED

permissionstring

New permission level: only the same or lower

Allowed values: VIEWER, COMMENTER, EDITOR, OWNER

allowDownloadboolean

Allow downloading: only turned off (never on)

allowCopyboolean

Allow copying: only turned off (never on)

requireAuthboolean

Require login to access: only turned on (never off)

expiresAtstringnull

New expiration, an ISO date and time with its zone (e.g. 2026-11-13T23:59:59Z): only sooner than the current one (never removed or moved later)

passwordstringnull

New password (a link's password is never removed here, only set or changed)

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/sharing/updateShare \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "shareId": "example",
  "accessType": "example",
  "permission": "example"
}'
POST
/api/v1/sharing/revokeShare

Disable a share (keeps record). Param "shareId". Act only on what the person named or picked.

Parameters

shareIdstringrequired

Share ID to revoke

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/sharing/revokeShare \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "shareId": "example"
}'
POST
/api/v1/sharing/deleteShare

Permanently delete share. Param "shareId". Act only on what the person named or picked.

Parameters

shareIdstringrequired

Share ID to delete

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/sharing/deleteShare \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "shareId": "example"
}'
POST
/api/v1/sharing/recordActivity

Record that a shared link was viewed or downloaded. Params: shareToken, action ("VIEWED" or "DOWNLOADED"). Nothing else is accepted. A link with a password, or one that needs sign-in, cannot be recorded here: its activity is recorded when a visitor opens it with the right password.

Parameters

shareTokenstringrequired

Share token from the URL

actionstringrequired

What the visitor did: "VIEWED" or "DOWNLOADED"

Allowed values: VIEWED, DOWNLOADED

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/sharing/recordActivity \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "shareToken": "example",
  "action": "example"
}'
POST
/api/v1/sharing/getShareActivity

Get access log. Params: shareId, limit (default 50), offset.

Parameters

shareIdstringrequired

Share ID

limitnumber

Max activities to return (1-100, default: 50)

offsetnumber

Skip activities for pagination

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/sharing/getShareActivity \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "shareId": "example",
  "limit": 0,
  "offset": 0
}'