Create environment
curl --request POST \
--url https://cloud.laravel.com/api/applications/{application}/environments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"branch": "<string>",
"name": "<string>",
"build_command": "<string>",
"cluster_id": "<string>",
"edge_network_id": "<string>"
}
'import requests
url = "https://cloud.laravel.com/api/applications/{application}/environments"
payload = {
"branch": "<string>",
"name": "<string>",
"build_command": "<string>",
"cluster_id": "<string>",
"edge_network_id": "<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({
branch: '<string>',
name: '<string>',
build_command: '<string>',
cluster_id: '<string>',
edge_network_id: '<string>'
})
};
fetch('https://cloud.laravel.com/api/applications/{application}/environments', 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/applications/{application}/environments",
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([
'branch' => '<string>',
'name' => '<string>',
'build_command' => '<string>',
'cluster_id' => '<string>',
'edge_network_id' => '<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/applications/{application}/environments"
payload := strings.NewReader("{\n \"branch\": \"<string>\",\n \"name\": \"<string>\",\n \"build_command\": \"<string>\",\n \"cluster_id\": \"<string>\",\n \"edge_network_id\": \"<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/applications/{application}/environments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"branch\": \"<string>\",\n \"name\": \"<string>\",\n \"build_command\": \"<string>\",\n \"cluster_id\": \"<string>\",\n \"edge_network_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud.laravel.com/api/applications/{application}/environments")
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 \"branch\": \"<string>\",\n \"name\": \"<string>\",\n \"build_command\": \"<string>\",\n \"cluster_id\": \"<string>\",\n \"edge_network_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}Environments
Create environment
Create a new environment.
POST
/
applications
/
{application}
/
environments
Create environment
curl --request POST \
--url https://cloud.laravel.com/api/applications/{application}/environments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"branch": "<string>",
"name": "<string>",
"build_command": "<string>",
"cluster_id": "<string>",
"edge_network_id": "<string>"
}
'import requests
url = "https://cloud.laravel.com/api/applications/{application}/environments"
payload = {
"branch": "<string>",
"name": "<string>",
"build_command": "<string>",
"cluster_id": "<string>",
"edge_network_id": "<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({
branch: '<string>',
name: '<string>',
build_command: '<string>',
cluster_id: '<string>',
edge_network_id: '<string>'
})
};
fetch('https://cloud.laravel.com/api/applications/{application}/environments', 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/applications/{application}/environments",
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([
'branch' => '<string>',
'name' => '<string>',
'build_command' => '<string>',
'cluster_id' => '<string>',
'edge_network_id' => '<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/applications/{application}/environments"
payload := strings.NewReader("{\n \"branch\": \"<string>\",\n \"name\": \"<string>\",\n \"build_command\": \"<string>\",\n \"cluster_id\": \"<string>\",\n \"edge_network_id\": \"<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/applications/{application}/environments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"branch\": \"<string>\",\n \"name\": \"<string>\",\n \"build_command\": \"<string>\",\n \"cluster_id\": \"<string>\",\n \"edge_network_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud.laravel.com/api/applications/{application}/environments")
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 \"branch\": \"<string>\",\n \"name\": \"<string>\",\n \"build_command\": \"<string>\",\n \"cluster_id\": \"<string>\",\n \"edge_network_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}Authorizations
The Bearer Token generated on the Cloud UI.
Path Parameters
The application identifier
Body
application/json
Required string length:
1 - 40Pattern:
^[A-Za-z0-9 _-]+$Optional build command. Omit it or send null to skip the build command for a static website.
Maximum string length:
2000The identifier of a dedicated cluster to deploy to. Only fill it if your organization has a dedicated cluster and you want to use it for this environment.
The identifier of the edge network the environment should be created in. Only fill it if your organization has a dedicated edge network and you want to use it for this environment. Defaults to the edge network preferred by your organization.
Response
The response is of type object.
Was this page helpful?

