/api/categories
Categories organize standards within a library. Like libraries, categories are scoped to a subject.
GET /api/categoriesList standard categories with optional filtering. Use this to find a valid categoryId before creating a standard or importing/adding an existing standard into a project — a category must belong to the right scope (project-scoped categories only work for that project's own standards).
Required permission: category:read
| Name | In | Type | Description |
|---|---|---|---|
| subject_type | query | string | Scope filter: 'global' | 'company' | 'project' | 'user'. Pair with subject_id for the last three. |
| subject_id | query | integer | The id of that scope — the PROJECT id when subject_type is "project". |
| include_global | query | string | 'true' to also return global categories alongside a non-global scope. |
| tree | query | string | 'true' returns parents with their children nested, instead of one flat list. |
| library_id | query | integer | Lists one library's categories: the library's own, plus any category of the same company, person or project that no library owns yet. With include_global=true the SynC Standards categories are included. Use it in place of subject_type and subject_id. A library you cannot read is a 404. |
ALWAYS SCOPE THIS CALL WHEN YOU ARE WORKING ON A PROJECT: send subject_type=project and subject_id=<the project id>. The unfiltered call returns every category in every scope you can reach, which is routinely large enough to be truncated to fit the context budget — and what gets dropped is the END of the list, which is where a project's own sub-sections sort. A truncated category list looks exactly like a complete one: you will see plausible categories and no error. If you are about to rename, audit, or report on "all" of a project's sections, an unscoped list CANNOT support that claim, and a `truncated: true` marker in the result means you have not seen them all — re-issue it scoped rather than answering. Add tree=true when the parent/child structure matters, e.g. to reason about sub-sections. Every category belongs to a library, and each row carries its library_id (null only for a project section). Send library_id to list one library's categories.
GET /api/categories/:idGet a category by ID with its standard count.
Required permission: category:read
POST /api/categoriesCreate a new standard category.
Required permission: category:create
name — stringsubject_type — stringdescription — stringsubject_id — integerparent_id — integer — the id of the top-level section this one goes UNDER; omit for a top-level sectionsort_order — integer — position among its siblings; omit to appendlibrary_id — integer — the library the category belongs to. subject_type and subject_id are then taken from the library, and sending ones that do not match it is a 400subject_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 category 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. parent_id IS HOW A SUB-SECTION IS CREATED. Omit it and the new category is filed at the TOP level, no matter how the user described it — "add a Switchgear sub-section under Electrical" without parent_id silently produces a second top-level section named Switchgear, and the card's "Filed under" row comes back blank. Read the destination id first (GET /api/categories?subject_type=...&subject_id=...&tree=true), and send it. Nesting is ONE LEVEL DEEP: the parent must itself be top-level (a parent that already has a parent is a 400), and it must be in the SAME scope as the category you are creating (same subject_type AND subject_id) — a global parent cannot hold a project section. A category in the SynC Standards library (subject_type global) cannot be created here: 409 ("Categories in the SynC Standards library are managed on SynC Standards..."). Add it on the wiki; it reaches the library when a standard in it is adopted. A CATEGORY BELONGS TO A LIBRARY. Send library_id to say which. Without library_id, a sub-category takes its parent's library, and any other category takes the scope's only library. A scope with several libraries is a 400 (metadata.code LIBRARY_CHOICE_REQUIRED) that lists them in metadata.libraries, so send one of them. A scope with no library (a company's or your personal scope) gets its Default library, created with the category. An API key or connected app never creates a library: there, a scope with no library is a 409 (metadata.code CATEGORY_LIBRARY_REQUIRED), so create one with POST /api/libraries first and send its library_id. A library of another scope gets the same 404 as a missing library, and a parent in another library is a 400. A project section has no library. camelCase (subjectType, subjectId, parentId, sortOrder) is accepted for every field here, but the validation errors name the snake_case spelling — "subject_id is required" is about the subjectId you sent, not a second field. PROJECT-SCOPED CATEGORIES ARE REVISION CONTENT. When the category has subject_type "project", this call requires an open draft and the change is STAGED in it — the live project keeps its old value until the draft is published, so do not report the rename as already in effect, and do not re-issue the call because the live value looks unchanged. With no open draft the call is rejected: propose POST /api/projects/:id/draft/create first (itself a user-approved change), then retry. Categories in the global, company and user scopes are NOT revision content — they need no draft and apply immediately.
PUT /api/categories/:idUpdate a category name, description, parent, or sort order.
Required permission: category:update
name — stringdescription — string — REPLACES the stored description wholesale; it never appends. To add, mention, append, or include something while keeping what is already there, first read the current value (GET /api/categories/:id) and send the existing text WITH your addition merged into it. Sending only the new sentence deletes everything the description previously said.parentId — integer — re-parent this category (null makes it top-level). Over HTTP only: SynC's in-app assistant does not read this parameter, so sending it from the assistant changes nothing about the result.sortOrder — integer — position among its siblings. Over HTTP only: SynC's in-app assistant does not read this parameter, so sending it from the assistant changes nothing about the result.parentId and sortOrder are HTTP-only: this assistant can rename a section and edit its description, but it cannot re-parent or reorder one — sending either is silently ignored here, so never report a section as moved or reordered on the strength of a successful response. To change where a STANDARD is filed, use POST /api/projects/:id/standards with action "recategorize"; that moves the standard, not the section. A SynC Standards (global) category linked to a wiki category is managed on the wiki: a rename, move or reorder here is refused with 409 ("This category is managed on SynC Standards..."); edit it on the wiki and the change carries over. Its description stays editable here. PROJECT-SCOPED CATEGORIES ARE REVISION CONTENT. When the category has subject_type "project", this call requires an open draft and the change is STAGED in it — the live project keeps its old value until the draft is published, so do not report the rename as already in effect, and do not re-issue the call because the live value looks unchanged. With no open draft the call is rejected: propose POST /api/projects/:id/draft/create first (itself a user-approved change), then retry. Categories in the global, company and user scopes are NOT revision content — they need no draft and apply immediately.
POST /api/categories/:id/mergeMerge one category (section) into another within the same scope. The source section is emptied and deleted; its standards, placements, and child sub-sections all move to the target.
Required permission: category:delete
intoCategoryId — integerA SynC Standards (global) category linked to a wiki category, or one with a linked sub-category, cannot be merged away: 409 ("This category is managed on SynC Standards..."). Merging another category INTO a linked one is allowed. Categories of different libraries cannot be merged. The 400 (metadata.code CATEGORY_LIBRARY_MISMATCH) names both libraries.
DELETE /api/categories/:idDelete an EMPTY category (section). Its standards are NOT auto-filed anywhere and are never deleted with it: name reassignTo and they move there, or the call refuses with 409. Sub-categories need an explicit disposition, and a "cascade" refuses while any sub-section still holds standards. There is no undo on the section itself. To empty a section into another one, POST /api/categories/:id/merge also works.
Required permission: category:delete
reassignTo — integer — category id to move this one's standards into; REQUIRED when it holds anychildDisposition — string — reassign | promote | cascade; REQUIRED when the category has sub-categorieschildReassignTo — integer — top-level category id; REQUIRED when childDisposition is "reassign"THE CATEGORY'S OWN STANDARDS. If it holds any, reassignTo is REQUIRED: it moves every one of them into that category (validated for scope access). Omit it and the call returns 409 naming the count — a section is a heading, and removing a heading never deletes what is filed under it. To destroy the standards instead, delete them individually with DELETE /api/standards/:id, which requires each to be deprecated first and refuses any that a published revision serves. An empty category needs no reassignTo. SUB-CATEGORIES. If the category has any, childDisposition is REQUIRED (400 otherwise, listing the children): "reassign" re-parents them under childReassignTo, which must be a TOP-LEVEL category in the SAME scope; "promote" makes them top-level; "cascade" deletes the child categories, and refuses with 409 if any of them still holds standards. Any other value is a 400. A project-scoped section is revision content: deleting one requires an open project draft. What a project section holds is what that draft shows in it (its unarchived placements); reassignTo moves the draft's placements and must be a section of the same project (400 otherwise). A SynC Standards (global) category linked to a wiki category, or one with a linked sub-category, is deleted on the wiki only: 409 ("This category is managed on SynC Standards..."). For a library's category, reassignTo must be a category of the same library. A category of another library is a 400 (metadata.code CATEGORY_LIBRARY_MISMATCH).
POST /api/categories/adoptCopy a category (and its parent, if it has one) from one scope into another — the normal way to bring a global or company section structure into a project. Find-or-create matches on the trimmed, case-insensitive name, so repeating the call returns the same category instead of a duplicate.
Required permission: category:create
sourceCategoryId — integer — the category to copy FROMtargetSubjectType — string — 'project' | 'company' | 'user'targetSubjectId — integer — id of that project/company/usertargetLibraryId — integer — the company or personal library the copies go in. The target is taken from the library, so targetSubjectType and targetSubjectId may be left out. Without it the target's only library is used, and a target with several libraries is a 400 (LIBRARY_CHOICE_REQUIRED) that lists them. Do not send it for a project.Idempotent by name: an existing category with the same name in the target scope is reused, not duplicated, and neither its description nor its sort order is overwritten. A category belongs to one library, so copying it into another library of the same company or person gives that library its own copy. Copying it into the library, or the project, it is already in is refused with a 400. snake_case spellings (source_category_id, target_subject_type, target_subject_id) are accepted as aliases. Into a project it needs the open draft, like creating a section (400 "No draft found. Please create a draft before creating categories." otherwise): each section it adds is recorded in that draft, a name the draft already uses at that place is a 409, and an existing parentless section of the same name is not moved under the adopted parent. 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.