Create

  • POST
  • /workspaces
  • /:workspace
  • /projects
  • /:project_name
  • /environments

Creates a new environment in the project.

Request

REQUIRED SCOPES
WORKSPACE, ENVIRONMENT_ADD
URL PARAMETERS
workspacerequired string
The workspace domain.
project_namerequired string
The name ID of the project.
POST PARAMETERS
namerequired string
The name of the environment.
identifierrequired string
Readable ID for environment. It can consist of uppercase and lowercase letters, numbers, and underscores. It must start with a letter. If not provided, the same one will be set as the generated hash_id.
typerequired string
The type of the environment. Available values: DEV, STAGE, PRODUCTION.
public_urlstring
The public URL for the environment.
tagsstring[]
A list of tags.
variablesvariable[]
Define to set variables for the environment.
permissionspermission[]
Define to set permissions for the environment.
all_pipelines_allowedboolean
Defines whether all pipelines are allowed to use the environment.
allowed_pipelinesPipeline[]
Defines an object with the property 'id' for pipelines that can use this environment.

Last modified on Mar 3, 2025

Example:

curl -X POST "https://api.buddy.works/workspaces/:workspace/projects/:project_name/environments" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "Content-Type: application/json" \
-d '{
  "identifier": "stage_env",
  "name": "Staging environment",
  "type": "STAGE",
  "tags": [
    "staging",
    "tag1"
  ],
  "public_url": "http://staging.com",
  "variables": [
    {
      "key": "myVar1",
      "value": "myValue1",
      "type": "VAR",
      "settable": true,
      "encrypted": false,
      "description": "some variable1"
    },
    {
      "key": "myVar2",
      "value": "myValue2",
      "type": "VAR",
      "settable": true,
      "encrypted": false,
      "description": "some variable2"
    }
  ],
  "permissions": {
    "others": "DENIED",
    "users": [
      {
        "id": 1,
        "access_level": "MANAGE"
      }
    ],
    "groups": [
      {
        "id": 2,
        "access_level": "USE_ONLY"
      }
    ]
  },
  "all_pipelines_allowed": false,
  "allowed_pipelines": [
    {
      "id": 1
    }
  ]
}'
EXAMPLE RESPONSE
{ "url": "https://api.buddy.works/workspaces/buddy/projects/company-website", "html_url": "https://app.buddy.works/buddy/company-website/environments/environment/9DBbgP4q", "id": "9DBbgP4q", "name": "Staging environment", "identifier": "stage_env", "type": "STAGE", "tags": [ "staging", "tag1" ], "public_url": "http://staging.com", "all_pipelines_allowed": false, "allowed_pipelines": [ { "url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/1", "html_url": "https://app.buddy.works/buddy/company-website/pipelines/pipeline/1", "id": 1, "name": "Tests" } ], "project": { "url": "https://api.buddy.works/workspaces/buddy/projects/company-website", "html_url": "https://app.buddy.works/buddy/company-website", "name": "company-website", "display_name": "Company Website", "status": "ACTIVE" }, "variables": [ { "id": 1, "key": "myVar1", "value": "myValue1", "type": "VAR", "settable": true, "description": "some variable1" }, { "id": 2, "key": "myVar2", "value": "myValue2", "type": "VAR", "settable": true, "description": "some variable2" } ], "permissions": { "others": "DENIED", "users": [ { "id": 1, "access_level": "MANAGE" } ], "groups": [ { "id": 422, "access_level": "USE_ONLY" } ] } }
STATUS
201 Created
LIMITS
X-Rate-Limit-Limit: 1 X-Rate-Limit-Remaining: 999