How am I supposed to set up env variables over API?

Hi, @Goues. My recommendation on this comes from our support guide below about working with API:

The advice is summarized as:

  • make the change in our web UI and examine the network tab in devtools to see the exact format that is used there

For example, when I add an environment variable, this is the format of the JSON sent:

[
  {
    "key": "EXAMPLE",
    "scopes": [
      "builds",
      "functions",
      "runtime",
      "post_processing"
    ],
    "values": [
      {
        "context": "production",
        "value": "this is production"
      },
      {
        "context": "deploy-preview",
        "value": "this is a deploy preview"
      },
      {
        "context": "branch-deploy",
        "value": "this is a branch deploy"
      },
      {
        "context": "dev",
        "value": "this is the CLI tool"
      }
    ]
  }
]

It can be set in a single API call using the format above. Please reply anytime if there are other questions.