Manage your entire documentation lifecycle programmatically using the GitDocAI API. Whether you are building a custom dashboard, automating imports, or syncing content from external sources, these endpoints allow you to create documentation projects and organize their internal hierarchies (pages and folders) exactly how you want them.
Understanding the Hierarchy
Before using the API, it helps to understand how GitDocAI structures documentation. Every piece of content lives within a strict hierarchy:
flowchart TD
Org["Organization"] --> Doc["Documentation Project"]
Doc --> Ver["Version"]
Ver --> Sec["Section"]
Sec --> Ent1["Doc Entry (Folder)"]
Sec --> Ent2["Doc Entry (Page)"]
Ent1 --> Ent3["Doc Entry (Sub-page)"]What is a Doc Entry? An "entry" is the core building block of your documentation. It can represent either a readable page or a folder used to group other pages together.
Managing Documentation Projects
A "Documentation Project" is the top-level container for your site. Use these endpoints to create, configure, and delete projects within your organization.
| Action | Method | Endpoint |
|---|---|---|
| Create | POST | /v1/documentation/{organization_id} |
| List all | GET | /v1/documentation/{organization_id}/list |
| Get details | GET | /v1/documentation/{organization_id}/{documentation_id} |
| Update details | PUT | /v1/documentation/{organization_id}/{documentation_id} |
| Update config | PUT | /v1/documentation/{organization_id}/{documentation_id}/config |
| Delete | DELETE | /v1/documentation/{organization_id}/{documentation_id} |
Initializing a New Project
When you first create a documentation project, it starts in a "pending" state. You must initialize it with content before it can be published or edited. GitDocAI provides several powerful initialization endpoints depending on your source material.
All initialization endpoints use the POST method and share the base path:/v1/documentation/{organization_id}/{documentation_id}
| Source Material | Endpoint Path | Description |
|---|---|---|
| Blank | /initialize-blank | Starts a fresh project with a default scaffold. |
| AI Prompt | /initialize-from-ai | Generates a complete structure based on a text prompt. |
| OpenAPI | /initialize-from-openapi | Builds API reference docs from a Swagger/OpenAPI spec. |
| GitHub | /initialize-from-repository | Imports markdown files directly from a linked repository. |
| Files | /initialize-from-file | Uploads and parses a local directory or ZIP file. |
| Website | /initialize-from-website | Crawls an existing website to migrate its content. |
| Template | /initialize-from-template | Uses a pre-configured GitDocAI template. |
Managing Entries (Pages & Folders)
Once your documentation is initialized, you can manipulate the individual pages and folders (entries) within a specific section.
All entry endpoints share this base path:/v1/documentation/{organization_id}/{documentation_id}/version/{version_id}/section/{section_id}/entry
Retrieving Content
| Action | Method | Path | Effect |
|---|---|---|---|
| List entries | GET | / | Returns a flat list of all entries in the section. |
| Get tree | GET | /tree | Returns entries nested in their folder hierarchy. |
| Get by ID | GET | /{entry_id} | Retrieves metadata and content for a specific entry. |
Use the /tree endpoint when you need to render a sidebar navigation menu. It automatically nests child pages under their respective parent folders, saving you from having to reconstruct the hierarchy on the client side.
Modifying Content
| Action | Method | Path | Effect |
|---|---|---|---|
| Create entry | POST | / | Creates a single new page or folder. |
| Batch create | POST | /batch | Creates multiple entries in a single request. |
| Update entry | PUT | /{entry_id} | Updates an entry's title, content, or metadata. |
| Delete entry | DELETE | /{entry_id} | Removes an entry (and its children, if it's a folder). |
Organizing the Hierarchy
| Action | Method | Path | Effect |
|---|---|---|---|
| Reorder | POST | /reorder | Updates the display order of entries within a folder. |
| Move | POST | /{entry_id}/move | Moves an entry to a different parent folder or section. |
Moving a parent folder automatically moves all of its child entries. Ensure you update any hardcoded links in your application that might point to the old paths.
Managing Documentation Backups
GitDocAI allows you to safeguard your projects by creating backups and restoring them when necessary. You can also configure a specific external repository to store these backups.
All backup endpoints share this base path:/v1/documentation/{organization_id}/{documentation_id}/backup
| Action | Method | Path | Effect |
|---|---|---|---|
| List backups | GET | / | Lists all available backups for the documentation project. |
| Create backup | POST | / | Makes a new backup of the documentation. |
| Get repository | GET | /repository | Retrieves the configured backup repository. |
| Set repository | PUT | /repository | Sets the repository used for storing backups. |
| Restore | POST | /restore | Restores the documentation from a previous backup. |
Example Workflow: Creating a New API Reference
Here is how you might combine these endpoints to programmatically generate a new set of API documentation:
- 1
Create the project container
Make a
POSTrequest to/v1/documentation/{organization_id}to create the empty documentation shell. Save the returneddocumentation_id. - 2
Initialize from OpenAPI
Make a
POSTrequest to/initialize-from-openapi, passing yourdocumentation_idand the URL to your Swagger file. GitDocAI will parse the spec and generate the initial pages. - 3
Add a custom welcome page
Make a
POSTrequest to the/entryendpoint to create a new "Welcome" page at the root of your new documentation section. - 4
Reorder the navigation
Make a
POSTrequest to/entry/reorderto ensure your new "Welcome" page appears at the very top of the sidebar, above the generated API routes.