Environment variables via API


Being able to create sites via API is nice but not having the possibility to setup environment variables makes it pretty useless. Is this something in the making? I haven’t found anything about environement variables in the API docs.


perhaps this can help you???


Thanks but your are referencing to the CLI and I’m referencing to the API.

This article is the one you’ll want to read to understand how to accomplish this:

There is no specific API call to set variables; it’s part of site config. Watching our UI do it will show you the call and the data shape needed :slight_smile:

1 Like

For folks following along on this thread, our Docs team has added the specific API operations that set environment variables for a site on Netlify:

PATCH /api/v1/sites/{site_id} updates some attributes on a site.

PUT /api/v1/sites/{site_id} updates some attributes on a site.