> For the complete documentation index, see [llms.txt](https://docs.release.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.release.com/reference-documentation/release-api/environments-api/environments-create-api.md).

# Create

## Create An Ephemeral Environment

<mark style="color:green;">`POST`</mark> `https://api.releasehub.com/api/apps/:app_id/environments/`

Add creating a Release Ephemeral Environment to your existing pipelines. By passing in the app you want to create the environment for and the Docker images to to use, you have full control over what is created. Additionally by adding a branch, you're able to continually update the same environment as you push code changes. A Build object will be created upon a successful request and the optional parameters help to fill in data that the Release build system returns. Without the optional data you may find it hard to determine what code is actually running on your environment.

#### Path Parameters

| Name    | Type    | Description    |
| ------- | ------- | -------------- |
| app\_id | integer | Release App ID |

#### Headers

| Name            | Type    | Description          |
| --------------- | ------- | -------------------- |
| X-Account-ID    | integer | Account ID           |
| X-Account-Token | string  | Authentication token |

#### Request Body

| Name            | Type   | Description                                                                                                                                   |
| --------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
| branch          | string | Git branch name                                                                                                                               |
| services        | object | Object in the form of {service\_name: image\_name}                                                                                            |
| commit\_short   | string | Shortened version of a commit sha, usually seven characters                                                                                   |
| commit\_long    | string | Full commit sha                                                                                                                               |
| committer       | string | Email of the person who created the commit                                                                                                    |
| commit\_message | string | Message used for the commit                                                                                                                   |
| commit\_date    | string | <p>Time the commit happened at in the form</p><p>\</p></p><p>"YYYY-MM-DD HH:MM:SS -0700". "-0700" is used as an example time zone offset.</p> |
| logs            | array  | <p>Array of objects in the form of</p><p>\</p></p><p>{level: "info"</p>                                                                       |

{% tabs %}
{% tab title="200 Environment Successfully Created or Updated" %}

```
{"message": "Successfully created|updated Environment"}
```

{% endtab %}
{% endtabs %}

{% swagger-response status="404" description="If an App cannot be found with the given app\_id, a Not Found will be returned. {"error": "Could not find app with id 0"}If a User cannot be found to authenticate either from the committer email or from the App's owner, a Not Found will be returned. {"error": "No user found"}" %}

```
{"error": "message"}
```

The following is an example payload with images stored in ECR

```
{
  "app_id": 1,
  "branch": "auth_test",
  "services": {
    "web": "123.dkr.ecr.us-west-2.amazonaws.com/releaseappuser/test_repo/web:9106aa52e16981a062676f0f5cf7a0ce3ebf00c0",
    "sidekiq": "123.dkr.ecr.us-west-2.amazonaws.com/releaseappuser/test_repo/sidekiq:9106aa52e16981a062676f0f5cf7a0ce3ebf00c0"
  },
  "committer": "releaseappuser@releaseapp.io",
  "commit_message": "testing_message",
  "commit_date": "2020-04-10 13:27:16 -0700",
  "commit_short": "9106aa5",
  "commit_long": "9106aa52e16981a062676f0f5cf7a0ce3ebf00c0",
  "logs": [{level: "info", message: "testing"}, {level: "info", message: "the api"}],
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.release.com/reference-documentation/release-api/environments-api/environments-create-api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
