Protect your hard work by creating point-in-time snapshots of your documentation. Using the backup API, you can easily save your current documentation state to a repository, list your available backups, and restore previous versions if something goes wrong.
Whether you want to automate daily backups or just save a quick snapshot before a major rewrite, these endpoints give you full control over your documentation's history.
sequenceDiagram
participant User
participant API as GitDocAI API
participant Repo as Backup Repository
User->>API: 1. Set Backup Repo (PUT)
API-->>User: Success
User->>API: 2. Create Backup (POST)
API->>Repo: Save Snapshot
API-->>User: Backup ID returned
User->>API: 3. Restore Backup (POST)
API->>Repo: Fetch Snapshot
API-->>User: Documentation RestoredPrerequisites
Before you begin, make sure you have:
A valid API key passed in your request headers.
Your
organization_id.The
documentation_idyou want to back up.
We highly recommend setting up an automated script (like a cron job or GitHub Action) to trigger the backup endpoint regularly. This ensures you always have a recent snapshot available.
Managing your snapshots
Follow these steps to configure your backup environment, generate new snapshots, and restore them when needed.
- 1
Configure your backup repository
Before creating a snapshot, you need to tell the system where to store it. Use the
PUTmethod to define your backup repository settings.curl -X PUT "https://api.gitdocai.com/v1/documentation/{organization_id}/{documentation_id}/backup/repository" -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d '{"repository_url": "your-repo-url"}'Note: You can always verify your current configuration by making a
GETrequest to the same/backup/repositoryendpoint. - 2
Create a new snapshot
Once your repository is configured, you can generate a backup at any time. This captures the exact state of your documentation at the moment the request is made.
curl -X POST "https://api.gitdocai.com/v1/documentation/{organization_id}/{documentation_id}/backup" -H "Authorization: Bearer YOUR_API_KEY" - 3
List available backups
Need to find a specific snapshot? Retrieve a complete list of all backups associated with your documentation project.
curl -X GET "https://api.gitdocai.com/v1/documentation/{organization_id}/{documentation_id}/backup" -H "Authorization: Bearer YOUR_API_KEY"This will return a list of your snapshots, including their unique IDs and creation timestamps.
- 4
Restore from a snapshot
If you need to roll back to a previous version, use the restore endpoint. You will typically need to provide the specific backup ID you retrieved in the previous step.
curl -X POST "https://api.gitdocai.com/v1/documentation/{organization_id}/{documentation_id}/backup/restore" -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d '{"backup_id": "your-target-backup-id"}'
Restoring a backup will overwrite your current live documentation state. Make sure you actually want to revert your changes, or consider taking a fresh snapshot of your current state before initiating a restore.
API Endpoint Quick Reference
Here is a quick summary of the endpoints available for managing documentation snapshots:
| Action | Method | Endpoint Path |
|---|---|---|
| List Backups | GET | /v1/documentation/{org_id}/{doc_id}/backup |
| Create Backup | POST | /v1/documentation/{org_id}/{doc_id}/backup |
| Get Repository | GET | /v1/documentation/{org_id}/{doc_id}/backup/repository |
| Set Repository | PUT | /v1/documentation/{org_id}/{doc_id}/backup/repository |
| Restore Backup | POST | /v1/documentation/{org_id}/{doc_id}/backup/restore |
Additional Documentation Endpoints
While managing your documentation, you may also need to interact with individual assets or utilize AI features. Here are the endpoints available for those tasks:
Asset Management
| Action | Method | Endpoint Path |
|---|---|---|
| List Assets | GET | /v1/documentation/{organization_id}/{documentation_id}/asset |
| Upload Asset | POST | /v1/documentation/{organization_id}/{documentation_id}/asset |
| Get Asset by ID | GET | /v1/documentation/{organization_id}/{documentation_id}/asset/{asset_id} |
| Update Asset Metadata | PUT | /v1/documentation/{organization_id}/{documentation_id}/asset/{asset_id} |
| Delete Asset | DELETE | /v1/documentation/{organization_id}/{documentation_id}/asset/{asset_id} |
| Serve Asset File | GET | /v1/documentation/{organization_id}/{documentation_id}/asset/{asset_id}/file |
AI Features
| Action | Method | Endpoint Path |
|---|---|---|
| Generate Image | POST | /documentation/{organization_id}/{documentation_id}/ai/generate-image |