curl --request POST \
--url https://app.miget.com/api/v1/services \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"project_id": "<string>",
"label": "<string>",
"resource_id": "<string>",
"miget_id": "<string>",
"region_code": "<string>",
"ram_size": 123,
"disk_size": 123,
"cpu_size": 123,
"size": "<string>",
"public_access": true,
"environment_variables": true,
"auto_sleep": true,
"external_host": "<string>",
"external_port": 123,
"replication_username": "<string>",
"replication_password": "<string>",
"ca_crt": "<string>",
"tls_crt": "<string>",
"tls_key": "<string>",
"s3_enabled": true,
"s3_endpoint": "<string>",
"s3_bucket": "<string>",
"s3_path": "<string>",
"s3_access_key": "<string>",
"s3_secret_key": "<string>",
"s3_server_name": "<string>",
"mount_point": "<string>"
}
'import requests
url = "https://app.miget.com/api/v1/services"
payload = {
"project_id": "<string>",
"label": "<string>",
"resource_id": "<string>",
"miget_id": "<string>",
"region_code": "<string>",
"ram_size": 123,
"disk_size": 123,
"cpu_size": 123,
"size": "<string>",
"public_access": True,
"environment_variables": True,
"auto_sleep": True,
"external_host": "<string>",
"external_port": 123,
"replication_username": "<string>",
"replication_password": "<string>",
"ca_crt": "<string>",
"tls_crt": "<string>",
"tls_key": "<string>",
"s3_enabled": True,
"s3_endpoint": "<string>",
"s3_bucket": "<string>",
"s3_path": "<string>",
"s3_access_key": "<string>",
"s3_secret_key": "<string>",
"s3_server_name": "<string>",
"mount_point": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
project_id: '<string>',
label: '<string>',
resource_id: '<string>',
miget_id: '<string>',
region_code: '<string>',
ram_size: 123,
disk_size: 123,
cpu_size: 123,
size: '<string>',
public_access: true,
environment_variables: true,
auto_sleep: true,
external_host: '<string>',
external_port: 123,
replication_username: '<string>',
replication_password: '<string>',
ca_crt: '<string>',
tls_crt: '<string>',
tls_key: '<string>',
s3_enabled: true,
s3_endpoint: '<string>',
s3_bucket: '<string>',
s3_path: '<string>',
s3_access_key: '<string>',
s3_secret_key: '<string>',
s3_server_name: '<string>',
mount_point: '<string>'
})
};
fetch('https://app.miget.com/api/v1/services', 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://app.miget.com/api/v1/services",
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([
'project_id' => '<string>',
'label' => '<string>',
'resource_id' => '<string>',
'miget_id' => '<string>',
'region_code' => '<string>',
'ram_size' => 123,
'disk_size' => 123,
'cpu_size' => 123,
'size' => '<string>',
'public_access' => true,
'environment_variables' => true,
'auto_sleep' => true,
'external_host' => '<string>',
'external_port' => 123,
'replication_username' => '<string>',
'replication_password' => '<string>',
'ca_crt' => '<string>',
'tls_crt' => '<string>',
'tls_key' => '<string>',
's3_enabled' => true,
's3_endpoint' => '<string>',
's3_bucket' => '<string>',
's3_path' => '<string>',
's3_access_key' => '<string>',
's3_secret_key' => '<string>',
's3_server_name' => '<string>',
'mount_point' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://app.miget.com/api/v1/services"
payload := strings.NewReader("{\n \"project_id\": \"<string>\",\n \"label\": \"<string>\",\n \"resource_id\": \"<string>\",\n \"miget_id\": \"<string>\",\n \"region_code\": \"<string>\",\n \"ram_size\": 123,\n \"disk_size\": 123,\n \"cpu_size\": 123,\n \"size\": \"<string>\",\n \"public_access\": true,\n \"environment_variables\": true,\n \"auto_sleep\": true,\n \"external_host\": \"<string>\",\n \"external_port\": 123,\n \"replication_username\": \"<string>\",\n \"replication_password\": \"<string>\",\n \"ca_crt\": \"<string>\",\n \"tls_crt\": \"<string>\",\n \"tls_key\": \"<string>\",\n \"s3_enabled\": true,\n \"s3_endpoint\": \"<string>\",\n \"s3_bucket\": \"<string>\",\n \"s3_path\": \"<string>\",\n \"s3_access_key\": \"<string>\",\n \"s3_secret_key\": \"<string>\",\n \"s3_server_name\": \"<string>\",\n \"mount_point\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://app.miget.com/api/v1/services")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"project_id\": \"<string>\",\n \"label\": \"<string>\",\n \"resource_id\": \"<string>\",\n \"miget_id\": \"<string>\",\n \"region_code\": \"<string>\",\n \"ram_size\": 123,\n \"disk_size\": 123,\n \"cpu_size\": 123,\n \"size\": \"<string>\",\n \"public_access\": true,\n \"environment_variables\": true,\n \"auto_sleep\": true,\n \"external_host\": \"<string>\",\n \"external_port\": 123,\n \"replication_username\": \"<string>\",\n \"replication_password\": \"<string>\",\n \"ca_crt\": \"<string>\",\n \"tls_crt\": \"<string>\",\n \"tls_key\": \"<string>\",\n \"s3_enabled\": true,\n \"s3_endpoint\": \"<string>\",\n \"s3_bucket\": \"<string>\",\n \"s3_path\": \"<string>\",\n \"s3_access_key\": \"<string>\",\n \"s3_secret_key\": \"<string>\",\n \"s3_server_name\": \"<string>\",\n \"mount_point\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.miget.com/api/v1/services")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"project_id\": \"<string>\",\n \"label\": \"<string>\",\n \"resource_id\": \"<string>\",\n \"miget_id\": \"<string>\",\n \"region_code\": \"<string>\",\n \"ram_size\": 123,\n \"disk_size\": 123,\n \"cpu_size\": 123,\n \"size\": \"<string>\",\n \"public_access\": true,\n \"environment_variables\": true,\n \"auto_sleep\": true,\n \"external_host\": \"<string>\",\n \"external_port\": 123,\n \"replication_username\": \"<string>\",\n \"replication_password\": \"<string>\",\n \"ca_crt\": \"<string>\",\n \"tls_crt\": \"<string>\",\n \"tls_key\": \"<string>\",\n \"s3_enabled\": true,\n \"s3_endpoint\": \"<string>\",\n \"s3_bucket\": \"<string>\",\n \"s3_path\": \"<string>\",\n \"s3_access_key\": \"<string>\",\n \"s3_secret_key\": \"<string>\",\n \"s3_server_name\": \"<string>\",\n \"mount_point\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"uuid": "<string>",
"name": "<string>",
"label": "<string>",
"service_type": "<string>",
"state": "<string>",
"project_id": "<string>",
"billing": "resource",
"resource_id": "<string>",
"miget_id": "<string>",
"ram_size": 123,
"disk_size": 123,
"cpu_size": 123,
"public_access": true,
"instances": 123,
"postgres_version": "<string>",
"mount_point": "<string>",
"mounts": [
{
"app_id": "0190f2c4-0000-7000-8000-000000000000",
"addon_uuid": "0190f2c4-0000-7000-8000-000000000001",
"mount_point": "/data",
"sub_path": "media/uploads",
"label": "Storage #1 for shared-storage-service"
}
],
"auto_sleep": true,
"backup_enabled": true,
"scheduled_backup": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"connection_details": {
"internal": {
"hostname": "my-service-xxx.internal",
"database": "db_name",
"port": 5432,
"username": "db_user",
"password": "db_password",
"connection_url": "postgres://db_user:db_password@my-service-xxx.internal:5432/db_name"
},
"external": {
"external_connection_url": "postgres://db_user:db_password@my-service-xxx.external:5432/db_name",
"psql_command": "PGPASSWORD=db_password psql -h my-service-xxx.external -U db_user db_name"
}
}
}Create a new service
Creates a standalone service (database or shared storage) that can be shared across multiple applications in a project. A shared_storage service is sized by disk_size alone: size, cpu_size and ram_size are refused with 422.
curl --request POST \
--url https://app.miget.com/api/v1/services \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"project_id": "<string>",
"label": "<string>",
"resource_id": "<string>",
"miget_id": "<string>",
"region_code": "<string>",
"ram_size": 123,
"disk_size": 123,
"cpu_size": 123,
"size": "<string>",
"public_access": true,
"environment_variables": true,
"auto_sleep": true,
"external_host": "<string>",
"external_port": 123,
"replication_username": "<string>",
"replication_password": "<string>",
"ca_crt": "<string>",
"tls_crt": "<string>",
"tls_key": "<string>",
"s3_enabled": true,
"s3_endpoint": "<string>",
"s3_bucket": "<string>",
"s3_path": "<string>",
"s3_access_key": "<string>",
"s3_secret_key": "<string>",
"s3_server_name": "<string>",
"mount_point": "<string>"
}
'import requests
url = "https://app.miget.com/api/v1/services"
payload = {
"project_id": "<string>",
"label": "<string>",
"resource_id": "<string>",
"miget_id": "<string>",
"region_code": "<string>",
"ram_size": 123,
"disk_size": 123,
"cpu_size": 123,
"size": "<string>",
"public_access": True,
"environment_variables": True,
"auto_sleep": True,
"external_host": "<string>",
"external_port": 123,
"replication_username": "<string>",
"replication_password": "<string>",
"ca_crt": "<string>",
"tls_crt": "<string>",
"tls_key": "<string>",
"s3_enabled": True,
"s3_endpoint": "<string>",
"s3_bucket": "<string>",
"s3_path": "<string>",
"s3_access_key": "<string>",
"s3_secret_key": "<string>",
"s3_server_name": "<string>",
"mount_point": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
project_id: '<string>',
label: '<string>',
resource_id: '<string>',
miget_id: '<string>',
region_code: '<string>',
ram_size: 123,
disk_size: 123,
cpu_size: 123,
size: '<string>',
public_access: true,
environment_variables: true,
auto_sleep: true,
external_host: '<string>',
external_port: 123,
replication_username: '<string>',
replication_password: '<string>',
ca_crt: '<string>',
tls_crt: '<string>',
tls_key: '<string>',
s3_enabled: true,
s3_endpoint: '<string>',
s3_bucket: '<string>',
s3_path: '<string>',
s3_access_key: '<string>',
s3_secret_key: '<string>',
s3_server_name: '<string>',
mount_point: '<string>'
})
};
fetch('https://app.miget.com/api/v1/services', 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://app.miget.com/api/v1/services",
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([
'project_id' => '<string>',
'label' => '<string>',
'resource_id' => '<string>',
'miget_id' => '<string>',
'region_code' => '<string>',
'ram_size' => 123,
'disk_size' => 123,
'cpu_size' => 123,
'size' => '<string>',
'public_access' => true,
'environment_variables' => true,
'auto_sleep' => true,
'external_host' => '<string>',
'external_port' => 123,
'replication_username' => '<string>',
'replication_password' => '<string>',
'ca_crt' => '<string>',
'tls_crt' => '<string>',
'tls_key' => '<string>',
's3_enabled' => true,
's3_endpoint' => '<string>',
's3_bucket' => '<string>',
's3_path' => '<string>',
's3_access_key' => '<string>',
's3_secret_key' => '<string>',
's3_server_name' => '<string>',
'mount_point' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://app.miget.com/api/v1/services"
payload := strings.NewReader("{\n \"project_id\": \"<string>\",\n \"label\": \"<string>\",\n \"resource_id\": \"<string>\",\n \"miget_id\": \"<string>\",\n \"region_code\": \"<string>\",\n \"ram_size\": 123,\n \"disk_size\": 123,\n \"cpu_size\": 123,\n \"size\": \"<string>\",\n \"public_access\": true,\n \"environment_variables\": true,\n \"auto_sleep\": true,\n \"external_host\": \"<string>\",\n \"external_port\": 123,\n \"replication_username\": \"<string>\",\n \"replication_password\": \"<string>\",\n \"ca_crt\": \"<string>\",\n \"tls_crt\": \"<string>\",\n \"tls_key\": \"<string>\",\n \"s3_enabled\": true,\n \"s3_endpoint\": \"<string>\",\n \"s3_bucket\": \"<string>\",\n \"s3_path\": \"<string>\",\n \"s3_access_key\": \"<string>\",\n \"s3_secret_key\": \"<string>\",\n \"s3_server_name\": \"<string>\",\n \"mount_point\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://app.miget.com/api/v1/services")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"project_id\": \"<string>\",\n \"label\": \"<string>\",\n \"resource_id\": \"<string>\",\n \"miget_id\": \"<string>\",\n \"region_code\": \"<string>\",\n \"ram_size\": 123,\n \"disk_size\": 123,\n \"cpu_size\": 123,\n \"size\": \"<string>\",\n \"public_access\": true,\n \"environment_variables\": true,\n \"auto_sleep\": true,\n \"external_host\": \"<string>\",\n \"external_port\": 123,\n \"replication_username\": \"<string>\",\n \"replication_password\": \"<string>\",\n \"ca_crt\": \"<string>\",\n \"tls_crt\": \"<string>\",\n \"tls_key\": \"<string>\",\n \"s3_enabled\": true,\n \"s3_endpoint\": \"<string>\",\n \"s3_bucket\": \"<string>\",\n \"s3_path\": \"<string>\",\n \"s3_access_key\": \"<string>\",\n \"s3_secret_key\": \"<string>\",\n \"s3_server_name\": \"<string>\",\n \"mount_point\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.miget.com/api/v1/services")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"project_id\": \"<string>\",\n \"label\": \"<string>\",\n \"resource_id\": \"<string>\",\n \"miget_id\": \"<string>\",\n \"region_code\": \"<string>\",\n \"ram_size\": 123,\n \"disk_size\": 123,\n \"cpu_size\": 123,\n \"size\": \"<string>\",\n \"public_access\": true,\n \"environment_variables\": true,\n \"auto_sleep\": true,\n \"external_host\": \"<string>\",\n \"external_port\": 123,\n \"replication_username\": \"<string>\",\n \"replication_password\": \"<string>\",\n \"ca_crt\": \"<string>\",\n \"tls_crt\": \"<string>\",\n \"tls_key\": \"<string>\",\n \"s3_enabled\": true,\n \"s3_endpoint\": \"<string>\",\n \"s3_bucket\": \"<string>\",\n \"s3_path\": \"<string>\",\n \"s3_access_key\": \"<string>\",\n \"s3_secret_key\": \"<string>\",\n \"s3_server_name\": \"<string>\",\n \"mount_point\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"uuid": "<string>",
"name": "<string>",
"label": "<string>",
"service_type": "<string>",
"state": "<string>",
"project_id": "<string>",
"billing": "resource",
"resource_id": "<string>",
"miget_id": "<string>",
"ram_size": 123,
"disk_size": 123,
"cpu_size": 123,
"public_access": true,
"instances": 123,
"postgres_version": "<string>",
"mount_point": "<string>",
"mounts": [
{
"app_id": "0190f2c4-0000-7000-8000-000000000000",
"addon_uuid": "0190f2c4-0000-7000-8000-000000000001",
"mount_point": "/data",
"sub_path": "media/uploads",
"label": "Storage #1 for shared-storage-service"
}
],
"auto_sleep": true,
"backup_enabled": true,
"scheduled_backup": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"connection_details": {
"internal": {
"hostname": "my-service-xxx.internal",
"database": "db_name",
"port": 5432,
"username": "db_user",
"password": "db_password",
"connection_url": "postgres://db_user:db_password@my-service-xxx.internal:5432/db_name"
},
"external": {
"external_connection_url": "postgres://db_user:db_password@my-service-xxx.external:5432/db_name",
"psql_command": "PGPASSWORD=db_password psql -h my-service-xxx.external -U db_user db_name"
}
}
}Authorizations
Body
Create a new service
Where it runs: 'resource' (default, on the resource named by resource_id), 'pay_per_use' (without a resource, paying for what it reserves while it runs; not on an enterprise contract) or 'workspace_pool' (without a resource, in an enterprise contract's pool; refused with 422 when the pool has no room)
resource, pay_per_use, workspace_pool With billing pay_per_use or workspace_pool, the CPU class: 'hobby' (shared CPU) or 'pro' (dedicated). Implied by size when one is named. Hobby and Pro workloads run in separate namespaces, so it cannot be changed afterwards. Ignored for shared_storage, which uses no CPU.
hobby, pro Response
Create a new service
Api_V1_Entities_Service model
Current state. While provisioning: pending, processing, creating, stopped. Once running, the live Kubernetes status: healthy (postgres/mysql/valkey), bound (storage), or running when the status is unavailable. Unhealthy: degraded, degradated, failing, lost, crashloopbackoff, failed
Applications mounting this shared storage service, one entry per mount created by POST /services/{id}/mount_app, limited to apps in projects you can access. Empty for other service types
[
{
"app_id": "0190f2c4-0000-7000-8000-000000000000",
"addon_uuid": "0190f2c4-0000-7000-8000-000000000001",
"mount_point": "/data",
"sub_path": "media/uploads",
"label": "Storage #1 for shared-storage-service"
}
]
Connection details for the service
{
"internal": {
"hostname": "my-service-xxx.internal",
"database": "db_name",
"port": 5432,
"username": "db_user",
"password": "db_password",
"connection_url": "postgres://db_user:db_password@my-service-xxx.internal:5432/db_name"
},
"external": {
"external_connection_url": "postgres://db_user:db_password@my-service-xxx.external:5432/db_name",
"psql_command": "PGPASSWORD=db_password psql -h my-service-xxx.external -U db_user db_name"
}
}

