Skip to content

Create a new environment

POST
/api/v1/environment
curl --request POST \
--url https://app.prefactorai.com/api/v1/environment \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "account_id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny", "description": null, "external_identifier": "env-abc123", "id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny", "name": "example", "purpose": "development" }'
Environment_DetailsForCreate
object
account_id
Account_Id

A valid account ID

string
Example
013xrzp12g3nqk8ns6jadrqmpgrjkeny
description
One of:

Optional free-form description

string
external_identifier
One of:

Optional external identifier for this environment in an external system (unique per account)

string
Example
env-abc123
id
One of:
Environment_Id

A valid environment ID

string
Example
013xrzp12g3nqk8ns6jadrqmpgrjkeny
name
string
purpose

Environment purpose

string
Allowed values: development staging testing production
Example
development

Success

Media typeapplication/json
object
details
required
Environment_Details
object
account_id
required
Account_Id

A valid account ID

string
description
required
One of:

Optional free-form description

string
external_identifier
required
One of:

External identifier for this environment in an external system (unique per account)

string
id
required
Environment_Id

A valid environment ID

string
name
required

Environment name

string
purpose
required

Environment purpose

string
Allowed values: development staging testing production
type
required

Type of resource (always ‘environment’)

string
Allowed values: environment
status
required
string
Allowed values: success
Example
{
"details": {
"account_id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny",
"description": null,
"external_identifier": "env-abc123",
"id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny",
"name": "Development",
"purpose": "development",
"type": "environment"
},
"status": "success"
}

Error

Media typeapplication/json
One of:
object
code
required
string
Allowed values: bad_request bad_authtoken not_authenticated not_permitted not_implemented unknown not_found unexpected_ref_type unexpected invalid_action alert_unknown alert_already_cleared invalid_value required_value idempotency_key_already_used temporarily_unavailable conflict
message
required
string
status
required
string
Allowed values: error
Example
{
"code": "bad_request",
"status": "error"
}