---
title: "Share, publish or update grants on an original Library file [write]"
method: PUT
path: "/library/links"
---

# Share, publish or update grants on an original Library file \[write\]

`PUT /library/links`

## Request

- Base URL: `https://api.agentsky.dev/v1`
- URL: `https://api.agentsky.dev/v1/library/links`
- Auth: HTTP bearer

Compare-and-set revision (0 for initial state); stale settings return 409. Public access is view-only. Edit grants require native source editing. Member grants bind current platform member identities. No workspace permits private/public only. Revoking publicEnabled invalidates the URL; publishing again mints a new URL. For unrestricted owners, consumer-artifact public access is shared with the legacy artifact share API; disabling it revokes every public alias while preserving authenticated member grants. Fixed-workspace credentials update only their selected audience link. Public artifact URLs honor the artifact pin; authenticated member URLs follow latest.

## Request body

- LibraryLinkChange
  - `ref` union, required
    - object
      - `kind` 'agent_prompt', required
      - `agentId` string, required: The original agent user instruction file (AGENTS.md); never the combined runtime/system prompt.
    - object
      - `kind` 'file', required
      - `fileId` string, required
      - `sessionId` string
    - object
      - `kind` 'task_file', required
      - `taskId` string, required
      - `path` string, required
    - object
      - `kind` 'memory_note', required
      - `storeId` string, required
      - `memoryId` string, required
    - object
      - `kind` 'skill_file', required
      - `skillId` string, required
      - `path` string, required
    - object
      - `kind` 'artifact', required
      - `artifactId` string, required
    - object
      - `kind` 'platform_artifact', required
      - `artifactId` string, required
      - `path` string: Exact full path from the native artifact manifest; DesignSystem files use root plus the relative editable_files path. Omit only for the entire artifact entry.
  - `workspace` string, nullable
  - `revision` integer, required
  - `sharingRevision` string: For consumer artifacts, the whole sharing revision returned by artifact.sharingRevision. Supply it to reject concurrent changes in another workspace or the legacy share API.
  - `workspaceAccess` 'none' | 'view' | 'edit', required
  - `publicEnabled` boolean, required
  - `members` object[], required
    - `userId` string, required
    - `access` 'view' | 'edit', required

## Response `200`

Updated settings

- LibraryLinkResponse
  - `artifact` object: For consumer artifacts: effective sharing across the legacy public link, workspace placement and all original-file grants; public links share one pinned version.
    - `enabled` boolean
    - `sharingRevision` string
    - `revision` integer
    - `publicVersion` integer, nullable
    - `url` string, nullable
    - `workspace` object, nullable
    - `versions` object[]
    - `grants` object[]
  - `link` object, required
    - `ref` union, required
      - object
        - `kind` 'agent_prompt', required
        - `agentId` string, required: The original agent user instruction file (AGENTS.md); never the combined runtime/system prompt.
      - object
        - `kind` 'file', required
        - `fileId` string, required
        - `sessionId` string
      - object
        - `kind` 'task_file', required
        - `taskId` string, required
        - `path` string, required
      - object
        - `kind` 'memory_note', required
        - `storeId` string, required
        - `memoryId` string, required
      - object
        - `kind` 'skill_file', required
        - `skillId` string, required
        - `path` string, required
      - object
        - `kind` 'artifact', required
        - `artifactId` string, required
      - object
        - `kind` 'platform_artifact', required
        - `artifactId` string, required
        - `path` string: Exact full path from the native artifact manifest; DesignSystem files use root plus the relative editable_files path. Omit only for the entire artifact entry.
    - `workspace` string, nullable
    - `revision` integer, required
    - `sharingRevision` string: For consumer artifacts, the whole sharing revision returned by artifact.sharingRevision. Supply it to reject concurrent changes in another workspace or the legacy share API.
    - `workspaceAccess` 'none' | 'view' | 'edit', required
    - `publicEnabled` boolean, required
    - `members` object[], required
      - `userId` string, required
      - `access` 'view' | 'edit', required
    - `id` string, nullable, required
    - `editable` boolean, required
    - `sharedUrl` string, nullable, required
    - `publicUrl` string, nullable, required
  - `availableMembers` object[], required
    - `userId` string, required
    - `name` string, nullable, required
    - `email` string, nullable, required

## Other responses

- `default`: Error — { error: { code, message } }

## Changes

- **2026-11-02** `e5e8f0229a99`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/agentsky/apis/agentsky-developer-api/changes/library/links/put.md)

---

[API](https://skmtc.dev/agentsky/apis/agentsky-developer-api.md) - [All operations](https://skmtc.dev/agentsky/apis/agentsky-developer-api/llms.txt) - [OpenAPI document](https://skmtc.dev/agentsky/apis/agentsky-developer-api/revisions/8280a065ef6a?raw)
