A well-organized documentation site helps your users find exactly what they need without frustration. By reordering your documentation sections, you can create a logical, easy-to-follow navigation flow that guides readers from basic concepts to advanced tutorials.
Because documentation structures often vary between different releases, section ordering is managed on a per-version basis.
flowchart TD
Doc["Documentation Project"] --> V1["Version 1.0 (Latest)"]
subgraph Current Order
V1 --> S1["1. Introduction"]
V1 --> S2["2. Quickstart"]
V1 --> S3["3. API Reference"]
end
S3 -. "Move up" .-> S2Reordering sections via the API
You can programmatically adjust the order of your sections using the GitDocAI API. This is especially useful if you are syncing your documentation structure from an external CMS or a local configuration file.
Prerequisites
Before you can reorder sections, you will need:
Your
organization_idanddocumentation_id.The specific
version_idyou want to modify.The IDs of the sections you want to reorder.
If you aren't sure what your section IDs are, you can retrieve them by making a GET request to the /v1/documentation/{organization_id}/{documentation_id}/version/{version_id}/section endpoint.
Step-by-step guide
- 1
Prepare your new order
Determine the exact sequence you want your sections to appear in. You will need to provide an array of section IDs in your desired top-to-bottom order.
- 2
Send the reorder request
Make a
POSTrequest to the reorder endpoint, passing your organization, documentation, and version IDs in the URL path.curl -X POST "https://api.gitdocai.com/v1/documentation/{org_id}/{doc_id}/version/{version_id}/section/reorder" -H "Authorization: Bearer YOUR_API_TOKEN" -H "Content-Type: application/json" -d '{ "section_ids": [ "8e105a32-33f6-45c1-9a39-80b795fa551b", "4a79f9c9-4a13-431a-b894-ab740032f9bd", "a5bee53f-a233-4b71-9c7f-48c473ffd9be" ] }' - 3
Verify the changes
Refresh your documentation frontend or fetch the sections again via the API to confirm that the navigation menu reflects your new order.
Reordering sections updates the live navigation immediately for any published version. If you are making major structural changes, consider creating a new draft version first, reordering the sections there, and then setting that version as the default.
Managing your sections
Reordering is just one part of keeping your documentation structure clean. You can fully manage your sections using the following endpoints:
| Action | Method | Endpoint | Description |
|---|---|---|---|
| List Sections | GET | /.../version/{version_id}/section | Retrieves all sections for a specific version. |
| Create Section | POST | /.../version/{version_id}/section | Adds a new section to the version. |
| Get Section | GET | /.../version/{version_id}/section/{section_id} | Retrieves details for a specific section. |
| Update Section | PUT | /.../version/{version_id}/section/{section_id} | Modifies a section's title, slug, or metadata. |
| Delete Section | DELETE | /.../version/{version_id}/section/{section_id} | Permanently removes a section and its contents. |
| Get Section Source | GET | /.../version/{version_id}/section/{section_id}/source | Retrieves a section's source-of-truth summary. |
Does reordering sections affect my content URLs?
No. Reordering sections only changes their visual sequence in the navigation menu. The underlying slugs and URLs for the sections and their pages remain unchanged, so you don't have to worry about breaking existing links.
Can I reorder sections across different versions?
Section orders are strictly tied to a specific version_id. If you want to apply the same order to multiple versions, you will need to send a separate reorder API request for each version.