Libraries

/api/libraries

Standard libraries group related standards. Each library is scoped to a subject (global, company, or project).

Endpoints

GET /api/libraries

List standard libraries accessible to you. Filterable by owning scope.

Required permission: library:read

Parameters
NameInTypeDescription
subject_typequerystringOwning scope: 'global' | 'company' | 'project' | 'user'. Pair with subject_id for the last three.
subject_idqueryintegerThe id of that scope — the PROJECT id when subject_type is "project", the COMPANY id when it is "company". Sending it without subject_type does not scope anything.

GET /api/libraries/:id

Get a library by ID with its standard count.

Required permission: library:read

POST /api/libraries

Create a new standard library.

Required permission: library:create

Request body (JSON)

Required
Optional

subject_id scopes ownership: for subject_type 'user' it MUST be your own user id, for 'company' your own company id. Another account's id is rejected before anything is written, and the rejection names the id to use — do not retry with a guessed id, and never create a library in someone else's scope. GET /api/whoami?fields=ids lists your user id, your companies and your personal libraries. From an API key or connected app, subject_id may be left out: for 'user' it is your own id, for 'company' the one company you act for (with several, the refusal lists their ids). A personal library (subject_type 'user') needs a live company seat to write in: creating, editing, saving a revision, retiring or deleting there, and customizing into it, are refused with 403 `metadata.code = "PERSONAL_LIBRARY_NEEDS_SEAT"` when you hold no seat. A project role is not a seat. Without one you can still read your personal library; nothing in it is deleted. With a seat, your OWN personal library is yours to author whichever company roles you hold: the standard/library/category create, update and delete permissions this endpoint names are not needed there for a signed-in person (a plain company member creates personal libraries and sections). An API key or connected app must still carry the permission in its own list; without it the call is 403 `permission_denied`, even though its seated owner may. To learn ahead of a write whether you hold a seat, read `personal_library_seated` on GET /api/whoami?fields=ids (a signed-in person also finds it on GET /api/users/profile): true when you may write in your personal library, false when the write would be refused.

PUT /api/libraries/:id

Update a library name or description.

Required permission: library:update

Request body (JSON)

Optional

GET /api/libraries/:id/parameters

The library parameter register: every project-parameter name this library knows, its description, and the standards whose current published revision asserts it (via [[parameter: …]] in clause prose or in a derived datasheet field's basis). Names with no description yet are INCLUDED — an undescribed name is the register's main subject, not an omission — as are descriptions no standard asserts any more, which are retained rather than deleted. Use this to find the right existing name before authoring a new [[parameter: …]] marker. It reports nothing about what any project answered. A PROJECT's own library serves its descriptions live from the open draft, so it answers only a reader who can see that draft (project:draft:view or project:draft:edit on the project); anyone else, a project viewer included, gets 404 "Library not found", the same answer as a library that does not exist. Read an issued revision's frozen descriptions on GET /api/projects/:id/parameters with its revisionId instead.

Required permission: library:read

PATCH /api/libraries/:id/parameters/:name

Write a parameter's DESCRIPTION in this library. The description is the only editable field. A parameter's NAME is derived from the standards that assert it and cannot be changed here: sending a "name" field is rejected with a 400, and there is no merge, alias or delete operation. To rename or unify two parameters, edit the [[parameter: …]] markers in the asserting standards and publish a new revision — that is the only repair path, and proposing a merge instead will not work. The name must already exist in the library (it has an entry, or a published standard asserts it); this endpoint cannot mint one. Gated on STANDARD authoring in the library's scope, not on editing the library: whoever may write the [[parameter: …]] marker may say what it means.

Required permission: standard:update

Parameters
NameInTypeDescription
namepathstringThe parameter name, URL-encoded. Matched case-insensitively with whitespace collapsed, the same way the scanner normalises it — "Site Ambient" and "site ambient" address the same entry.

Request body (JSON)

Required

description REPLACES the stored text — read the register first (GET /api/libraries/:id/parameters) if you mean to amend rather than overwrite. Send null to clear it. Do NOT send a "name" field: names are derived from the asserting standards and a rename attempt is rejected outright.

DELETE /api/libraries/:id

Delete an EMPTY library. It does NOT delete the standards filed in it, and it refuses with 409 while it still holds any — move them to another library (PUT /api/standards/:id) or delete them one at a time (DELETE /api/standards/:id), then delete the library. Deleting a container must never destroy its contents, so there is no confirm-and-take-everything option. If the intent is only to change the library's name or description, use PUT /api/libraries/:id instead — renaming a library to something like "(deleted)" is never a substitute for deleting it.

Required permission: library:delete

Request body (JSON)

No body. The library must be empty: a 409 names how many standards it still holds and gives one by name, so read that message back to the user rather than guessing. GET /api/libraries/:id reports standard_count up front if you want to check before calling. This endpoint never deletes a standard, so it can never remove one that a published project revision serves.