Skip to main content
POST
/
databases
/
clusters
/
{database}
/
snapshots
Create a database snapshot
curl --request POST \
  --url https://cloud.laravel.com/api/databases/clusters/{database}/snapshots \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "description": "<string>"
}
'
import requests

url = "https://cloud.laravel.com/api/databases/clusters/{database}/snapshots"

payload = {
"name": "<string>",
"description": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', description: '<string>'})
};

fetch('https://cloud.laravel.com/api/databases/clusters/{database}/snapshots', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://cloud.laravel.com/api/databases/clusters/{database}/snapshots",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://cloud.laravel.com/api/databases/clusters/{database}/snapshots"

payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://cloud.laravel.com/api/databases/clusters/{database}/snapshots")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://cloud.laravel.com/api/databases/clusters/{database}/snapshots")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "data": {
    "id": "<string>",
    "type": "database_snapshots",
    "links": {
      "self": {
        "href": "<string>",
        "rel": "<string>",
        "describedby": "<string>",
        "title": "<string>",
        "type": "<string>",
        "hreflang": "<string>",
        "meta": {}
      }
    },
    "attributes": {
      "name": "<string>",
      "description": "<string>",
      "storage_bytes": 123,
      "pitr_enabled": true,
      "pitr_ends_at": "2023-11-07T05:31:56Z",
      "completed_at": "2023-11-07T05:31:56Z",
      "created_at": "2023-11-07T05:31:56Z"
    },
    "relationships": {
      "database": {
        "data": {
          "type": "databases",
          "id": "<string>"
        }
      }
    }
  },
  "included": [
    {
      "id": "<string>",
      "type": "databases",
      "attributes": {
        "name": "<string>",
        "created_at": "2023-11-07T05:31:56Z",
        "config": {
          "suspend_seconds": 123,
          "retention_days": 123
        },
        "connection": {
          "hostname": "<string>",
          "username": "<string>",
          "password": "<string>"
        }
      },
      "relationships": {
        "schemas": {
          "data": [
            {
              "type": "databaseSchemas",
              "id": "<string>"
            }
          ]
        },
        "databases": {
          "data": [
            {
              "type": "databaseSchemas",
              "id": "<string>"
            }
          ]
        }
      }
    }
  ]
}
{
"message": "<string>"
}
{
"message": "<string>",
"errors": {}
}

Authorizations

Authorization
string
header
required

The Bearer Token generated on the Cloud UI.

Path Parameters

database
string | null
required

The database identifier

Body

application/json
name
string
required
Required string length: 1 - 100
description
string | null
Required string length: 3 - 40

Response

DatabaseSnapshotResource

data
DatabaseSnapshotResource · object
required
included
DatabaseResource · object[]