Create instance
curl --request POST \
--url https://cloud.laravel.com/api/environments/{environment}/instances \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"min_replicas": 1,
"visibility_timeout": 21600,
"polling_interval": 30,
"shutdown_timeout": 0,
"max_replicas": 10,
"uses_scheduler": true,
"sleep_with_app": true,
"scaling_cpu_threshold_percentage": 72,
"scaling_memory_threshold_percentage": 72,
"background_processes": [
{
"processes": 5,
"command": "php artisan my:command",
"config": {
"connection": "redis",
"queue": "default,emails",
"tries": 3,
"backoff": 30,
"sleep": 3,
"rest": 0,
"timeout": 60,
"force": false
}
}
]
}
'import requests
url = "https://cloud.laravel.com/api/environments/{environment}/instances"
payload = {
"name": "<string>",
"min_replicas": 1,
"visibility_timeout": 21600,
"polling_interval": 30,
"shutdown_timeout": 0,
"max_replicas": 10,
"uses_scheduler": True,
"sleep_with_app": True,
"scaling_cpu_threshold_percentage": 72,
"scaling_memory_threshold_percentage": 72,
"background_processes": [
{
"processes": 5,
"command": "php artisan my:command",
"config": {
"connection": "redis",
"queue": "default,emails",
"tries": 3,
"backoff": 30,
"sleep": 3,
"rest": 0,
"timeout": 60,
"force": False
}
}
]
}
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>',
min_replicas: 1,
visibility_timeout: 21600,
polling_interval: 30,
shutdown_timeout: 0,
max_replicas: 10,
uses_scheduler: true,
sleep_with_app: true,
scaling_cpu_threshold_percentage: 72,
scaling_memory_threshold_percentage: 72,
background_processes: [
{
processes: 5,
command: 'php artisan my:command',
config: {
connection: 'redis',
queue: 'default,emails',
tries: 3,
backoff: 30,
sleep: 3,
rest: 0,
timeout: 60,
force: false
}
}
]
})
};
fetch('https://cloud.laravel.com/api/environments/{environment}/instances', 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/environments/{environment}/instances",
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>',
'min_replicas' => 1,
'visibility_timeout' => 21600,
'polling_interval' => 30,
'shutdown_timeout' => 0,
'max_replicas' => 10,
'uses_scheduler' => true,
'sleep_with_app' => true,
'scaling_cpu_threshold_percentage' => 72,
'scaling_memory_threshold_percentage' => 72,
'background_processes' => [
[
'processes' => 5,
'command' => 'php artisan my:command',
'config' => [
'connection' => 'redis',
'queue' => 'default,emails',
'tries' => 3,
'backoff' => 30,
'sleep' => 3,
'rest' => 0,
'timeout' => 60,
'force' => false
]
]
]
]),
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/environments/{environment}/instances"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"min_replicas\": 1,\n \"visibility_timeout\": 21600,\n \"polling_interval\": 30,\n \"shutdown_timeout\": 0,\n \"max_replicas\": 10,\n \"uses_scheduler\": true,\n \"sleep_with_app\": true,\n \"scaling_cpu_threshold_percentage\": 72,\n \"scaling_memory_threshold_percentage\": 72,\n \"background_processes\": [\n {\n \"processes\": 5,\n \"command\": \"php artisan my:command\",\n \"config\": {\n \"connection\": \"redis\",\n \"queue\": \"default,emails\",\n \"tries\": 3,\n \"backoff\": 30,\n \"sleep\": 3,\n \"rest\": 0,\n \"timeout\": 60,\n \"force\": false\n }\n }\n ]\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/environments/{environment}/instances")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"min_replicas\": 1,\n \"visibility_timeout\": 21600,\n \"polling_interval\": 30,\n \"shutdown_timeout\": 0,\n \"max_replicas\": 10,\n \"uses_scheduler\": true,\n \"sleep_with_app\": true,\n \"scaling_cpu_threshold_percentage\": 72,\n \"scaling_memory_threshold_percentage\": 72,\n \"background_processes\": [\n {\n \"processes\": 5,\n \"command\": \"php artisan my:command\",\n \"config\": {\n \"connection\": \"redis\",\n \"queue\": \"default,emails\",\n \"tries\": 3,\n \"backoff\": 30,\n \"sleep\": 3,\n \"rest\": 0,\n \"timeout\": 60,\n \"force\": false\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud.laravel.com/api/environments/{environment}/instances")
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 \"min_replicas\": 1,\n \"visibility_timeout\": 21600,\n \"polling_interval\": 30,\n \"shutdown_timeout\": 0,\n \"max_replicas\": 10,\n \"uses_scheduler\": true,\n \"sleep_with_app\": true,\n \"scaling_cpu_threshold_percentage\": 72,\n \"scaling_memory_threshold_percentage\": 72,\n \"background_processes\": [\n {\n \"processes\": 5,\n \"command\": \"php artisan my:command\",\n \"config\": {\n \"connection\": \"redis\",\n \"queue\": \"default,emails\",\n \"tries\": 3,\n \"backoff\": 30,\n \"sleep\": 3,\n \"rest\": 0,\n \"timeout\": 60,\n \"force\": false\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"type": "instances",
"attributes": {
"name": "<string>",
"min_replicas": 123,
"max_replicas": 123,
"paused": true,
"is_default": true,
"visibility_timeout": 123,
"polling_interval": 123,
"shutdown_timeout": 123,
"uses_scheduler": true,
"sleep_with_app": true,
"scaling_cpu_threshold_percentage": 123,
"scaling_memory_threshold_percentage": 123,
"created_at": "2023-11-07T05:31:56Z"
},
"relationships": {
"environment": {
"data": {
"type": "environments",
"id": "<string>"
}
},
"backgroundProcesses": {
"data": [
{
"type": "background_processes",
"id": "<string>"
}
]
}
}
},
"included": [
{
"id": "<string>",
"type": "environments",
"links": {
"self": {
"href": "<string>",
"rel": "<string>",
"describedby": "<string>",
"title": "<string>",
"type": "<string>",
"hreflang": "<string>",
"meta": {}
}
},
"attributes": {
"name": "<string>",
"slug": "<string>",
"created_from_automation": true,
"vanity_domain": "<string>",
"build_command": "<string>",
"deploy_command": "<string>",
"uses_octane": true,
"uses_hibernation": true,
"hibernation_wake_up_interval": 123,
"uses_push_to_deploy": true,
"uses_deploy_hook": true,
"environment_variables": [
{
"key": "<string>",
"value": "<string>"
}
],
"network_settings": {
"cache": {
"strategy": "<string>"
},
"response_headers": {
"frame": "<string>",
"content_type": "<string>",
"hsts": {
"max_age": 123,
"include_subdomains": true,
"preload": true
}
},
"firewall": {
"bot_categories": [],
"rate_limit": {
"429": true,
"4xx": true
},
"under_attack_mode_started_at": "<string>",
"block_path": true
},
"content_converter": true
},
"created_at": "2023-11-07T05:31:56Z"
},
"relationships": {
"application": {
"data": {
"type": "applications",
"id": "<string>"
}
},
"branch": {
"data": {
"type": "branches",
"id": "<string>"
}
},
"deployments": {
"data": [
{
"type": "deployments",
"id": "<string>"
}
]
},
"currentDeployment": {
"data": {
"type": "deployments",
"id": "<string>"
}
},
"domains": {
"data": [
{
"type": "domains",
"id": "<string>"
}
]
},
"primaryDomain": {
"data": {
"type": "domains",
"id": "<string>"
}
},
"instances": {
"data": [
{
"type": "instances",
"id": "<string>"
}
]
},
"database": {
"data": {
"type": "databaseSchemas",
"id": "<string>"
}
},
"cache": {
"data": {
"type": "caches",
"id": "<string>"
}
},
"buckets": {
"data": [
{
"type": "filesystems",
"id": "<string>"
}
]
},
"websocketApplication": {
"data": {
"type": "websocketApplications",
"id": "<string>"
}
}
}
}
]
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}Instances
Create instance
Create a new instance for an environment.
POST
/
environments
/
{environment}
/
instances
Create instance
curl --request POST \
--url https://cloud.laravel.com/api/environments/{environment}/instances \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"min_replicas": 1,
"visibility_timeout": 21600,
"polling_interval": 30,
"shutdown_timeout": 0,
"max_replicas": 10,
"uses_scheduler": true,
"sleep_with_app": true,
"scaling_cpu_threshold_percentage": 72,
"scaling_memory_threshold_percentage": 72,
"background_processes": [
{
"processes": 5,
"command": "php artisan my:command",
"config": {
"connection": "redis",
"queue": "default,emails",
"tries": 3,
"backoff": 30,
"sleep": 3,
"rest": 0,
"timeout": 60,
"force": false
}
}
]
}
'import requests
url = "https://cloud.laravel.com/api/environments/{environment}/instances"
payload = {
"name": "<string>",
"min_replicas": 1,
"visibility_timeout": 21600,
"polling_interval": 30,
"shutdown_timeout": 0,
"max_replicas": 10,
"uses_scheduler": True,
"sleep_with_app": True,
"scaling_cpu_threshold_percentage": 72,
"scaling_memory_threshold_percentage": 72,
"background_processes": [
{
"processes": 5,
"command": "php artisan my:command",
"config": {
"connection": "redis",
"queue": "default,emails",
"tries": 3,
"backoff": 30,
"sleep": 3,
"rest": 0,
"timeout": 60,
"force": False
}
}
]
}
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>',
min_replicas: 1,
visibility_timeout: 21600,
polling_interval: 30,
shutdown_timeout: 0,
max_replicas: 10,
uses_scheduler: true,
sleep_with_app: true,
scaling_cpu_threshold_percentage: 72,
scaling_memory_threshold_percentage: 72,
background_processes: [
{
processes: 5,
command: 'php artisan my:command',
config: {
connection: 'redis',
queue: 'default,emails',
tries: 3,
backoff: 30,
sleep: 3,
rest: 0,
timeout: 60,
force: false
}
}
]
})
};
fetch('https://cloud.laravel.com/api/environments/{environment}/instances', 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/environments/{environment}/instances",
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>',
'min_replicas' => 1,
'visibility_timeout' => 21600,
'polling_interval' => 30,
'shutdown_timeout' => 0,
'max_replicas' => 10,
'uses_scheduler' => true,
'sleep_with_app' => true,
'scaling_cpu_threshold_percentage' => 72,
'scaling_memory_threshold_percentage' => 72,
'background_processes' => [
[
'processes' => 5,
'command' => 'php artisan my:command',
'config' => [
'connection' => 'redis',
'queue' => 'default,emails',
'tries' => 3,
'backoff' => 30,
'sleep' => 3,
'rest' => 0,
'timeout' => 60,
'force' => false
]
]
]
]),
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/environments/{environment}/instances"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"min_replicas\": 1,\n \"visibility_timeout\": 21600,\n \"polling_interval\": 30,\n \"shutdown_timeout\": 0,\n \"max_replicas\": 10,\n \"uses_scheduler\": true,\n \"sleep_with_app\": true,\n \"scaling_cpu_threshold_percentage\": 72,\n \"scaling_memory_threshold_percentage\": 72,\n \"background_processes\": [\n {\n \"processes\": 5,\n \"command\": \"php artisan my:command\",\n \"config\": {\n \"connection\": \"redis\",\n \"queue\": \"default,emails\",\n \"tries\": 3,\n \"backoff\": 30,\n \"sleep\": 3,\n \"rest\": 0,\n \"timeout\": 60,\n \"force\": false\n }\n }\n ]\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/environments/{environment}/instances")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"min_replicas\": 1,\n \"visibility_timeout\": 21600,\n \"polling_interval\": 30,\n \"shutdown_timeout\": 0,\n \"max_replicas\": 10,\n \"uses_scheduler\": true,\n \"sleep_with_app\": true,\n \"scaling_cpu_threshold_percentage\": 72,\n \"scaling_memory_threshold_percentage\": 72,\n \"background_processes\": [\n {\n \"processes\": 5,\n \"command\": \"php artisan my:command\",\n \"config\": {\n \"connection\": \"redis\",\n \"queue\": \"default,emails\",\n \"tries\": 3,\n \"backoff\": 30,\n \"sleep\": 3,\n \"rest\": 0,\n \"timeout\": 60,\n \"force\": false\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud.laravel.com/api/environments/{environment}/instances")
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 \"min_replicas\": 1,\n \"visibility_timeout\": 21600,\n \"polling_interval\": 30,\n \"shutdown_timeout\": 0,\n \"max_replicas\": 10,\n \"uses_scheduler\": true,\n \"sleep_with_app\": true,\n \"scaling_cpu_threshold_percentage\": 72,\n \"scaling_memory_threshold_percentage\": 72,\n \"background_processes\": [\n {\n \"processes\": 5,\n \"command\": \"php artisan my:command\",\n \"config\": {\n \"connection\": \"redis\",\n \"queue\": \"default,emails\",\n \"tries\": 3,\n \"backoff\": 30,\n \"sleep\": 3,\n \"rest\": 0,\n \"timeout\": 60,\n \"force\": false\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"type": "instances",
"attributes": {
"name": "<string>",
"min_replicas": 123,
"max_replicas": 123,
"paused": true,
"is_default": true,
"visibility_timeout": 123,
"polling_interval": 123,
"shutdown_timeout": 123,
"uses_scheduler": true,
"sleep_with_app": true,
"scaling_cpu_threshold_percentage": 123,
"scaling_memory_threshold_percentage": 123,
"created_at": "2023-11-07T05:31:56Z"
},
"relationships": {
"environment": {
"data": {
"type": "environments",
"id": "<string>"
}
},
"backgroundProcesses": {
"data": [
{
"type": "background_processes",
"id": "<string>"
}
]
}
}
},
"included": [
{
"id": "<string>",
"type": "environments",
"links": {
"self": {
"href": "<string>",
"rel": "<string>",
"describedby": "<string>",
"title": "<string>",
"type": "<string>",
"hreflang": "<string>",
"meta": {}
}
},
"attributes": {
"name": "<string>",
"slug": "<string>",
"created_from_automation": true,
"vanity_domain": "<string>",
"build_command": "<string>",
"deploy_command": "<string>",
"uses_octane": true,
"uses_hibernation": true,
"hibernation_wake_up_interval": 123,
"uses_push_to_deploy": true,
"uses_deploy_hook": true,
"environment_variables": [
{
"key": "<string>",
"value": "<string>"
}
],
"network_settings": {
"cache": {
"strategy": "<string>"
},
"response_headers": {
"frame": "<string>",
"content_type": "<string>",
"hsts": {
"max_age": 123,
"include_subdomains": true,
"preload": true
}
},
"firewall": {
"bot_categories": [],
"rate_limit": {
"429": true,
"4xx": true
},
"under_attack_mode_started_at": "<string>",
"block_path": true
},
"content_converter": true
},
"created_at": "2023-11-07T05:31:56Z"
},
"relationships": {
"application": {
"data": {
"type": "applications",
"id": "<string>"
}
},
"branch": {
"data": {
"type": "branches",
"id": "<string>"
}
},
"deployments": {
"data": [
{
"type": "deployments",
"id": "<string>"
}
]
},
"currentDeployment": {
"data": {
"type": "deployments",
"id": "<string>"
}
},
"domains": {
"data": [
{
"type": "domains",
"id": "<string>"
}
]
},
"primaryDomain": {
"data": {
"type": "domains",
"id": "<string>"
}
},
"instances": {
"data": [
{
"type": "instances",
"id": "<string>"
}
]
},
"database": {
"data": {
"type": "databaseSchemas",
"id": "<string>"
}
},
"cache": {
"data": {
"type": "caches",
"id": "<string>"
}
},
"buckets": {
"data": [
{
"type": "filesystems",
"id": "<string>"
}
]
},
"websocketApplication": {
"data": {
"type": "websocketApplications",
"id": "<string>"
}
}
}
}
]
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}Authorizations
The Bearer Token generated on the Cloud UI.
Path Parameters
The environment identifier
Body
application/json
Required string length:
3 - 40Available options:
service, managed_queue Available options:
flex-512mb, flex-1gb, flex-2gb, flex.c-1vcpu-256mb, flex.g-1vcpu-512mb, flex.m-1vcpu-1gb, flex.c-2vcpu-512mb, flex.g-2vcpu-1gb, flex.m-2vcpu-2gb, flex.c-4vcpu-1gb, flex.g-4vcpu-2gb, flex.m-4vcpu-4gb, flex.c-8vcpu-2gb, flex.g-8vcpu-4gb, flex.m-8vcpu-8gb, pro.c-1vcpu-1gb, pro.g-1vcpu-2gb, pro.m-1vcpu-4gb, pro.c-2vcpu-2gb, pro.g-2vcpu-4gb, pro.m-2vcpu-8gb, pro.c-4vcpu-4gb, pro.g-4vcpu-8gb, pro.m-4vcpu-16gb, pro.c-8vcpu-8gb, pro.g-8vcpu-16gb, pro.m-8vcpu-32gb, dedicated.c-1vcpu-2gb, dedicated.g-1vcpu-4gb, dedicated.m-1vcpu-8gb, dedicated.c-2vcpu-4gb, dedicated.g-2vcpu-8gb, dedicated.m-2vcpu-16gb, dedicated.c-4vcpu-8gb, dedicated.g-4vcpu-16gb, dedicated.m-4vcpu-32gb, dedicated.c-8vcpu-16gb, dedicated.g-8vcpu-32gb, dedicated.m-8vcpu-64gb, mq-pro-256mb, mq-pro-512mb, mq-pro-1gb, mq-pro-2gb, mq-pro-4gb, mq-pro-8gb, mq-dedicated-256mb, mq-dedicated-512mb, mq-dedicated-1gb, mq-dedicated-2gb, mq-dedicated-4gb, mq-dedicated-8gb Available options:
none, custom, auto The minimum number of replicas the instance runs. Only applicable to the custom scaling type, and rejected when used with auto. Not applicable to managed queues, which always scale to zero when idle.
Example:
1
Required range:
0 <= x <= 43200Required range:
1 <= x <= 60Required range:
1 <= x <= 0The maximum number of replicas the instance can scale to. Only applicable to the custom scaling type, and rejected when used with auto.
Example:
10
Whether worker replicas scale to zero alongside the app cluster, waking when they receive traffic. Only applicable to worker (service) instances.
Example:
true
Required range:
50 <= x <= 95Required range:
50 <= x <= 95Show child attributes
Show child attributes
Was this page helpful?
⌘I

