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.

bash
POST /api/v1/projects/:projectId/agent/jobs

bash
curl -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"}'

Path Parameters

ParameterTypeDescription
projectIdstringProject 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}
FieldTypeRequiredDescription
promptstringYesNatural language instruction for the agent (1-5000 characters)
scopeall | section | pageNoScope of the job (default: all)
scopePathstringNoWhen scope is section or page, the path to target (e.g., /api or /api/authentication)
autoCommitbooleanNoAutomatically commit approved suggestions (default: false)
prioritynormal | highNoJob 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" }}
bash
curl -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 }'

Example Prompts

text
Compare 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.
text
Review 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.
text
Identify pages that reference deprecated features, outdated version numbers,or APIs that have been removed. Suggest updated content or mark pages forreview.
text
Review 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.

bash
GET /api/v1/projects/:projectId/agent/jobs

Query Parameters

ParameterTypeRequiredDescription
pagenumberNoPage number (default: 1)
perPagenumberNoResults per page (default: 20, max: 100)
statusqueued | running | completed | failedNoFilter 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.

bash
GET /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.

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.

bash
POST /api/v1/projects/:projectId/agent/suggestions/:id/approve

Path Parameters

ParameterTypeDescription
projectIdstringProject ID
idstringSuggestion ID

Request Body

json
{ "commitMessage": "fix: update broken link to migration guide", "branch": "agent/fix-broken-links"}
FieldTypeRequiredDescription
commitMessagestringNoCustom commit message (auto-generated if omitted)
branchstringNoTarget 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.

bash
POST /api/v1/projects/:projectId/agent/suggestions/:id/reject

Request Body

json
{ "reason": "The current link is intentional — it redirects to the new page."}
FieldTypeRequiredDescription
reasonstringNoExplanation 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

StatusDescription
queuedJob is waiting in the agent queue
runningAgent is actively processing the job
completedJob finished, all suggestions generated
failedJob encountered an unrecoverable error
cancelledJob was manually cancelled

Agent Limits by Plan

PlanConcurrent JobsMonthly JobsMax Pages per Job
Free1510
Starter12050
Pro2100200
Business5500Unlimited
Enterprise10UnlimitedUnlimited

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:

EventPayload
agent.job.completed{ jobId, suggestionsCount, status }
agent.job.failed{ jobId, error }

Error Codes

CodeStatusDescription
NOT_FOUND404Project, job, or suggestion not found
VALIDATION_ERROR400Invalid request body (empty prompt, invalid scope)
AUTH_ERROR401Missing or invalid authentication
FORBIDDEN403API key lacks agent:write scope
LIMIT_EXCEEDED429Concurrent job limit or monthly job limit exceeded
CONFLICT409Suggestion has already been approved or rejected
GIT_ERROR502Failed to commit to Git repository (check repo connection)
Ask a question... ⌘I