Skip to main content

SOP API

The SOP API provides endpoints for managing Standard Operating Procedures in the KnowledgePulse Registry. SOPs are stored as ExpertSOP knowledge units with additional versioning and approval workflows.

Create an SOP

POST /v1/sop
PropertyValue
Auth requiredYes (write scope)
Rate-limit exemptNo

Create a new SOP in the registry.

Request body

FieldTypeRequiredDescription
namestringYesSOP name
domainstringYesTask domain
visibilitystringYesprivate, org, or network
decision_treearrayYesArray of decision tree nodes
descriptionstringNoBrief description
tagsstring[]NoSearchable tags

Response

{
"data": {
"id": "kp:sop:abc-123",
"name": "Bug Triage",
"domain": "engineering",
"version": 1,
"status": "draft",
"created_at": "2026-02-15T10:00:00.000Z"
}
}

Example

curl -X POST http://localhost:8080/v1/sop \
-H "Content-Type: application/json" \
-H "Authorization: Bearer kp_your_key" \
-d '{
"name": "Bug Triage",
"domain": "engineering",
"visibility": "org",
"decision_tree": [
{
"step": "classify",
"instruction": "Classify the bug by severity",
"conditions": {
"critical": { "action": "Escalate to on-call", "sla_min": 15 },
"major": { "action": "Assign to sprint", "sla_min": 60 }
}
}
]
}'

Get an SOP

GET /v1/sop/:id
PropertyValue
Auth requiredOptional
Rate-limit exemptNo

Retrieve a single SOP by its ID. Returns the latest approved version by default.

Query parameters

ParameterTypeDefaultDescription
versionnumberlatestSpecific version number to retrieve

Example

curl http://localhost:8080/v1/sop/kp:sop:abc-123
curl "http://localhost:8080/v1/sop/kp:sop:abc-123?version=2"

Update an SOP

PUT /v1/sop/:id
PropertyValue
Auth requiredYes (write scope)
Rate-limit exemptNo
AccessOriginal author or admin

Update an existing SOP. Creates a new version automatically.

Request body

Same fields as the create endpoint. Only provided fields are updated.

Response

{
"data": {
"id": "kp:sop:abc-123",
"version": 2,
"status": "draft",
"updated_at": "2026-02-16T09:00:00.000Z"
}
}

Delete an SOP

DELETE /v1/sop/:id
PropertyValue
Auth requiredYes (write or admin scope)
Rate-limit exemptNo
AccessOriginal author or admin

Permanently delete an SOP and all its versions.

Response

{
"data": {
"id": "kp:sop:abc-123",
"deleted": true
}
}

List SOP Versions

GET /v1/sop/:id/versions
PropertyValue
Auth requiredOptional
Rate-limit exemptNo

List all versions of an SOP.

Response

{
"data": [
{ "version": 1, "status": "approved", "created_at": "2026-02-15T10:00:00.000Z" },
{ "version": 2, "status": "draft", "created_at": "2026-02-16T09:00:00.000Z" }
]
}

Approve an SOP Version

POST /v1/sop/:id/approve
PropertyValue
Auth requiredYes (admin scope)
Rate-limit exemptNo

Approve a specific version of an SOP, making it the default version returned by GET /v1/sop/:id.

Request body

FieldTypeRequiredDescription
versionnumberYesVersion number to approve

Response

{
"data": {
"id": "kp:sop:abc-123",
"version": 2,
"status": "approved",
"approved_at": "2026-02-16T10:00:00.000Z"
}
}

Export SOP as Skill-MD

GET /v1/sop/:id/export-skill
PropertyValue
Auth requiredOptional
Rate-limit exemptNo

Export an SOP as a Skill-MD formatted file. Returns the content as text/markdown.

Query parameters

ParameterTypeDefaultDescription
versionnumberlatest approvedVersion to export

Example

curl http://localhost:8080/v1/sop/kp:sop:abc-123/export-skill \
-H "Accept: text/markdown" \
-o bug-triage.skill.md

Response (text/markdown)

---
name: Bug Triage
description: Standard procedure for classifying and routing bugs
version: "2"
tags: [engineering, triage]
kp:
domain: engineering
knowledge_capture: true
visibility: org
---

## Steps
1. Classify the bug by severity
- **Critical**: Escalate to on-call (SLA: 15 min)
- **Major**: Assign to sprint (SLA: 60 min)