cURL
curl --request GET \
--url https://api.camposcloud.com/v1/databases/{databaseId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.camposcloud.com/v1/databases/{databaseId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.camposcloud.com/v1/databases/{databaseId}', 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.camposcloud.com/v1/databases/{databaseId}",
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.camposcloud.com/v1/databases/{databaseId}"
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.camposcloud.com/v1/databases/{databaseId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.camposcloud.com/v1/databases/{databaseId}")
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": "64b7f0c2a1b2c3d4e5f60718",
"name": "main-db",
"type": "postgresql",
"status": "active",
"restartRequired": false,
"userId": "64b7f0c2a1b2c3d4e5f60700",
"teamId": null,
"workerNodeId": {
"_id": "64b7f0c2a1b2c3d4e5f60799",
"nodeName": "node-1"
},
"allocatedMemoryMB": 512,
"allocatedVCpu": 1,
"diskLimitBytes": 10737418240,
"diskUsageBytes": 52428800,
"containerImage": "postgres:trixie",
"connection": {
"host": "db.camposcloud.com",
"port": 30001,
"username": "app_user",
"database": "app_db"
},
"currentResourceMetrics": {
"timestamp": "2025-01-01T12:00:00.000Z",
"online": true,
"uptime": 35980,
"startedAt": "2025-01-01T12:00:00.000Z",
"cpuUsagePercent": 0.42,
"memoryUsageBytes": 43671552,
"memoryLimitBytes": 268435456,
"networkRxBytes": 228961,
"networkTxBytes": 228190
},
"createdAt": "2025-01-01T12:00:00.000Z",
"updatedAt": "2025-01-01T12:00:00.000Z"
}{
"error": "Invalid 'id'."
}{
"error": "Invalid developer token"
}{
"error": "Database instance not found."
}{
"error": "Too many requests, please try again later"
}{
"error": "Internal server error. Please try again later."
}Databases
/v1/databases/{databaseId}
This endpoint retrieves a database by its ID.
GET
/
v1
/
databases
/
{databaseId}
cURL
curl --request GET \
--url https://api.camposcloud.com/v1/databases/{databaseId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.camposcloud.com/v1/databases/{databaseId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.camposcloud.com/v1/databases/{databaseId}', 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.camposcloud.com/v1/databases/{databaseId}",
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.camposcloud.com/v1/databases/{databaseId}"
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.camposcloud.com/v1/databases/{databaseId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.camposcloud.com/v1/databases/{databaseId}")
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": "64b7f0c2a1b2c3d4e5f60718",
"name": "main-db",
"type": "postgresql",
"status": "active",
"restartRequired": false,
"userId": "64b7f0c2a1b2c3d4e5f60700",
"teamId": null,
"workerNodeId": {
"_id": "64b7f0c2a1b2c3d4e5f60799",
"nodeName": "node-1"
},
"allocatedMemoryMB": 512,
"allocatedVCpu": 1,
"diskLimitBytes": 10737418240,
"diskUsageBytes": 52428800,
"containerImage": "postgres:trixie",
"connection": {
"host": "db.camposcloud.com",
"port": 30001,
"username": "app_user",
"database": "app_db"
},
"currentResourceMetrics": {
"timestamp": "2025-01-01T12:00:00.000Z",
"online": true,
"uptime": 35980,
"startedAt": "2025-01-01T12:00:00.000Z",
"cpuUsagePercent": 0.42,
"memoryUsageBytes": 43671552,
"memoryLimitBytes": 268435456,
"networkRxBytes": 228961,
"networkTxBytes": 228190
},
"createdAt": "2025-01-01T12:00:00.000Z",
"updatedAt": "2025-01-01T12:00:00.000Z"
}{
"error": "Invalid 'id'."
}{
"error": "Invalid developer token"
}{
"error": "Database instance not found."
}{
"error": "Too many requests, please try again later"
}{
"error": "Internal server error. Please try again later."
}Only the account that owns the database can use this endpoint. Other team members receive
404 and should use GET /v1/databases?team={teamId}.The password of a database is never returned by the API. Store it when you create the database or change its password.
Authorizations
Response
The database.