Skip to main content
GET
/
organizations
/
{organization}
/
databases
/
{database}
/
branches
/
{branch}
Get a branch
curl --request GET \
  --url https://api.planetscale.com/v1/organizations/{organization}/databases/{database}/branches/{branch} \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://api.planetscale.com/v1/organizations/{organization}/databases/{database}/branches/{branch}"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.planetscale.com/v1/organizations/{organization}/databases/{database}/branches/{branch}', 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://api.planetscale.com/v1/organizations/{organization}/databases/{database}/branches/{branch}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

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

curl_close($curl);

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

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

func main() {

url := "https://api.planetscale.com/v1/organizations/{organization}/databases/{database}/branches/{branch}"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

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

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

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.planetscale.com/v1/organizations/{organization}/databases/{database}/branches/{branch}")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.planetscale.com/v1/organizations/{organization}/databases/{database}/branches/{branch}")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
{
  "id": "<string>",
  "name": "<string>",
  "created_at": "<string>",
  "updated_at": "<string>",
  "deleted_at": "<string>",
  "restore_checklist_completed_at": "<string>",
  "schema_last_updated_at": "<string>",
  "mysql_address": "<string>",
  "mysql_edge_address": "<string>",
  "direct_vtgate": true,
  "vtgate_size": "<string>",
  "vtgate_count": 123,
  "cluster_name": "<string>",
  "cluster_iops": 123,
  "ready": true,
  "schema_ready": true,
  "metal": true,
  "production": true,
  "safe_migrations": true,
  "sharded": true,
  "shard_count": 123,
  "keyspace_count": 123,
  "stale_schema": true,
  "actor": {
    "id": "<string>",
    "display_name": "<string>",
    "avatar_url": "<string>"
  },
  "restored_from_branch": {
    "id": "<string>",
    "name": "<string>",
    "created_at": "<string>",
    "updated_at": "<string>",
    "deleted_at": "<string>"
  },
  "private_edge_connectivity": true,
  "has_replicas": true,
  "has_read_only_replicas": true,
  "html_url": "<string>",
  "url": "<string>",
  "region": {
    "id": "<string>",
    "provider": "<string>",
    "enabled": true,
    "public_ip_addresses": [
      "<string>"
    ],
    "display_name": "<string>",
    "location": "<string>",
    "slug": "<string>",
    "current_default": true,
    "mysql_supported": true,
    "postgresql_supported": true
  },
  "parent_branch": "<string>",
  "vtgate_options": {}
}

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Path Parameters

organization
string
required

Organization name slug from list_organizations. Example: acme.

database
string
required

Database name slug from list_databases. Example: app-db.

branch
string
required

Branch name from list_branches. Example: main.

Response

Returns information about a branch

id
string
required

The ID of the branch

name
string
required

The name of the branch

created_at
string
required

When the branch was created

updated_at
string
required

When the branch was last updated

deleted_at
string | null
required

When the branch was deleted

restore_checklist_completed_at
string | null
required

When a user last marked a backup restore checklist as completed

schema_last_updated_at
string | null
required

When the schema for the branch was last updated

kind
enum<string>
required

The kind of branch

Available options:
mysql,
postgresql
mysql_address
string
required

The MySQL address for the branch

mysql_edge_address
string
required

The address of the MySQL provider for the branch

state
enum<string>
required

The current state of the branch

Available options:
pending,
sleep_in_progress,
sleeping,
awakening,
ready
direct_vtgate
boolean
required

True if the branch allows passwords to connect directly to a vtgate, bypassing load balancers

vtgate_size
string
required

The size of the vtgate cluster for the branch

vtgate_count
integer
required

The number of vtgate instances in the branch

cluster_name
string
required

The SKU representing the branch's cluster size

cluster_iops
integer | null
required

IOPS for the cluster

ready
boolean
required

Whether or not the branch is ready to serve queries

schema_ready
boolean
required

Whether or not the schema is ready for queries

metal
boolean
required

Whether or not this is a metal database

production
boolean
required

Whether or not the branch is a production branch

safe_migrations
boolean
required

Whether or not the branch has safe migrations enabled

sharded
boolean
required

Whether or not the branch is sharded

shard_count
integer
required

The number of shards in the branch

keyspace_count
integer
required

The number of keyspaces in the branch

stale_schema
boolean
required

Whether or not the branch has a stale schema

actor
object | null
required
restored_from_branch
object | null
required
private_edge_connectivity
boolean
required

True if private connections are enabled

has_replicas
boolean
required

True if the branch has replica servers

has_read_only_replicas
boolean
required

True if the branch has read-only replica servers

html_url
string
required

Planetscale app URL for the branch

url
string
required

Planetscale API URL for the branch

region
object
required
parent_branch
string | null
required

The name of the parent branch from which the branch was created

vtgate_options
object
required

VTGate configuration options