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.

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.

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.

Required permission: library: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

PERMANENTLY delete a library AND every standard filed in it (hard delete, cascading to those standards revisions and elements). There is no undo and no archive. 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)

Optional

confirmName is REQUIRED whenever the library still contains at least one standard, and must match the library's name EXACTLY (character for character) — any other value is rejected with a 400 naming the count of standards that would be destroyed. Read the library first (GET /api/libraries/:id) to get its exact name and standard count, and tell the user how many standards will be destroyed before proposing this. An empty library needs no confirmName.