API Reference: Core Documentation Managing Sections and Versions via API

Manage your documentation's lifecycle programmatically using the GitDocAI API. This guide covers how to create and manage versions, organize content into sections, and trigger automated publishing workflows.

API Authentication

All endpoints described on this page require standard API authentication. Ensure you include a valid Bearer token in the Authorization header of your requests.

Documentation Lifecycle

The typical flow for managing documentation via the API involves creating a version, populating it with sections, and then publishing the changes.

flowchart TD
    A["Create Version"] --> B["Create Sections"]
    B --> C["Reorder Sections"]
    C --> D["Trigger Publish Job"]
    D --> E["Monitor Publish Status"]

Managing Versions

Versions allow you to maintain multiple iterations of your documentation (e.g., v1.0, v2.0, beta). All version endpoints are scoped to an organization and a specific documentation project.

Core Version Endpoints

ActionMethodEndpoint
List versionsGET/v1/documentation/{organization_id}/{documentation_id}/version
Create versionPOST/v1/documentation/{organization_id}/{documentation_id}/version
Get versionGET/v1/documentation/{organization_id}/{documentation_id}/version/{version_id}
Update versionPUT/v1/documentation/{organization_id}/{documentation_id}/version/{version_id}
Delete versionDELETE/v1/documentation/{organization_id}/{documentation_id}/version/{version_id}

Deleting a version is a destructive action that will also remove all sections and content associated with that version.

Version States

You can programmatically control the lifecycle state of a version using dedicated endpoints. This is useful for automating release pipelines.

State ActionMethodEndpoint
Set DefaultPOST.../version/{version_id}/set-default
Set LatestPOST.../version/{version_id}/set-latest
Set DeprecatedPOST.../version/{version_id}/set-deprecated
What is the difference between Default and Latest?

The Default version is the one automatically shown to users when they visit the root URL of your documentation. The Latest version typically represents the most recent stable release, which might be different from the default if you are soft-launching a new version.

What happens when a version is deprecated?

Marking a version as Deprecated flags it in the UI, warning readers that the content is no longer actively maintained. It does not delete the content or remove it from the web.

Managing Sections

Sections act as the organizational folders or categories within a specific documentation version.

Core Section Endpoints

ActionMethodEndpoint
List sectionsGET/v1/documentation/{organization_id}/{documentation_id}/version/{version_id}/section
Create sectionPOST/v1/documentation/{organization_id}/{documentation_id}/version/{version_id}/section
Get sectionGET/v1/documentation/{organization_id}/{documentation_id}/version/{version_id}/section/{section_id}
Update sectionPUT/v1/documentation/{organization_id}/{documentation_id}/version/{version_id}/section/{section_id}
Delete sectionDELETE/v1/documentation/{organization_id}/{documentation_id}/version/{version_id}/section/{section_id}

Advanced Section Management

Beyond basic CRUD operations, the API provides endpoints for organizing and verifying your sections:

  • Reorder Sections (POST .../section/reorder): Update the display order of sections within the navigation menu.

  • Get Source Summary (GET .../section/{section_id}/source): Retrieve a source-of-truth summary for a specific section, which is helpful for auditing content synchronization.

When creating a new section, you can optionally pass a parent_id in the request body to nest the section inside an existing folder, creating a hierarchical documentation structure.

Managing Assets and Files

You can also manage file resources and import assets directly via the API to support your documentation content.

ActionMethodEndpoint
Import asset from URLPOST/v1/documentation/{organization_id}/{documentation_id}/asset/import
Request file upload URLPOST/v1/documentation/{organization_id}/{documentation_id}/file-resources/upload-url

Accessing Changelogs

If your documentation includes automated changelogs, you can retrieve them using the tasks endpoints.

ActionMethodEndpoint
Get all changelogsGET/tasks/changelogs
Get changelog by versionGET/tasks/changelogs/version/{version_id}

Publishing Workflows

Once your versions and sections are configured, you need to publish the documentation to make the changes live. Publishing is handled asynchronously via a job queue.

  1. 1

    Start a publish job

    Trigger a new build and publish process for your documentation.

    curl -X POST https://api.gitdocai.com/documentations/{documentation_id}/publish 
      -H "Authorization: Bearer $YOUR_API_TOKEN"
  2. 2

    Monitor job status

    Because publishing happens asynchronously, use the status endpoint to poll for completion.

    curl https://api.gitdocai.com/documentations/{documentation_id}/publish/status 
      -H "Authorization: Bearer $YOUR_API_TOKEN"
  3. 3

    Review publish history

    You can audit past publish jobs or retrieve the details of the most recent successful deployment.

    • Get publish history: GET /documentations/{documentation_id}/publish/history

    • Get latest publish: GET /documentations/{documentation_id}/publish/latest

If you need to search through published documentation programmatically, you can use the POST /documentations/{organization_id}/{documentation_id}/search endpoint to query your content index.