> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/mariadb-cloud/cloud-data-handling/backup-and-restore/backup-examples/snapshot-backup-examples.md).

# Snapshot Backup Examples

## Authentication

Go to the MariaDB Cloud [API Key management page](https://app.skysql.com/user-profile/api-keys) and generate an API key. Export the value from the token field to an environment variable `$API_KEYexport API_KEY='... key data ...'`

Use it on subsequent request, e.g: `bash curl --request`&#x20;

```
GET 'https://api.skysql.com/skybackup/v1/backups/schedules' \
    --header "X-API-Key: ${API_KEY}"
```

## Snapshot Backup Scheduling

### **One-Time Snapshot Example**

#### Example: Creating a One-time Snapshot Backup

To create a one-time snapshot backup using the SkySQL API, use the following `curl` command:

```bash
curl --location 'https://api.skysql.com/skybackup/v1/backups/schedules' \
     --header 'Content-Type: application/json' \
     --header 'X-API-Key: $API_KEY' \
     --data '{
         "backup_type": "snapshot",
         "schedule": "once",
         "service_id": "$SERVICE_ID"
     }'
```

* **backup\_type**: Specifies the type of backup. In this case, it is set to "snapshot".
* **schedule**: Indicates the backup schedule. Here, it is set to "once" for a one-time execution.
* **service\_id**: The unique identifier for the service you want to back up.

Ensure to replace `$API_KEY` and `$SERVICE_ID` with your actual API key and service ID values.

* API\_KEY : SKYSQL API KEY, see [MariaDB Cloud API Keys](https://app.skysql.com/user-profile/api-keys/)
* SERVICE\_ID : MariaDB Cloud service identifier, format dbtxxxxxx. You can fetch the service ID from the Fully qualified domain name(FQDN) of your service. E.g: in dbpgf17106534.sysp0000.db2.skysql.com, 'dbpgf17106534' is the service ID.You will find the FQDN in the [Connect window](https://app.skysql.com/dashboard)

### **Cron Snapshot Example**

```bash
curl --location 'https://api.skysql.com/skybackup/v1/backups/schedules' \
     --header 'Content-Type: application/json' \
     --header 'X-API-Key: $API_KEY' \
     --data '{
        "backup_type": "snapshot",
        "schedule": "0 3 * * *",
        "service_id": "$SERVICE_ID"
    }'
```

* API\_KEY : SKYSQL API KEY, see [MariaDB Cloud API Keys](https://app.skysql.com/user-profile/api-keys/)
* SCHEDULE : Cron schedule, see [Cron](https://en.wikipedia.org/wiki/Cron)
* SERVICE\_ID : MariaDB Cloud service identifier, format dbxxxxxx

{% hint style="info" %}
Backup status can be fetched using '<https://api.skysql.com/skybackup/v1/backups>'. See the 'Backup Status' section for an example.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/mariadb-cloud/cloud-data-handling/backup-and-restore/backup-examples/snapshot-backup-examples.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
