# Deployment Tracking With HTTP Request

This endpoint enables the creation of a deployment for a specific organization. It accepts various parameters to define the deployment details such as title, branch, commit ID, etc.

```
POST https://api.iftrue.co/v1/organization/deployment
```

#### Request Body

| title                 | string  | **Yes**                  | Title of the deployment.                                                                                                     |              |
| --------------------- | ------- | ------------------------ | ---------------------------------------------------------------------------------------------------------------------------- | ------------ |
| changelog             | string  | No                       | Changelog content for the deployment.                                                                                        |              |
| url                   | string  | No                       | The link to reach details of the deployment, eg: Github Releases                                                             |              |
| branch                | string  | **Yes**                  | Name of the branch that merged to production branch                                                                          |              |
| commit\_id            | string  | **Yes**                  | last commit id of the commits pushed for that deployment.                                                                    |              |
| deployment\_duration  | number  | No                       | Time takes to create the deployment, in minutes.                                                                             |              |
| is\_fix               | boolean | No                       | If the deployment contains bug fixes that are not urgent (will affect mean time to recover and change failure rate.)         | **`false`**  |
| is\_hotfix            | boolean | No                       | If the deployment solely made to fix immediate bug in production (will affect mean time to recover and change failure rate.) | **`false`**  |
| is\_forced            | boolean | No                       | if the deployment has been forced by someone.                                                                                | **`false`**  |
| commits\_count        | number  | No                       | Number of commits included in the deployment.                                                                                | **`0`**      |
| repository\_url       | string  | **Yes**                  | URL of the repository.                                                                                                       |              |
| member\_id            | string  | **Yes**                  | ID of the external member initiating the deployment.                                                                         |              |
| pull\_request\_number | number  | **Yes**                  | Number of the associated pull request.                                                                                       |              |
| deployment\_node\_id  | string  | No (Required for GitHub) | The deployment id that git provider of choice assigned.                                                                      |              |
| status                | enum    | No                       | Status of the deployment. Possible values: **`succes`**, **`in_progress`**, **`fail`**.                                      | **`succes`** |

#### Response

Upon successful creation of the deployment, the response will contain the details of the created deployment.

| Field                | Type      | Description                                                            |
| -------------------- | --------- | ---------------------------------------------------------------------- |
| id                   | uuid      | Unique identifier for the deployment.                                  |
| triggered\_by        | enum      | Trigger type of the deployment.                                        |
| title                | string    | Title of the deployment.                                               |
| changelog            | string    | Changelog for the deployment.                                          |
| is\_hotfix           | boolean   | Indicates whether it is a hotfix.                                      |
| is\_forced           | boolean   | Indicates whether it is a forced deployment.                           |
| commits\_count       | number    | Number of commits included in the deployment.                          |
| organization\_id     | uuid      | ID of the organization associated with the deployment.                 |
| repository\_id       | uuid      | ID of the repository associated with the deployment.                   |
| pusher\_id           | uuid      | ID of the member initiating the deployment.                            |
| created\_at          | timestamp | Date and time when the deployment was created.                         |
| updated\_at          | timestamp | Date and time when the deployment was last updated.                    |
| status               | enum      | Status of the deployment. Possible values: succes, in\_progress, fail. |
| url                  | string    | URL related to the deployment.                                         |
| branch               | string    | Branch name for the deployment.                                        |
| commit\_id           | string    | ID of the commit.                                                      |
| deployment\_duration | number    | Duration of the deployment in seconds.                                 |
| node\_id             | string    | ID of the deployment node.                                             |
| is\_fix              | boolean   | Indicates whether it is a fix.                                         |

#### Default Values

| Field          | Default Value |
| -------------- | ------------- |
| is\_fix        | false         |
| is\_hotfix     | false         |
| is\_forced     | false         |
| commits\_count | 0             |
| status         | succes        |

#### **Response**

Upon successful creation of the deployment, the endpoint returns a deployment record.

#### **Authorization**

This endpoint requires JWT authorization. The JWT token should be included in the request header. You can get token from the **iftrue** team.

#### **Example Request**

```json
POST /v1/organization/deployment HTTP/1.1
Host: API_URL
Authorization: Bearer <JWT_TOKEN>
Content-Type: application/json

{
	"title": "New Deployment",
	"changelog": "#241 PR Merged",
	"url": "<https://github.com/example>",
	"branch": "master",
	"commit_id": "fa9bce58bac99d1186f00d90881dd7b1e7a3acfd",
	"deployment_duration": 1220,
	"is_fix": true,
	"is_hotfix": false,
	"is_forced": true,
	"commits_count": 5,
	"member_id": "aef23f76-9e33-679d-a92c-ff7321f61bb8",
	"pull_request_number": 241,
	"repository_url": "<https://github.com/example/repo>",
	"deployment_node_id": "sw52f5ff5ddf66=",
	"status": "succes"
}

```

#### **Example Response**

```json
{
  "id": "......",
  "triggered_by": "webhook",
  "title": "New Deploy",
  "changelog": "#222 PR Merged",
  "is_hotfix": false,
  "is_forced": false,
  "is_fix": false,
  "commits_count": 5,
  "organization_id": "......",
  "repository_id": "......",
  "pusher_id": "......",
  "url": "......",
  "branch": "master",
  "commit_id": "..sha..",
  "deployment_duration": 10,
  "node_id": "...",
  "status": "fail"
}
```

***

This documentation provides detailed information on how to use the API along with an example request and response. If you encounter any issues or need further assistance, please feel free to email us at:

[**hackers@iftrue.co**](mailto:hackers@iftrue.co)


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.iftrue.co/getting-started/basics/repository-settings/deployment-tracking-with-http-request.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
