Backups & Restorations Restoring Documentation States via API

Mistakes happen! Whether you accidentally deleted a crucial section or just want to revert to a previous version, you can use the API to manage backups and safely restore your documentation. This guide walks you through the complete backup and restoration lifecycle.


All endpoints in this guide require your organization_id, your documentation_id, and a valid API token passed in the Authorization header.

Backup and Restore Workflow

The process of securing and restoring your documentation follows a simple lifecycle: configuring a repository, taking snapshots, and restoring when needed.

sequenceDiagram
    participant User
    participant API
    User->>API: PUT /backup/repository (Configure)
    User->>API: POST /backup (Create snapshot)
    User->>API: GET /backup (List snapshots)
    API-->>User: Returns available backups
    User->>API: POST /backup/restore (Restore state)
    API-->>User: Documentation restored!

Step-by-Step Guide

Follow these steps to configure your repository, create a backup, and restore your documentation to a previous state.

  1. 1

    Configure your backup repository

    Before you can create or restore backups, ensure your documentation is linked to a backup repository. You can set this up using the PUT method.

    curl -X PUT "https://api.gitdocai.com/v1/documentation/{organization_id}/{documentation_id}/backup/repository" 
      -H "Authorization: Bearer YOUR_API_TOKEN" 
      -H "Content-Type: application/json" 
      -d '{"repository_url": "https://github.com/your-org/docs-backup"}'
  2. 2

    Create a backup snapshot

    Whenever you reach a stable state in your documentation, it is a good idea to trigger a manual backup.

    curl -X POST "https://api.gitdocai.com/v1/documentation/{organization_id}/{documentation_id}/backup" 
      -H "Authorization: Bearer YOUR_API_TOKEN"
  3. 3

    Find the backup you want to restore

    If you need to revert your documentation, first retrieve a list of all available backups to find the specific snapshot ID you want to restore.

    curl -X GET "https://api.gitdocai.com/v1/documentation/{organization_id}/{documentation_id}/backup" 
      -H "Authorization: Bearer YOUR_API_TOKEN"
  4. 4

    Restore your documentation

    Once you have your desired backup ID, use the restore endpoint to revert your documentation.

    curl -X POST "https://api.gitdocai.com/v1/documentation/{organization_id}/{documentation_id}/backup/restore" 
      -H "Authorization: Bearer YOUR_API_TOKEN" 
      -H "Content-Type: application/json" 
      -d '{"backup_id": "YOUR_BACKUP_ID"}'


    Restoring a backup will overwrite your current documentation state. Make sure to save any recent, unbacked-up changes before initiating a restore.

Endpoint Summary

For quick reference, here are all the API endpoints available for managing documentation backups:

ActionMethodEndpoint Path
List backupsGET/v1/documentation/{organization_id}/{documentation_id}/backup
Create backupPOST/v1/documentation/{organization_id}/{documentation_id}/backup
Get repositoryGET/v1/documentation/{organization_id}/{documentation_id}/backup/repository
Set repositoryPUT/v1/documentation/{organization_id}/{documentation_id}/backup/repository
Restore backupPOST/v1/documentation/{organization_id}/{documentation_id}/backup/restore

Frequently Asked Questions

Can I see which repository is currently configured?

Yes! You can check your current configuration at any time by making a GET request to the /v1/documentation/{organization_id}/{documentation_id}/backup/repository endpoint.

What happens to my live documentation during a restore?

The restoration process is designed to be seamless. Your live documentation will briefly enter a read-only state while the previous snapshot is applied, preventing any conflicting edits.

API Reference

Looking for detailed request and response schemas? Check out the full API Reference for the Backup endpoints.