### Get site with Go Source: https://laravel.com/forge/docs/api-reference/sites/get-site Go program using net/http to GET a site. Prints the response body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://forge.laravel.com/api/orgs/{organization}/sites/{site}" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } ``` -------------------------------- ### 200 response example for get provider region Source: https://laravel.com/forge/docs/api-reference/providers/get-provider-region Example of a successful 200 response containing the provider region resource. ```JSON { "data": { "id": "", "type": "providerRegions", "links": { "self": { "href": "", "rel": "", "describedby": "", "title": "", "type": "", "hreflang": "", "meta": {} } }, "attributes": { "name": "", "code": "", "alternate_code": "" } } } ``` -------------------------------- ### Create backup with Go Source: https://laravel.com/forge/docs/api-reference/backups/create-backup Go example using net/http to POST to the backup instances endpoint. Requires an access token in the Authorization header. Prints the response body. ```Go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://forge.laravel.com/api/orgs/{organization}/servers/{server}/database/backups/{backupConfiguration}/instances" req, _ := http.NewRequest("POST", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } ``` -------------------------------- ### 200 response for get team Source: https://laravel.com/forge/docs/api-reference/teams/get-team Example successful response (200) for the get team endpoint, containing a TeamResource object with team attributes. ```json { "data": { "id": "", "type": "teams", "links": { "self": { "href": "", "rel": "", "describedby": "", "title": "", "type": "", "hreflang": "", "meta": {} } }, "attributes": { "name": "", "created_at": "2023-11-07T05:31:56Z", "updated_at": "2023-11-07T05:31:56Z" } } } ``` -------------------------------- ### Create recipe with Go Source: https://laravel.com/forge/docs/api-reference/recipes/create-recipe Go example using net/http to POST a new recipe. Builds a JSON payload and sends it with Authorization and Content-Type headers. Prints the response body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://forge.laravel.com/api/orgs/{organization}/recipes" payload := strings.NewReader("{\n \"name\": \"\",\n \"script\": \"\",\n \"team_id\": 123\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") 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)) } ``` -------------------------------- ### Get heartbeat with cURL command Source: https://laravel.com/forge/docs/api-reference/sites/get-heartbeat Sends a GET request using the curl command-line tool. Requires the same URL and Authorization header as the PHP example. ```bash curl --request GET \ --url https://forge.laravel.com/api/orgs/{organization}/servers/{server}/sites/{site}/heartbeats/{heartbeat} \ --header 'Authorization: Bearer ' ``` -------------------------------- ### Create backup configuration with Go Source: https://laravel.com/forge/docs/api-reference/backups/create-backup-configuration Go example using net/http to POST to the Forge API. Builds a JSON payload as a string and sends it with the required headers. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://forge.laravel.com/api/orgs/{organization}/servers/{server}/database/backups" payload := strings.NewReader("{\n \"storage_provider_id\": 123,\n \"database_ids\": [\n 123\n ],\n \"retention\": 4380,\n \"name\": \"\",\n \"bucket\": \"\",\n \"directory\": \"\",\n \"cron\": \"\",\n \"include_new_databases\": true,\n \"notification_email\": \"jsmith@example.com\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") 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)) } ``` -------------------------------- ### Create deploy key with Go Source: https://laravel.com/forge/docs/api-reference/deployments/create-deploy-key Uses the net/http package to POST to the deploy-key endpoint. Requires an API token and organization, server, and site IDs. Prints the response body. ```Go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://forge.laravel.com/api/orgs/{organization}/servers/{server}/sites/{site}/deploy-key" req, _ := http.NewRequest("POST", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } ``` -------------------------------- ### 200 response example for get server PHP max upload size Source: https://laravel.com/forge/docs/api-reference/servers/get-server-php-max-upload-size Example of a successful response (HTTP 200) containing a PhpMaxUploadSizeResource object with the max_upload_size attribute. ```json { "data": { "id": "", "type": "phpMaxUploadSizes", "links": { "self": { "href": "", "rel": "", "describedby": "", "title": "", "type": "", "hreflang": "", "meta": {} } }, "attributes": { "max_upload_size": 123 } } } ``` -------------------------------- ### Create command with Go Source: https://laravel.com/forge/docs/api-reference/commands/create-command Go example using net/http to POST a new command. Constructs a request with the JSON payload and prints the response body. Requires bearer token and valid IDs. ```Go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://forge.laravel.com/api/orgs/{organization}/servers/{server}/sites/{site}/commands" payload := strings.NewReader("{\n \"command\": \"nvm use 22\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") 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)) } ``` -------------------------------- ### 200 response body for get backup Source: https://laravel.com/forge/docs/api-reference/backups/get-backup Example JSON response for a successful (200) get backup request. Contains the backup data with attributes such as status, is_partial, size, and finished_at. ```JSON { "data": { "id": "", "type": "backups", "links": { "self": { "href": "", "rel": "", "describedby": "", "title": "", "type": "", "hreflang": "", "meta": {} } }, "attributes": { "status": "", "is_partial": "", "size": 123, "finished_at": 123 } } } ``` -------------------------------- ### cURL command line request to GET /user Source: https://laravel.com/forge/docs/api-reference/user/get-user Example cURL command to make a GET request to the Forge API /user endpoint. Requires an OAuth access token in the Authorization header. ```bash curl --request GET \ --url https://forge.laravel.com/api/user \ --header 'Authorization: Bearer ' ``` -------------------------------- ### Perform Postgres action - Go Source: https://laravel.com/forge/docs/api-reference/servers/perform-postgres-action Go example using net/http to POST to the endpoint. Reads and prints the response body. ```Go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://forge.laravel.com/api/orgs/{organization}/servers/{server}/services/postgres/actions" payload := strings.NewReader("{}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") 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)) } ``` -------------------------------- ### Go example for updating NPM credentials Source: https://laravel.com/forge/docs/api-reference/sites/update-npm-credentials-for-the-site Uses Go's net/http to send a PUT request with a JSON payload. Prints the response body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://forge.laravel.com/api/orgs/{organization}/servers/{server}/sites/{site}/npm/credentials/{registry}" payload := strings.NewReader("{\n \"registry\": \"\",\n \"token\": \"\",\n \"scopes\": [\n \"\"\n ]\n}") req, _ := http.NewRequest("PUT", url, payload) req.Header.Add("Authorization", "Bearer ") 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)) } ``` -------------------------------- ### 200 response body for get organization Source: https://laravel.com/forge/docs/api-reference/organizations/get-organization Example successful response (200) containing the organization resource data. ```json { "data": { "id": "", "type": "organizations", "links": { "self": { "href": "", "rel": "", "describedby": "", "title": "", "type": "", "hreflang": "", "meta": {} } }, "attributes": { "name": "", "slug": "", "created_at": "2023-11-07T05:31:56Z", "updated_at": "2023-11-07T05:31:56Z" } } } ``` -------------------------------- ### Go request to GET /user Source: https://laravel.com/forge/docs/api-reference/user/get-user Example Go program using net/http to make a GET request to the Forge API /user endpoint. Requires an OAuth access token in the Authorization header. Prints the response body. ```Go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://forge.laravel.com/api/user" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } ``` -------------------------------- ### Go: Get Recipe Run Source: https://laravel.com/forge/docs/api-reference/recipes/get-recipe-run Sends a GET request using the net/http package and prints the response body. Requires an API token. ```Go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://forge.laravel.com/api/orgs/{organization}/recipes/{recipe}/runs/{log}" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } ``` -------------------------------- ### Go: Create NPM credentials Source: https://laravel.com/forge/docs/api-reference/sites/create-npm-credentials-for-the-site Uses net/http to send a POST request with a JSON payload. Requires an API token and the organization, server, and site IDs. Prints the response body. ```Go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://forge.laravel.com/api/orgs/{organization}/servers/{server}/sites/{site}/npm/credentials" payload := strings.NewReader("{\n \"registry\": \"\",\n \"token\": \"\",\n \"scopes\": [\n \"\"\n ]\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") 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)) } ``` -------------------------------- ### JavaScript fetch request to GET /user Source: https://laravel.com/forge/docs/api-reference/user/get-user Example JavaScript code using fetch to make a GET request to the Forge API /user endpoint. Requires an OAuth access token in the Authorization header. Logs the response or error to the console. ```JavaScript const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; fetch('https://forge.laravel.com/api/user', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); ``` -------------------------------- ### Go example for updating .env content Source: https://laravel.com/forge/docs/api-reference/sites/update-env-content Uses the net/http package to send a PUT request. Requires an API token and the organization, server, and site IDs. The request body includes environment, cache, queues, and encryption_key fields. ```Go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://forge.laravel.com/api/orgs/{organization}/servers/{server}/sites/{site}/environment" payload := strings.NewReader("{\n \"environment\": \"\",\n \"cache\": true,\n \"queues\": true,\n \"encryption_key\": \"\"\n}") req, _ := http.NewRequest("PUT", url, payload) req.Header.Add("Authorization", "Bearer ") 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)) } ``` -------------------------------- ### PHP cURL request to GET /user Source: https://laravel.com/forge/docs/api-reference/user/get-user Example PHP script using cURL to make a GET request to the Forge API /user endpoint. Requires an OAuth access token in the Authorization header. Outputs the response or a cURL error. ```PHP "https://forge.laravel.com/api/user", 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 " ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } ``` -------------------------------- ### Response 200: Get server PHP max execution time Source: https://laravel.com/forge/docs/api-reference/servers/get-server-php-max-execution-time Example success response with a JSON object containing the max_execution_time attribute. ```json { "data": { "id": "", "type": "phpMaxExecutionTimes", "links": { "self": { "href": "", "rel": "", "describedby": "", "title": "", "type": "", "hreflang": "", "meta": {} } }, "attributes": { "max_execution_time": 123 } } } ``` -------------------------------- ### Create deployment with Go Source: https://laravel.com/forge/docs/api-reference/deployments/create-deployment Uses Go's net/http package to send a POST request to the deployments endpoint. Requires an Authorization header with a Bearer token. Prints the response body. ```Go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://forge.laravel.com/api/orgs/{organization}/servers/{server}/sites/{site}/deployments" req, _ := http.NewRequest("POST", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } ``` -------------------------------- ### Create Laravel Reverb integration (Go) Source: https://laravel.com/forge/docs/api-reference/integrations/create-laravel-reverb-integration Go example using net/http to POST to the Reverb integration endpoint. Builds a JSON payload and prints the response body. ```Go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://forge.laravel.com/api/orgs/{organization}/servers/{server}/sites/{site}/integrations/reverb" payload := strings.NewReader("{\n \"host\": \"\",\n \"port\": \"\",\n \"connections\": 25000\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") 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)) } ``` -------------------------------- ### Success response for get site redirect rule Source: https://laravel.com/forge/docs/api-reference/redirect-rules/get-site-redirect-rule Example 200 response containing the redirect rule data with attributes such as from, to, type, and status. ```json { "data": { "id": "", "type": "redirect-rules", "links": { "self": { "href": "", "rel": "", "describedby": "", "title": "", "type": "", "hreflang": "", "meta": {} } }, "attributes": { "from": "/old-path", "to": "/new-path", "type": "permanent", "status": "installed", "created_at": "2025-07-29T09:00:00Z", "updated_at": "2025-07-30T09:00:00Z" } } } ``` -------------------------------- ### Go request to list backup configurations Source: https://laravel.com/forge/docs/api-reference/backups/list-backup-configurations Sends a GET request using the net/http package. Prints the response body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://forge.laravel.com/api/orgs/{organization}/servers/{server}/database/backups" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } ``` -------------------------------- ### Get site success response (200) Source: https://laravel.com/forge/docs/api-reference/sites/get-site Example JSON response for a successful request. Contains site attributes, relationships, and included server data. ```json { "data": { "id": "", "type": "sites", "links": { "self": { "href": "", "rel": "", "describedby": "", "title": "", "type": "", "hreflang": "", "meta": {} } }, "attributes": { "name": "", "status": "installed", "url": "", "user": "", "https": true, "web_directory": "", "root_directory": "", "aliases": [ "" ], "php_version": null, "deployment_status": "", "quick_deploy": true, "isolated": true, "shared_paths": {}, "repository": { "provider": "", "url": "", "branch": "", "status": "installed" }, "database": "", "maintenance_mode": { "enabled": true, "status": "disabling" }, "zero_downtime_deployments": true, "deployment_retention": 123, "deployment_script": "", "wildcards": true, "app_type": "Statamic", "uses_envoyer": true, "deployment_url": "", "healthcheck_url": "", "created_at": "2023-11-07T05:31:56Z", "updated_at": "2023-11-07T05:31:56Z" }, "relationships": { "server": { "data": { "type": "servers", "id": "" } }, "tags": { "data": [ { "type": "tags", "id": "" } ] }, "latestDeployment": { "data": { "type": "deployments", "id": "" } }, "securityRules": { "data": [ { "type": "securityRules", "id": "" } ] }, "redirectRules": { "data": [ { "type": "redirect-rules", "id": "" } ] } } }, "included": [ { "id": "", "type": "servers", "links": { "self": { "href": "", "rel": "", "describedby": "", "title": "", "type": "", "hreflang": "", "meta": {} } }, "attributes": { "id": 123, "credential_id": 123, "name": "", "slug": "", "type": "app", "ubuntu_version": "", "ssh_port": 123, "provider": "", "identifier": "", "size": "", "region": "", "php_version": "", "php_cli_version": "", "opcache_status": "", "database_type": "", "db_status": "", "redis_status": "", "ip_address": "", "private_ip_address": "", "revoked": true, "created_at": "2025-07-29T09:00:00Z", "updated_at": "2025-07-30T09:00:00Z", "connection_status": "", "timezone": "", "local_public_key": "", "is_ready": true }, "relationships": { "tags": { "data": [ { "type": "tags", "id": "" } ] } } } ] } ``` -------------------------------- ### Error response (403) for getting a background process Source: https://laravel.com/forge/docs/api-reference/background-processes/get-background-process Example JSON response for a 403 error, indicating forbidden access. Contains a message field. ```JSON { "message": "" } ``` -------------------------------- ### Go: Create domain certificate action Source: https://laravel.com/forge/docs/api-reference/sites/create-domain-certificate-action Sends a POST request using net/http. The action is set to 'enable'. Requires a valid token and the resource IDs. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://forge.laravel.com/api/orgs/{organization}/servers/{server}/sites/{site}/domains/{domainRecord}/certificates/{certificate}/actions" payload := strings.NewReader("{\n \"action\": \"'enable'\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") 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)) } ``` -------------------------------- ### Go: Create site on a load balancer Source: https://laravel.com/forge/docs/api-reference/sites/create-site-on-a-load-balancer Uses net/http to POST to the /sites/balancer endpoint. Requires bearer token and JSON payload with domain and balancing configuration. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://forge.laravel.com/api/orgs/{organization}/servers/{server}/sites/balancer" payload := strings.NewReader("{\n \"domain\": \"\",\n \"allow_wildcard_subdomains\": true,\n \"balancer_keepalive_max_connections\": 128,\n \"balancing\": [\n {\n \"server_id\": 123,\n \"port\": 32768,\n \"weight\": 2,\n \"backup\": true,\n \"down\": true\n }\n ]\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") 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)) } ``` -------------------------------- ### Response 200: Get Server Network Source: https://laravel.com/forge/docs/api-reference/servers/get-server-network Example JSON response for a successful request (HTTP 200). Contains server network data and included tags. ```JSON { "data": [ { "id": "", "type": "servers", "links": { "self": { "href": "", "rel": "", "describedby": "", "title": "", "type": "", "hreflang": "", "meta": {} } }, "attributes": { "id": 123, "credential_id": 123, "name": "", "slug": "", "type": "app", "ubuntu_version": "", "ssh_port": 123, "provider": "", "identifier": "", "size": "", "region": "", "php_version": "", "php_cli_version": "", "opcache_status": "", "database_type": "", "db_status": "", "redis_status": "", "ip_address": "", "private_ip_address": "", "revoked": true, "created_at": "2025-07-29T09:00:00Z", "updated_at": "2025-07-30T09:00:00Z", "connection_status": "", "timezone": "", "local_public_key": "", "is_ready": true }, "relationships": { "tags": { "data": [ { "type": "tags", "id": "" } ] } } } ], "included": [ { "id": "", "type": "tags", "attributes": { "name": "", "created_at": "2025-07-29T09:00:00Z", "updated_at": "2025-07-30T09:00:00Z" } } ] } ``` -------------------------------- ### Go: Create recipe run Source: https://laravel.com/forge/docs/api-reference/recipes/create-recipe-run Go program using net/http to POST to the Forge API. Builds a JSON payload and prints the response body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://forge.laravel.com/api/orgs/{organization}/recipes/{recipe}/runs" payload := strings.NewReader("{\n \"servers\": [\n 1,\n 2,\n 3\n ],\n \"email\": true\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") 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)) } ``` -------------------------------- ### Success response (200) for get PHP CLI config Source: https://laravel.com/forge/docs/api-reference/servers/get-php-version-cli-config Example of a successful response with HTTP status 200. Contains the PHP CLI configuration data. ```json { "data": { "id": "", "type": "phpCliConfigurations", "links": { "self": { "href": "", "rel": "", "describedby": "", "title": "", "type": "", "hreflang": "", "meta": {} } }, "attributes": { "configuration": "" } } } ``` -------------------------------- ### 200 OK response Source: https://laravel.com/forge/docs/api-reference/commands/get-command Example response body for a successful GET request. Contains the command data, including attributes like command, status, exit_code, and relationships. ```json { "data": { "id": "", "type": "commands", "links": { "self": { "href": "", "rel": "", "describedby": "", "title": "", "type": "", "hreflang": "", "meta": {} } }, "attributes": { "command": "nvm use 22", "status": "finished", "exit_code": 0, "error_output": "Tunnel exited with a non-zero code [1].", "duration": "5m", "user_id": 1, "created_at": "2025-07-29T09:00:00Z", "updated_at": "2025-07-29T09:00:00Z" }, "relationships": { "user": { "data": { "type": "users", "id": "" } } } }, "included": [ { "id": "", "type": "users", "links": { "self": { "href": "", "rel": "", "describedby": "", "title": "", "type": "", "hreflang": "", "meta": {} } }, "attributes": { "name": "", "email": "", "created_at": "2023-11-07T05:31:56Z", "updated_at": "2023-11-07T05:31:56Z" } } ] } ``` -------------------------------- ### List servers with Go Source: https://laravel.com/forge/docs/api-reference/servers/list-servers Uses the net/http package to send a GET request. Requires an access token in the Authorization header. Prints the response body. ```Go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://forge.laravel.com/api/orgs/{organization}/servers" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } ``` -------------------------------- ### Create backup with JavaScript fetch Source: https://laravel.com/forge/docs/api-reference/backups/create-backup JavaScript example using fetch to POST to the backup instances endpoint. Requires an access token in the Authorization header. Logs the response or error. ```JavaScript const options = {method: 'POST', headers: {Authorization: 'Bearer '}}; fetch('https://forge.laravel.com/api/orgs/{organization}/servers/{server}/database/backups/{backupConfiguration}/instances', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); ``` -------------------------------- ### GET /orgs/{organization}/servers/{server}/php/versions Source: https://laravel.com/forge/docs/api-reference/servers/list-php-versions-for-server Lists all PHP versions installed on the specified server. This endpoint supports pagination, filtering, and sorting of results. ```APIDOC ## GET /orgs/{organization}/servers/{server}/php/versions ### Description List all PHP versions installed on the server. ### Method GET ### Endpoint https://forge.laravel.com/api/orgs/{organization}/servers/{server}/php/versions ### Parameters #### Path Parameters - **organization** (string) - Required - The organization slug - **server** (integer) - Required - The server ID #### Query Parameters - **page\[size\]** (integer) - Optional - The number of results that will be returned per page. Default: 30 - **page\[cursor\]** (string) - Optional - The cursor to start the pagination from. - **filter\[status\]** (string) - Optional - Filter by status. - **filter\[version\]** (string) - Optional - Filter by version. - **sort** (enum[]) - Optional - Sort results. Available options: `created_at`, `-created_at`, `updated_at`, `-updated_at`, `status`, `-status`, `version`, `-version` #### Authorizations - **Authorization** (string, header) - Required - The access token received from the authorization server in the OAuth 2.0 flow. ### Request Example ``` curl --request GET \ --url https://forge.laravel.com/api/orgs/{organization}/servers/{server}/php/versions \ --header 'Authorization: Bearer ' ``` ### Response #### Success Response (200) - **data** (PhpVersionResource ยท object[]) - Required - List of PHP version resources. - **links** (object) - Required - Pagination links. - **meta** (object) - Required - Pagination metadata. #### Response Example ``` { "data": [ { "id": "", "type": "phpVersions", "links": { "self": { "href": "", "rel": "", "describedby": "", "title": "", "type": "", "hreflang": "", "meta": {} } }, "attributes": { "version": "5.6", "binary_name": "", "status": "", "created_at": "2023-11-07T05:31:56Z", "updated_at": "2023-11-07T05:31:56Z" } } ], "links": { "first": "", "last": "", "prev": "", "next": "" }, "meta": { "path": "", "per_page": 1, "next_cursor": "", "prev_cursor": "" } } ``` #### Error Responses - **403** - Forbidden - Returns a message. - **404** - Not Found - Returns a message. #### Error Response Example ``` { "message": "" } ``` ``` -------------------------------- ### Successful response (200) for get server event Source: https://laravel.com/forge/docs/api-reference/servers/get-server-event Example JSON response for a successful request. Contains event data, links, attributes, and included user information. ```JSON { "data": { "id": "", "type": "events", "links": { "self": { "href": "", "rel": "", "describedby": "", "title": "", "type": "", "hreflang": "", "meta": {} } }, "attributes": { "description": "Adding database", "ran_as": "forge", "created_at": "2025-07-29T09:00:00Z", "updated_at": "2025-07-30T09:00:00Z" }, "relationships": { "site": { "data": { "type": "sites", "id": "" } }, "initiator": { "data": { "type": "users", "id": "" } } } }, "included": [ { "id": "", "type": "users", "links": { "self": { "href": "", "rel": "", "describedby": "", "title": "", "type": "", "hreflang": "", "meta": {} } }, "attributes": { "name": "", "email": "", "created_at": "2023-11-07T05:31:56Z", "updated_at": "2023-11-07T05:31:56Z" } } ] } ``` -------------------------------- ### Go request to list Nginx templates Source: https://laravel.com/forge/docs/api-reference/nginx/list-nginx-templates Uses the net/http package to send a GET request. Requires an access token in the Authorization header. Prints the response body. ```Go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://forge.laravel.com/api/orgs/{organization}/servers/{server}/nginx/templates" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } ``` -------------------------------- ### GET /orgs/{org}/servers/{server}/sites?include=latestDeployment,tags Source: https://laravel.com/forge/docs/api-reference/relationships Include multiple relationships in a response by separating them with a comma. This example includes `latestDeployment` and `tags` for a site. ```APIDOC ## [GET] /orgs/{org}/servers/{server}/sites?include=latestDeployment,tags ### Description Include multiple relationships in a response by separating them with a comma. This example includes `latestDeployment` and `tags` for a site. ### Method GET ### Endpoint /orgs/{org}/servers/{server}/sites?include=latestDeployment,tags ### Parameters #### Query Parameters - **include** (string) - Required - Comma-separated list of relationships to include in the response. Example: `latestDeployment,tags`. ### Response #### Success Response (200) - **relationships** (object) - Contains available relationships for the resource. - **latestDeployment** (object) - The latest deployment relationship. - **tags** (object) - The tags relationship. #### Response Example ```json { "relationships": { "latestDeployment": { "data": {} }, "tags": { "data": [ { "type": "tags", "id": "" } ] } } } ``` ``` -------------------------------- ### List backups with Go Source: https://laravel.com/forge/docs/api-reference/backups/list-backups Sends a GET request using Go's net/http package. Prints the response body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://forge.laravel.com/api/orgs/{organization}/servers/{server}/database/backups/{backupConfiguration}/instances" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } ``` -------------------------------- ### List recipe runs with Go Source: https://laravel.com/forge/docs/api-reference/recipes/list-recipe-runs Sends a GET request using Go's net/http package and prints the response body. Requires an API token and organization/recipe IDs. ```Go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://forge.laravel.com/api/orgs/{organization}/recipes/{recipe}/runs" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } ``` -------------------------------- ### GET /orgs/{org}/servers/{server}?include=tags Source: https://laravel.com/forge/docs/api-reference/relationships Include related resources in a response by using the `include` query parameter. This example includes the `tags` relationship for a server. ```APIDOC ## [GET] /orgs/{org}/servers/{server}?include=tags ### Description Include related resources in a response by using the `include` query parameter. This example includes the `tags` relationship for a server. ### Method GET ### Endpoint /orgs/{org}/servers/{server}?include=tags ### Parameters #### Query Parameters - **include** (string) - Required - Comma-separated list of relationships to include in the response. Example: `tags`. ### Response #### Success Response (200) - **relationships** (object) - Contains available relationships for the resource. - **tags** (object) - The tags relationship. - **data** (array) - Array of related resource identifiers. - **type** (string) - The resource type, e.g., `tags`. - **id** (string) - The resource ID. #### Response Example ```json { "relationships": { "tags": { "data": [ { "type": "tags", "id": "" } ] } } } ``` ``` -------------------------------- ### Go request to get deployment output Source: https://laravel.com/forge/docs/api-reference/deployments/get-deployment-output Uses Go's net/http package to send a GET request to the deployment log endpoint. Requires an access token in the Authorization header. Prints the response body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://forge.laravel.com/api/orgs/{organization}/servers/{server}/sites/{site}/deployments/{deployment}/log" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } ``` -------------------------------- ### 200 Success response for get provider Source: https://laravel.com/forge/docs/api-reference/providers/get-provider Example JSON response for a successful request (HTTP 200). Contains the provider resource with attributes like name, slug, and currency. ```json { "data": { "id": "", "type": "providers", "links": { "self": { "href": "", "rel": "", "describedby": "", "title": "", "type": "", "hreflang": "", "meta": {} } }, "attributes": { "name": "", "slug": "", "simple_name": "", "currency": "", "currency_symbol": "", "default_size_code": "", "default_region_code": "" } } } ``` -------------------------------- ### 200 response body for get site webhook Source: https://laravel.com/forge/docs/api-reference/deployments/get-site-webhook Example JSON response for a successful request (200). Contains the deployment webhook data with attributes like url and timestamps. ```json { "data": { "id": "", "type": "deploymentWebhooks", "links": { "self": { "href": "", "rel": "", "describedby": "", "title": "", "type": "", "hreflang": "", "meta": {} } }, "attributes": { "url": "", "created_at": "2025-07-29T09:00:00Z", "updated_at": "2025-07-30T09:00:00Z" } } } ``` -------------------------------- ### Go: Get Deploy Key Source: https://laravel.com/forge/docs/api-reference/deployments/get-deploy-key Uses net/http to send a GET request to the deploy-key endpoint. Requires an API token and the organization, server, and site IDs. Prints the response body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://forge.laravel.com/api/orgs/{organization}/servers/{server}/sites/{site}/deploy-key" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } ```