POST /environments
Create a new environment for the current organization.

Authentication

API Key (header: X-API-Key) API Key (cookie: better-auth.session_token)

Request Body required

Request body

application/json
name string REQUIRED
Environment name
slug string REQUIRED
URL-safe slug

Responses

201 Created environment
application/json
environment object REQUIRED
id string REQUIRED
org_id string REQUIRED
name string REQUIRED
slug string REQUIRED
created_at string REQUIRED
400 Validation error
401 Unauthorized
403 Plan limit reached
curl -X POST 'https://hookstream.io/v1/environments' \  -H 'Authorization: Bearer YOUR_API_TOKEN' \  -H 'Content-Type: application/json' \  -d '{  "name": "Staging",  "slug": "staging"}'
const response = await fetch('https://hookstream.io/v1/environments', {  method: 'POST',  headers: {      "Authorization": "Bearer YOUR_API_TOKEN",      "Content-Type": "application/json"  },  body: JSON.stringify({    "name": "Staging",    "slug": "staging"  })});const data = await response.json();console.log(data);
import requestsheaders = {    'Authorization': 'Bearer YOUR_API_TOKEN'}response = requests.post('https://hookstream.io/v1/environments', headers=headers, json={  "name": "Staging",  "slug": "staging"})print(response.json())
package mainimport (	"fmt"	"io"	"net/http"	"strings")func main() {	body := strings.NewReader(`{  "name": "Staging",  "slug": "staging"}`)	req, _ := http.NewRequest("POST", "https://hookstream.io/v1/environments", body)	req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN")	req.Header.Set("Content-Type", "application/json")	resp, _ := http.DefaultClient.Do(req)	defer resp.Body.Close()	result, _ := io.ReadAll(resp.Body)	fmt.Println(string(result))}
201 Response
{  "environment": {    "id": "<string>",    "org_id": "<string>",    "name": "<string>",    "slug": "<string>",    "created_at": "<string>"  }}