Skip to main content
POST
/
environments
/
{environment}
/
variables
Add environment variables
curl --request POST \
  --url https://cloud.laravel.com/api/environments/{environment}/variables \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "method": "append",
  "variables": [
    {
      "key": "<string>",
      "value": "<string>"
    }
  ]
}
'
{
  "data": {
    "id": "<string>",
    "type": "environments",
    "links": {
      "self": {
        "href": "<string>",
        "rel": "<string>",
        "describedby": "<string>",
        "title": "<string>",
        "type": "<string>",
        "hreflang": "<string>",
        "meta": {}
      }
    },
    "relationships": {}
  },
  "included": [
    {
      "id": "<string>",
      "type": "applications",
      "relationships": {}
    }
  ]
}

Authorizations

Authorization
string
header
required

The Bearer Token generated on the Cloud UI.

Path Parameters

environment
string
required

The environment identifier

Body

application/json
method
enum<string>
required

When set to 'append', variables are added to the end without checking for duplicates. When set to 'replace', variables with matching keys are updated; otherwise they are added.

Available options:
append,
set
variables
object[]
required
Required array length: 1 - 200 elements

Response

EnvironmentResource

data
EnvironmentResource · object
required
included
(ApplicationResource · object | BranchResource · object | DeploymentResource · object | DomainResource · object | InstanceResource · object)[]