Agent API
REST API endpoints for creating and managing AI agent jobs that maintain your documentation.
Overview
The Agent API lets you programmatically create and manage AI agent jobs that audit, update, and maintain your documentation. The agent reads your docs, identifies issues (broken links, stale content, OpenAPI drift), and produces actionable suggestions that you can approve or reject before they are committed to your repository.
Base path: https://api.holydocs.com/api/v1/projects/:projectId/agent
All agent endpoints require authentication with the agent:write scope.
Agent jobs run asynchronously on HolyDocs infrastructure. Each job is processed by a dedicated queue worker that orchestrates the LLM, tool calls, and Git operations. You receive results via polling or webhooks.
Create Agent Job
Create a new agent job with a natural language prompt describing what you want the agent to do.
bashPOST /api/v1/projects/:projectId/agent/jobs
bashcurl -X POST "https://api.holydocs.com/api/v1/projects/$PROJECT_ID/agent/jobs" \ -H "Authorization: Bearer $HOLYDOCS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"prompt":"Review API reference pages for broken links","scope":"all"}'
bashholydocs api post "/projects/$PROJECT_ID/agent/jobs" \ --json '{"prompt":"Review API reference pages for broken links"}'
tsimport { HolyDocs } from '@holydocs/sdk';const client = new HolyDocs({ apiKey: process.env.HOLYDOCS_API_KEY });const { data: job } = await client.agent.createJob(projectId, { prompt: 'Review API reference pages for broken links', scope: 'all',});
Path Parameters
| Parameter | Type | Description |
|---|---|---|
projectId | string | Project ID |
Request Body
json{ "prompt": "Review all API reference pages for broken links and outdated code examples. Suggest fixes for any issues found.", "scope": "all", "autoCommit": false}
| Field | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Natural language instruction for the agent (1-5000 characters) |
scope | all | section | page | No | Scope of the job (default: all) |
scopePath | string | No | When scope is section or page, the path to target (e.g., /api or /api/authentication) |
autoCommit | boolean | No | Automatically commit approved suggestions (default: false) |
priority | normal | high | No | Job priority in the queue (default: normal, high available on Business+) |
Response
json{ "data": { "id": "job_abc123", "projectId": "proj_xyz", "status": "queued", "prompt": "Review all API reference pages for broken links and outdated code examples. Suggest fixes for any issues found.", "scope": "all", "autoCommit": false, "createdAt": "2026-04-11T10:00:00Z" }}
bashcurl -X POST "https://api.holydocs.com/api/v1/projects/proj_abc123/agent/jobs" \ -H "Authorization: Bearer hd_a1b2c3d4e5f67890a1b2c3d4e5f67890" \ -H "Content-Type: application/json" \ -d '{ "prompt": "Check all pages for broken links and suggest fixes", "scope": "all", "autoCommit": false }'
javascriptconst response = await fetch( 'https://api.holydocs.com/api/v1/projects/proj_abc123/agent/jobs', { method: 'POST', headers: { 'Authorization': 'Bearer hd_a1b2c3d4e5f67890a1b2c3d4e5f67890', 'Content-Type': 'application/json' }, body: JSON.stringify({ prompt: 'Check all pages for broken links and suggest fixes', scope: 'all', autoCommit: false }) });const { data } = await response.json();console.log(`Agent job ${data.id} created with status: ${data.status}`);
pythonimport requestsresponse = requests.post( "https://api.holydocs.com/api/v1/projects/proj_abc123/agent/jobs", headers={"Authorization": "Bearer hd_a1b2c3d4e5f67890a1b2c3d4e5f67890"}, json={ "prompt": "Check all pages for broken links and suggest fixes", "scope": "all", "autoCommit": False })data = response.json()["data"]print(f"Agent job {data['id']} created with status: {data['status']}")
Example Prompts
textCheck all internal and external links across the documentation. Report anybroken links, redirect chains, or links pointing to deprecated pages.Suggest replacements where possible.
textCompare the OpenAPI spec at /openapi.yaml with the API reference pages.Identify any endpoints, parameters, or response schemas that are documentedbut no longer exist in the spec, or exist in the spec but are not documented.
textReview all pages for consistent use of admonitions, code block language tags,and heading hierarchy. Flag any pages that skip heading levels or useinconsistent callout types for similar content.
textIdentify pages that reference deprecated features, outdated version numbers,or APIs that have been removed. Suggest updated content or mark pages forreview.
textReview the /api/authentication page specifically. Check that all code exampleswork, error codes are accurate, and the rate limit table matches the currentplan tiers.
List Agent Jobs
Retrieve a list of agent jobs for a project, ordered by most recent first.
bashGET /api/v1/projects/:projectId/agent/jobs
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
page | number | No | Page number (default: 1) |
perPage | number | No | Results per page (default: 20, max: 100) |
status | queued | running | completed | failed | No | Filter by job status |
Response
json{ "data": [ { "id": "job_abc123", "status": "completed", "prompt": "Check all pages for broken links and suggest fixes", "scope": "all", "suggestionsCount": 7, "approvedCount": 5, "rejectedCount": 1, "pendingCount": 1, "tokensUsed": 45000, "duration": 120, "createdAt": "2026-04-11T10:00:00Z", "completedAt": "2026-04-11T10:02:00Z" }, { "id": "job_def456", "status": "running", "prompt": "Review API reference for OpenAPI drift", "scope": "section", "scopePath": "/api", "suggestionsCount": 3, "approvedCount": 0, "rejectedCount": 0, "pendingCount": 3, "tokensUsed": 28000, "duration": null, "createdAt": "2026-04-11T10:05:00Z", "completedAt": null } ], "meta": { "total": 24, "page": 1, "perPage": 20, "totalPages": 2 }}
Get Job Details
Retrieve detailed information about a specific job, including all suggestions.
bashGET /api/v1/projects/:projectId/agent/jobs/:jobId
Response
json{ "data": { "id": "job_abc123", "projectId": "proj_xyz", "status": "completed", "prompt": "Check all pages for broken links and suggest fixes", "scope": "all", "autoCommit": false, "tokensUsed": 45000, "duration": 120, "createdAt": "2026-04-11T10:00:00Z", "completedAt": "2026-04-11T10:02:00Z", "toolCalls": [ { "tool": "list_pages", "duration": 0.8 }, { "tool": "read_page", "input": { "path": "/api/authentication" }, "duration": 0.3 }, { "tool": "check_links", "input": { "path": "/api/authentication" }, "duration": 2.1 }, { "tool": "read_page", "input": { "path": "/quickstart" }, "duration": 0.3 }, { "tool": "check_links", "input": { "path": "/quickstart" }, "duration": 1.8 }, { "tool": "suggest_edit", "input": { "path": "/quickstart", "description": "Fix broken link to old migration guide" }, "duration": 0.1 } ], "suggestions": [ { "id": "sug_001", "status": "pending", "pagePath": "/quickstart", "type": "edit", "title": "Fix broken link to migration guide", "description": "The link to `/migration` returns 404. The page has moved to `/cli/migrate`.", "diff": "- See the [Migration Guide](/migration) for upgrading.\n+ See the [Migration Guide](/cli/migrate) for upgrading.", "createdAt": "2026-04-11T10:01:45Z" }, { "id": "sug_002", "status": "approved", "pagePath": "/api/authentication", "type": "edit", "title": "Update rate limit values", "description": "The Business plan rate limit is listed as 2,000/min but should be 3,000/min.", "diff": "- | Business | 2,000 |\n+ | Business | 3,000 |", "approvedAt": "2026-04-11T10:10:00Z", "createdAt": "2026-04-11T10:01:30Z" } ] }}
Agent Tools
The agent has access to seven specialized tools. It selects and chains these tools autonomously based on the prompt you provide.
Read the full content of a documentation page.
Input: { "path": "/api/authentication" }
Returns: Page title, full MDX content, frontmatter metadata, last modified date.
Use case: The agent reads pages to understand their content before suggesting edits or checking for issues.
Search the documentation using hybrid keyword + semantic search.
Input: { "query": "rate limiting configuration", "limit": 10 }
Returns: Matching pages with relevance scores and snippets.
Use case: Find pages related to a topic when the agent needs to locate content without knowing exact paths.
List all pages in the documentation with their navigation structure.
Input: {}
Returns: Full navigation tree with page paths, titles, and sections.
Use case: Understand the documentation structure, find all pages in a section, or identify orphaned pages.
Validate all internal and external links on a page.
Input: { "path": "/quickstart" }
Returns: List of links with their status (valid, broken, redirect), HTTP status codes, and redirect targets.
Use case: Audit link health across the documentation. Identifies 404s, redirect chains, and links to deprecated pages.
Compare documented API endpoints against the OpenAPI specification.
Input: { "specPath": "/openapi.yaml" }
Returns: List of drift items: endpoints in the spec but not documented, documented endpoints not in the spec, parameter mismatches, and response schema differences.
Use case: Ensure API reference pages stay synchronized with the actual API specification after backend changes.
Create a content edit suggestion for a specific page.
Input:
json{ "path": "/quickstart", "title": "Fix broken link to migration guide", "description": "The link to /migration returns 404. The page has moved to /cli/migrate.", "oldContent": "See the [Migration Guide](/migration) for upgrading.", "newContent": "See the [Migration Guide](/cli/migrate) for upgrading."}
Returns: Suggestion ID and diff preview.
Use case: Propose specific text changes. Suggestions enter a pending state for human review unless autoCommit is enabled.
Directly commit a fix to the Git repository (only available when autoCommit: true).
Input:
json{ "path": "/quickstart", "content": "...full updated page content...", "commitMessage": "fix: update broken link to migration guide"}
Returns: Commit SHA, branch name, and deployment status.
Use case: Automatically apply low-risk fixes like broken link corrections or typo fixes without human review.
The commit_fix tool is only available when the job is created with autoCommit: true. Even with auto-commit enabled, the agent applies guardrails: it will not delete pages, modify navigation structure, or make changes affecting more than 20% of a page's content without creating a suggestion for review instead.
Approve Suggestion
Approve a pending suggestion. If the project has a connected Git repository, the approved edit is committed to a branch and a pull request is created.
bashPOST /api/v1/projects/:projectId/agent/suggestions/:id/approve
Path Parameters
| Parameter | Type | Description |
|---|---|---|
projectId | string | Project ID |
id | string | Suggestion ID |
Request Body
json{ "commitMessage": "fix: update broken link to migration guide", "branch": "agent/fix-broken-links"}
| Field | Type | Required | Description |
|---|---|---|---|
commitMessage | string | No | Custom commit message (auto-generated if omitted) |
branch | string | No | Target branch (default: agent/<job-id>) |
Response
json{ "data": { "id": "sug_001", "status": "approved", "commitSha": "a1b2c3d4", "branch": "agent/fix-broken-links", "pullRequestUrl": "https://github.com/myorg/docs/pull/42", "approvedAt": "2026-04-11T10:15:00Z" }}
Reject Suggestion
Reject a pending suggestion with an optional reason.
bashPOST /api/v1/projects/:projectId/agent/suggestions/:id/reject
Request Body
json{ "reason": "The current link is intentional — it redirects to the new page."}
| Field | Type | Required | Description |
|---|---|---|---|
reason | string | No | Explanation for the rejection (useful for agent learning) |
Response
json{ "data": { "id": "sug_001", "status": "rejected", "reason": "The current link is intentional — it redirects to the new page.", "rejectedAt": "2026-04-11T10:15:00Z" }}
Job Statuses
| Status | Description |
|---|---|
queued | Job is waiting in the agent queue |
running | Agent is actively processing the job |
completed | Job finished, all suggestions generated |
failed | Job encountered an unrecoverable error |
cancelled | Job was manually cancelled |
Agent Limits by Plan
| Plan | Concurrent Jobs | Monthly Jobs | Max Pages per Job |
|---|---|---|---|
| Free | 1 | 5 | 10 |
| Starter | 1 | 20 | 50 |
| Pro | 2 | 100 | 200 |
| Business | 5 | 500 | Unlimited |
| Enterprise | 10 | Unlimited | Unlimited |
Agent jobs on the Free plan are limited to 10 pages per job and 5 jobs per month. Upgrade to Pro or above for production-scale documentation maintenance.
Webhook Events
Subscribe to agent events via outbound webhooks:
| Event | Payload |
|---|---|
agent.job.completed | { jobId, suggestionsCount, status } |
agent.job.failed | { jobId, error } |
Error Codes
| Code | Status | Description |
|---|---|---|
NOT_FOUND | 404 | Project, job, or suggestion not found |
VALIDATION_ERROR | 400 | Invalid request body (empty prompt, invalid scope) |
AUTH_ERROR | 401 | Missing or invalid authentication |
FORBIDDEN | 403 | API key lacks agent:write scope |
LIMIT_EXCEEDED | 429 | Concurrent job limit or monthly job limit exceeded |
CONFLICT | 409 | Suggestion has already been approved or rejected |
GIT_ERROR | 502 | Failed to commit to Git repository (check repo connection) |