Update library

Renames one of your items, shares it with your organization or stops sharing it, moves it to a project, or commits a reserved upload.

PATCH /v1/library/{id}

Addresshttps://api.hanzo.ai/v1/library/{id}
MethodPATCH
Operationpatch_library_by_id
AuthAuthorization: Bearer $HANZO_API_KEY

Renames one of your items, shares it with your organization or stops sharing it, moves it to a project, or commits a reserved upload. Only its owner changes an item; a member's shared item answers 404 here as one that does not exist.

Request

6 fields, body application/json (required).

FieldInTypeRequiredDescription
idpathstringyesID is the item, from the path.
commitbodyboolean—Commit finishes a reserved upload once its bytes have been PUT.
idbodystring—ID is the item, from the path.
namebodystring—Name renames it.
projectbodystring—Project moves it to one of the organization's projects; "" moves it out.
sharedbodyboolean—Shared shows it to every member of your organization, or stops.

Response

StatusBodyMeaning
200library.LibraryItemok
defaultproblem-detailsrefused

200 body — 29 fields.

FieldInTypeAlwaysDescription
bybodystring—By is the owner as a reader names them: the name, else the address, the identity boundary carried when the item was made.
bytesbodyinteger (int64)—
createdbodystring—
downloadbodystring—
expiresbodystring—
heightbodyinteger (int64)—
idbodystring—
kindbodystring—
mimebodystring—
minebodyboolean—
namebodystring—
originbodystring—
ownerbodystring—
pagesbodyinteger (int64)—
previewbodystring—
projectbodystring—
refbodystring—
secondsbodynumber (double)—
sharedbodyboolean—
sourcebodystring—
updatedbodystring—
uploadbodylibrary.LibraryUpload—
upload.expiresbodystring—
upload.headersbodylibrary.Field[]—Headers are the ones the PUT must carry.
upload.headers[].namebodystring—Name is the field's name.
upload.headers[].valuebodystring—Value is the field's value, verbatim.
upload.urlbodystring—
urlbodystring—
widthbodyinteger (int64)—

Failure carries the platform error shape — see Errors.

Examples

hanzo library update <id>
import { Configuration, LibraryApi } from 'hanzoai';

const api = new LibraryApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.patchLibraryById({ id: 'id', commit: false, id: "<id>" });
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import LibraryApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = LibraryApi(client).patch_library_by_id(id='id', commit=False, id="<id>")
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.LibraryAPI.PatchLibraryById(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::apis::{configuration::Configuration, library_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = library_api::patch_library_by_id(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.LibraryApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new LibraryApi(client).patchLibraryById();
curl -X PATCH https://api.hanzo.ai/v1/library/<id> \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "commit": false,
       "id": "<id>"
     }'

MCP reaches library through the library tool, which names its 6 operations with its own verbs — this one among them, under a name only MCP declares. describe explains any of them:

curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "list_libraries"
         }
       }
     }'

Library API · All Hanzo APIs · Interactive reference

Was this page useful?
Broken link or missing step? Drop it in #docs on Discord or open a PR.