Skip to main content
The Environments API allows you to programmatically create and delete environments within your applications.

Create Environment

endpoint
Create a new environment for an application.
Requires an application or team level API key.

Request Body

number
required
The application ID
string
required
The environment name
string
required
The default Git branch for this environment
boolean
default:"false"
Enable automatic deployments
boolean
default:"false"
Automatically publish new deployments
string
The build command (e.g., “npm run build”)
string
The output folder containing build assets
object
Environment variables as key-value pairs
string
The folder containing serverless API functions
string
Regex/glob pattern to filter branches for auto-deployment
string
Regex/glob pattern to filter commits for auto-deployment
string
Custom error page file path (must be in distFolder)
string
Path to custom headers file
string
Path to custom redirects file
Enable preview links on pull/merge requests
string
Server command for running the application (self-hosted only)
array
Post-deployment status check commands
array
Array of redirect rules (see Redirects API)

Response

string
The ID of the newly created environment

Delete Environment

endpoint
Delete an environment by its ID.

Query Parameters

string
required
The environment ID to delete

Response

boolean
Whether the deletion was successful

Environment Configuration

Environments in Stormkit support various configuration options:

Auto-Deploy Settings

Control which branches and commits trigger automatic deployments:
  • autoDeployBranches: Use glob patterns like feature/* or regex patterns to match branch names
  • autoDeployCommits: Filter commits by message pattern

Build Configuration

  • buildCmd: The command executed during the build phase
  • distFolder: Where your static assets are output after build
  • apiFolder: Location of serverless functions

Custom Files

  • errorFile: Custom 404/error page
  • headersFile: Custom HTTP headers configuration
  • redirectsFile: Custom redirects and rewrites
For detailed information about redirects and path rewrites, see the Redirects API documentation.