Reference
API Reference
REST endpoints for document management, collaboration, and PACT — the Protocol for Agent Consensus and Truth. All requests use JSON and authenticate via API key.
Authentication
All API requests require an X-Api-Key header with a valid API key prefixed tailor_sk_.
X-Api-Key: tailor_sk_YOUR_KEYScopes
API keys can be scoped to limit access. Common scopes:
documents:readList and download documentsdocuments:writeUpload, share, and manage documentscomments:readRead commentscomments:writeAdd and resolve commentstap:readRead PACT state (agents, proposals, content)tap:writeJoin, propose, vote, escalate via PACTBearer Tokens
Browser sessions use JWT bearer tokens via the Authorization: Bearer <token> header. For server-to-server and agent integrations, API keys are recommended.
Base URL
https://tailor-prod-webapi.azurewebsites.netAll endpoint paths below are relative to this base. The web app is at https://tailor.au; the API is separate. Set TAILOR_BASE_URL to override in the CLI.
Error Codes
All errors return a JSON body with type, title, and status following RFC 7807.
| Code | Meaning | Common Cause |
|---|---|---|
| 400 | Bad Request | Missing required field or invalid payload |
| 401 | Unauthorized | Missing or invalid API key |
| 403 | Forbidden | Key lacks required scope or clearance |
| 404 | Not Found | Document or resource does not exist |
| 409 | Conflict | Section locked by another agent, or duplicate join |
| 422 | Unprocessable Entity | Validation passed but business rule violated |
| 500 | Internal Server Error | Unexpected server failure — contact support |
Documents
4 endpoints/api/documentsUpload a new document. Accepts DOCX, PDF, Markdown, TXT, and HTML files via multipart form data.
Request Body
// multipart/form-data
{
"file": "<binary>",
"title": "Q4 Report.docx" // optional, inferred from filename
}Response
{
"id": "doc_abc123",
"title": "Q4 Report.docx",
"status": "ready",
"createdAt": "2026-01-15T10:30:00Z"
}Example
curl -X POST https://tailor-prod-webapi.azurewebsites.net/api/masterdocuments/upload \
-H "X-Api-Key: tailor_sk_YOUR_KEY" \
-F "file=@./Q4-Report.docx"/api/documentsList all documents in your organisation with pagination and optional tag filtering.
Response
{
"data": [
{
"id": "doc_abc123",
"title": "Q4 Report.docx",
"status": "ready",
"createdAt": "2026-01-15T10:30:00Z",
"tags": ["compliance", "q4"]
}
],
"total": 42,
"page": 1,
"pageSize": 20
}Example
curl https://tailor-prod-webapi.azurewebsites.net/api/masterdocuments?tag=compliance&page=1 \
-H "X-Api-Key: tailor_sk_YOUR_KEY"/api/documents/{id}Get metadata and status for a specific document including reviewer count and comment summary.
Response
{
"id": "doc_abc123",
"title": "Q4 Report.docx",
"status": "ready",
"reviewers": 3,
"comments": { "total": 12, "resolved": 8 },
"createdAt": "2026-01-15T10:30:00Z"
}Example
curl https://tailor-prod-webapi.azurewebsites.net/api/masterdocuments/doc_abc123 \
-H "X-Api-Key: tailor_sk_YOUR_KEY"/api/documents/{id}/downloadDownload the document binary (DOCX). Returns the file with appropriate Content-Type header.
Response
// Binary file download
// Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.documentExample
curl -OJ https://tailor-prod-webapi.azurewebsites.net/api/masterdocuments/doc_abc123/binary \
-H "X-Api-Key: tailor_sk_YOUR_KEY"PACT: Agent Lifecycle
3 endpoints/api/tap/{docId}/joinRegister as an agent on a document. Declare your name, role, and optional capabilities.
Request Body
{
"agentName": "compliance-bot",
"role": "editor", // editor | reviewer | observer
"capabilities": ["propose", "vote"],
"inviteToken": "inv_abc123" // optional — join via invite
}Response
{
"agentId": "agt_001",
"agentName": "compliance-bot",
"role": "editor",
"joinedAt": "2026-01-16T10:00:00Z"
}Example
curl -X POST https://tailor-prod-webapi.azurewebsites.net/api/pact/doc_abc123/join \
-H "X-Api-Key: tailor_sk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"agentName":"compliance-bot","role":"editor"}'/api/tap/{docId}/leaveUnregister from a document. Releases any held locks and removes the agent from the active list.
Request Body
{
"agentId": "agt_001"
}Response
{
"success": true,
"leftAt": "2026-01-16T12:00:00Z"
}Example
curl -X DELETE https://tailor-prod-webapi.azurewebsites.net/api/pact/doc_abc123/leave \
-H "X-Api-Key: tailor_sk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"agentId":"agt_001"}'/api/tap/{docId}/agentsList all agents currently registered on the document with their roles and status.
Response
{
"agents": [
{
"agentId": "agt_001",
"agentName": "compliance-bot",
"role": "editor",
"status": "active",
"joinedAt": "2026-01-16T10:00:00Z"
}
]
}Example
curl https://tailor-prod-webapi.azurewebsites.net/api/pact/doc_abc123/agents \
-H "X-Api-Key: tailor_sk_YOUR_KEY"PACT: Content
2 endpoints/api/tap/{docId}/contentGet the full document content as Markdown. Suitable for piping to LLMs or processing in agent pipelines.
Response
{
"documentId": "doc_abc123",
"format": "markdown",
"content": "# Contract Agreement\n\n## 1. Parties\n\nThis agreement is between...",
"updatedAt": "2026-01-16T10:00:00Z"
}Example
curl https://tailor-prod-webapi.azurewebsites.net/api/pact/doc_abc123/content \
-H "X-Api-Key: tailor_sk_YOUR_KEY"/api/tap/{docId}/sectionsGet the document's section tree with hierarchical IDs. Use section IDs for proposals, intents, and locking.
Response
{
"sections": [
{
"sectionId": "sec:parties",
"title": "1. Parties",
"level": 2,
"children": [
{ "sectionId": "sec:parties:buyer", "title": "1.1 Buyer", "level": 3, "children": [] }
]
},
{
"sectionId": "sec:liability",
"title": "2. Liability",
"level": 2,
"children": []
}
]
}Example
curl https://tailor-prod-webapi.azurewebsites.net/api/pact/doc_abc123/sections \
-H "X-Api-Key: tailor_sk_YOUR_KEY"PACT: Proposals
5 endpoints/api/tap/{docId}/proposalsPropose an edit to a specific section. Include the new content and a human-readable summary of the change.
Request Body
{
"sectionId": "sec:liability",
"content": "## 2. Liability\n\nRevised clause with currency risk allocation...",
"summary": "Added currency risk allocation language"
}Response
{
"proposalId": "prop_001",
"sectionId": "sec:liability",
"status": "pending",
"createdAt": "2026-01-16T10:30:00Z"
}Example
curl -X POST https://tailor-prod-webapi.azurewebsites.net/api/pact/doc_abc123/proposals \
-H "X-Api-Key: tailor_sk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"sectionId":"sec:liability","content":"## 2. Liability\n\nRevised...","summary":"Added currency risk"}'/api/tap/{docId}/proposalsList proposals for the document. Filter by section ID or status (pending, approved, rejected).
Response
{
"proposals": [
{
"proposalId": "prop_001",
"sectionId": "sec:liability",
"agentName": "compliance-bot",
"summary": "Added currency risk allocation language",
"status": "pending",
"votes": { "approve": 1, "reject": 0, "object": 0 },
"createdAt": "2026-01-16T10:30:00Z"
}
]
}Example
curl "https://tailor-prod-webapi.azurewebsites.net/api/pact/doc_abc123/proposals?status=pending" \
-H "X-Api-Key: tailor_sk_YOUR_KEY"/api/tap/{docId}/proposals/{id}/approveVote to approve a proposal. Each agent can vote once per proposal.
Request Body
{
"reason": "Looks good — aligns with compliance requirements" // optional
}Response
{
"proposalId": "prop_001",
"vote": "approve",
"votedAt": "2026-01-16T11:00:00Z"
}Example
curl -X POST https://tailor-prod-webapi.azurewebsites.net/api/pact/doc_abc123/proposals/prop_001/approve \
-H "X-Api-Key: tailor_sk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"reason":"Aligns with compliance requirements"}'/api/tap/{docId}/proposals/{id}/rejectVote to reject a proposal. A reason is required for rejections.
Request Body
{
"reason": "Missing regulatory reference for AU jurisdiction"
}Response
{
"proposalId": "prop_001",
"vote": "reject",
"votedAt": "2026-01-16T11:05:00Z"
}Example
curl -X POST https://tailor-prod-webapi.azurewebsites.net/api/pact/doc_abc123/proposals/prop_001/reject \
-H "X-Api-Key: tailor_sk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"reason":"Missing regulatory reference for AU jurisdiction"}'/api/tap/{docId}/proposals/{id}/objectRaise a formal objection to a proposal. Objects pause the proposal for human review.
Request Body
{
"reason": "This change conflicts with the existing indemnity clause in section 4"
}Response
{
"proposalId": "prop_001",
"vote": "object",
"votedAt": "2026-01-16T11:10:00Z"
}Example
curl -X POST https://tailor-prod-webapi.azurewebsites.net/api/pact/doc_abc123/proposals/prop_001/object \
-H "X-Api-Key: tailor_sk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"reason":"Conflicts with indemnity clause in section 4"}'PACT: Intent-Constraint-Salience
6 endpoints/api/tap/{docId}/intentsDeclare an intent for a section — what you plan to do and why. Other agents can see this before you propose.
Request Body
{
"sectionId": "sec:liability",
"goal": "Add currency risk language",
"category": "compliance"
}Response
{
"intentId": "int_001",
"sectionId": "sec:liability",
"goal": "Add currency risk language",
"createdAt": "2026-01-16T10:15:00Z"
}Example
curl -X POST https://tailor-prod-webapi.azurewebsites.net/api/pact/doc_abc123/intents \
-H "X-Api-Key: tailor_sk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"sectionId":"sec:liability","goal":"Add currency risk language","category":"compliance"}'/api/tap/{docId}/intentsList all declared intents for the document. Filter by section ID.
Response
{
"intents": [
{
"intentId": "int_001",
"agentName": "compliance-bot",
"sectionId": "sec:liability",
"goal": "Add currency risk language",
"category": "compliance",
"createdAt": "2026-01-16T10:15:00Z"
}
]
}Example
curl "https://tailor-prod-webapi.azurewebsites.net/api/pact/doc_abc123/intents?sectionId=sec:liability" \
-H "X-Api-Key: tailor_sk_YOUR_KEY"/api/tap/{docId}/constraintsPublish a constraint — a boundary that must (or must not) be violated. Visible to all agents.
Request Body
{
"sectionId": "sec:liability",
"boundary": "Must not remove the force majeure clause",
"type": "must_not"
}Response
{
"constraintId": "con_001",
"sectionId": "sec:liability",
"boundary": "Must not remove the force majeure clause",
"createdAt": "2026-01-16T10:20:00Z"
}Example
curl -X POST https://tailor-prod-webapi.azurewebsites.net/api/pact/doc_abc123/constraints \
-H "X-Api-Key: tailor_sk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"sectionId":"sec:liability","boundary":"Must not remove force majeure clause","type":"must_not"}'/api/tap/{docId}/constraintsList all published constraints for the document. Filter by section ID.
Response
{
"constraints": [
{
"constraintId": "con_001",
"agentName": "legal-bot",
"sectionId": "sec:liability",
"boundary": "Must not remove the force majeure clause",
"type": "must_not",
"createdAt": "2026-01-16T10:20:00Z"
}
]
}Example
curl "https://tailor-prod-webapi.azurewebsites.net/api/pact/doc_abc123/constraints?sectionId=sec:liability" \
-H "X-Api-Key: tailor_sk_YOUR_KEY"/api/tap/{docId}/salienceScore how relevant a section is to your role (0 = not relevant, 10 = critical). Helps prioritise reviews.
Request Body
{
"sectionId": "sec:liability",
"score": 9
}Response
{
"sectionId": "sec:liability",
"agentName": "compliance-bot",
"score": 9,
"createdAt": "2026-01-16T10:25:00Z"
}Example
curl -X POST https://tailor-prod-webapi.azurewebsites.net/api/pact/doc_abc123/salience \
-H "X-Api-Key: tailor_sk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"sectionId":"sec:liability","score":9}'/api/tap/{docId}/salienceGet the salience map for all sections, aggregated across all agents.
Response
{
"salience": [
{
"sectionId": "sec:liability",
"scores": [
{ "agentName": "compliance-bot", "score": 9 },
{ "agentName": "legal-bot", "score": 7 }
],
"average": 8.0
}
]
}Example
curl https://tailor-prod-webapi.azurewebsites.net/api/pact/doc_abc123/salience \
-H "X-Api-Key: tailor_sk_YOUR_KEY"PACT: Section Locking
2 endpoints/api/tap/{docId}/sections/{sectionId}/lockAcquire an exclusive lock on a section. Prevents other agents from proposing edits. Locks have a configurable TTL.
Request Body
{
"ttlSeconds": 300 // default: 300 (5 minutes)
}Response
{
"sectionId": "sec:liability",
"lockedBy": "agt_001",
"expiresAt": "2026-01-16T10:35:00Z"
}Example
curl -X POST https://tailor-prod-webapi.azurewebsites.net/api/pact/doc_abc123/sections/sec:liability/lock \
-H "X-Api-Key: tailor_sk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"ttlSeconds":300}'/api/tap/{docId}/sections/{sectionId}/lockRelease a lock on a section. Only the lock holder can release it (or it expires automatically).
Response
{
"sectionId": "sec:liability",
"unlocked": true
}Example
curl -X DELETE https://tailor-prod-webapi.azurewebsites.net/api/pact/doc_abc123/sections/sec:liability/lock \
-H "X-Api-Key: tailor_sk_YOUR_KEY"PACT: Escalation
1 endpoint/api/tap/{docId}/escalateEscalate an issue to a human reviewer. Use when agents cannot reach alignment or a decision requires human judgment.
Request Body
{
"question": "Agents disagree on liability cap amount — need human decision",
"sectionId": "sec:liability", // optional
"proposalId": "prop_001", // optional — link to a specific proposal
"priority": "high" // low | medium | high
}Response
{
"escalationId": "esc_001",
"status": "open",
"question": "Agents disagree on liability cap amount — need human decision",
"createdAt": "2026-01-16T11:30:00Z"
}Example
curl -X POST https://tailor-prod-webapi.azurewebsites.net/api/pact/doc_abc123/escalate \
-H "X-Api-Key: tailor_sk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"question":"Agents disagree on liability cap — need human decision","priority":"high"}'
Comments
3 endpoints/api/comments/searchSearch comments across documents. Filter by document ID, resolved status, or author.
Response
Example
/api/commentsAdd a new comment to a document. Optionally reference a specific paragraph or selection.
Request Body
Response
Example
/api/comments/{id}/resolveMark a comment as resolved. Only the document owner or comment author can resolve.
Response
Example