---
title: Créer une branche de demande de modification
description: Créer une nouvelle branche dans un référentiel pour une demande de modification.
breadcrumbs: Documentation > API > Créer une branche de demande de modification
---

> For the complete documentation index, see [llms.txt](https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/llms.txt).

# Créer une branche de demande de modification

## v2 (latest)

{% alert level="warning" %}
**Note**: This endpoint is in preview and is subject to change.
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help.md).
{% /alert %}

| Datadog site      | API endpoint                                                                                          |
| ----------------- | ----------------------------------------------------------------------------------------------------- |
| app.datadoghq.com | POST https://api.datadoghq.com/api/v2/change-management/change-request/{change_request_id}/branch     |
| us3.datadoghq.com | POST https://api.us3.datadoghq.com/api/v2/change-management/change-request/{change_request_id}/branch |
| us5.datadoghq.com | POST https://api.us5.datadoghq.com/api/v2/change-management/change-request/{change_request_id}/branch |
| app.datadoghq.eu  | POST https://api.datadoghq.eu/api/v2/change-management/change-request/{change_request_id}/branch      |
| ap1.datadoghq.com | POST https://api.ap1.datadoghq.com/api/v2/change-management/change-request/{change_request_id}/branch |
| ap2.datadoghq.com | POST https://api.ap2.datadoghq.com/api/v2/change-management/change-request/{change_request_id}/branch |
| uk1.datadoghq.com | POST https://api.uk1.datadoghq.com/api/v2/change-management/change-request/{change_request_id}/branch |
| app.ddog-gov.com  | POST https://api.ddog-gov.com/api/v2/change-management/change-request/{change_request_id}/branch      |
| us2.ddog-gov.com  | POST https://api.us2.ddog-gov.com/api/v2/change-management/change-request/{change_request_id}/branch  |

### Overview

Créer une nouvelle branche dans un référentiel pour une demande de modification.

OAuth apps require the `cases_write` authorization [scope](https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/fr/api/latest/scopes.md#change-management) to access this endpoint.

### Arguments

#### Path Parameters

| Field                          | Type   | Description                           |
| ------------------------------ | ------ | ------------------------------------- |
| change_request_id [*required*] | string | The identifier of the change request. |

### Request

#### Body Data (required)

Charge utile de création de branche.

{% tabs %}
{% tab label="Model" %}
| Parent field | Field                    | Type   | Description                                                                        |
| ------------ | ------------------------ | ------ | ---------------------------------------------------------------------------------- |
|              | data [*required*]        | object | Objet de requête pour la création d'une branche pour une demande de modification.  |
| data         | attributes [*required*]  | object | Attributes for creating a change request branch.                                   |
| attributes   | branch_name [*required*] | string | The name of the branch to create.                                                  |
| attributes   | repo_id [*required*]     | string | The repository identifier in the format owner/repository.                          |
| data         | type [*required*]        | enum   | Change request branch resource type. Allowed enum values: `change_request_branch`. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": {
    "attributes": {
      "branch_name": "chm/CHM-1234",
      "repo_id": "DataDog/dd-source"
    },
    "type": "change_request_branch"
  }
}
```
{% /tab %}
{% /tabs %}

### Response

{% tabs %}
{% tab label="200" %}
OK

{% tabs %}
{% tab label="Model" %}
Response object for a change request.

| Parent field             | Field                                                | Type      | Description                                                                                        |
| ------------------------ | ---------------------------------------------------- | --------- | -------------------------------------------------------------------------------------------------- |
|                          | data [*required*]                                    | object    | Data object for a change request response.                                                         |
| data                     | attributes [*required*]                              | object    | Attributes of a change request response.                                                           |
| attributes               | archived_at                                          | date-time | Timestamp of when the change request was archived. Read-only.                                      |
| attributes               | attributes [*required*]                              | object    | Custom attributes of the change request as key-value pairs.                                        |
| additionalProperties     | <any-key>                                            | [string]  |                                                                                                    |
| attributes               | change_request_linked_incident_uuid [*required*]     | string    | The UUID of the linked incident.                                                                   |
| attributes               | change_request_maintenance_window_query [*required*] | string    | The maintenance window query for the change request.                                               |
| attributes               | change_request_plan [*required*]                     | string    | The plan associated with the change request.                                                       |
| attributes               | change_request_risk [*required*]                     | enum      | The risk level of the change request. Allowed enum values: `UNDEFINED`, `LOW`, `MEDIUM`, `HIGH`.   |
| attributes               | change_request_type [*required*]                     | enum      | The type of the change request. Allowed enum values: `NORMAL`, `STANDARD`, `EMERGENCY`.            |
| attributes               | closed_at                                            | date-time | Timestamp of when the change request was closed. Read-only.                                        |
| attributes               | created_at [*required*]                              | date-time | Timestamp of when the change request was created. Read-only.                                       |
| attributes               | creation_source [*required*]                         | string    | The source from which the change request was created.                                              |
| attributes               | description [*required*]                             | string    | The description of the change request.                                                             |
| attributes               | end_date                                             | date-time | The planned end date of the change request.                                                        |
| attributes               | key [*required*]                                     | string    | The human-readable key of the change request.                                                      |
| attributes               | modified_at [*required*]                             | date-time | Timestamp of when the change request was last modified. Read-only.                                 |
| attributes               | plan_notebook_id [*required*]                        | int64     | The notebook ID associated with the change request plan.                                           |
| attributes               | priority [*required*]                                | string    | The priority of the change request.                                                                |
| attributes               | project_id [*required*]                              | string    | The project UUID associated with the change request.                                               |
| attributes               | start_date                                           | date-time | The planned start date of the change request.                                                      |
| attributes               | status [*required*]                                  | string    | The current status of the change request.                                                          |
| attributes               | title [*required*]                                   | string    | The title of the change request.                                                                   |
| attributes               | type [*required*]                                    | string    | The case type.                                                                                     |
| data                     | id [*required*]                                      | string    | The identifier of the change request.                                                              |
| data                     | relationships                                        | object    | Relationships of a change request.                                                                 |
| relationships            | change_request_decisions [*required*]                | object    | Relationship to change request decisions.                                                          |
| change_request_decisions | data [*required*]                                    | [object]  | Array of decision relationship data.                                                               |
| data                     | id [*required*]                                      | string    | The decision UUID.                                                                                 |
| data                     | type [*required*]                                    | enum      | Change request decision resource type. Allowed enum values: `change_request_decision`.             |
| relationships            | created_by [*required*]                              | object    | Relationship to a user.                                                                            |
| created_by               | data [*required*]                                    | object    | User relationship data.                                                                            |
| data                     | id [*required*]                                      | string    | The user UUID.                                                                                     |
| data                     | type [*required*]                                    | string    | The user resource type.                                                                            |
| relationships            | modified_by [*required*]                             | object    | Relationship to a user.                                                                            |
| modified_by              | data [*required*]                                    | object    | User relationship data.                                                                            |
| data                     | id [*required*]                                      | string    | The user UUID.                                                                                     |
| data                     | type [*required*]                                    | string    | The user resource type.                                                                            |
| data                     | type [*required*]                                    | enum      | Change request resource type. Allowed enum values: `change_request`.                               |
|                          | included                                             | [<oneOf>] | Included resources related to the change request.                                                  |
| included                 | Object 1                                             | object    | An included user resource.                                                                         |
| Object 1                 | attributes [*required*]                              | object    | Attributes of an included user.                                                                    |
| attributes               | email [*required*]                                   | string    | The email of the user.                                                                             |
| attributes               | handle [*required*]                                  | string    | The handle of the user.                                                                            |
| attributes               | name [*required*]                                    | string    | The name of the user.                                                                              |
| Object 1                 | id [*required*]                                      | string    | The user UUID.                                                                                     |
| Object 1                 | type [*required*]                                    | string    | The resource type.                                                                                 |
| included                 | Object 2                                             | object    | An included change request decision resource.                                                      |
| Object 2                 | attributes [*required*]                              | object    | Attributes of a change request decision in a response.                                             |
| attributes               | change_request_status [*required*]                   | enum      | The status of a change request decision. Allowed enum values: `REQUESTED`, `APPROVED`, `DECLINED`. |
| attributes               | decided_at [*required*]                              | date-time | Timestamp of when the decision was made.                                                           |
| attributes               | decision_reason [*required*]                         | string    | The reason for the decision.                                                                       |
| attributes               | deleted_at [*required*]                              | date-time | Timestamp of when the decision was deleted.                                                        |
| attributes               | request_reason [*required*]                          | string    | The reason for requesting the decision.                                                            |
| attributes               | requested_at [*required*]                            | date-time | Timestamp of when the decision was requested.                                                      |
| Object 2                 | id [*required*]                                      | string    | The decision UUID.                                                                                 |
| Object 2                 | relationships                                        | object    | Relationships of a change request decision.                                                        |
| relationships            | modified_by [*required*]                             | object    | Relationship to a user.                                                                            |
| modified_by              | data [*required*]                                    | object    | User relationship data.                                                                            |
| data                     | id [*required*]                                      | string    | The user UUID.                                                                                     |
| data                     | type [*required*]                                    | string    | The user resource type.                                                                            |
| relationships            | requested_by_user [*required*]                       | object    | Relationship to a user.                                                                            |
| requested_by_user        | data [*required*]                                    | object    | User relationship data.                                                                            |
| data                     | id [*required*]                                      | string    | The user UUID.                                                                                     |
| data                     | type [*required*]                                    | string    | The user resource type.                                                                            |
| relationships            | requested_user [*required*]                          | object    | Relationship to a user.                                                                            |
| requested_user           | data [*required*]                                    | object    | User relationship data.                                                                            |
| data                     | id [*required*]                                      | string    | The user UUID.                                                                                     |
| data                     | type [*required*]                                    | string    | The user resource type.                                                                            |
| Object 2                 | type [*required*]                                    | enum      | Change request decision resource type. Allowed enum values: `change_request_decision`.             |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": {
    "attributes": {
      "archived_at": "2019-09-19T10:00:00.000Z",
      "attributes": {
        "<any-key>": []
      },
      "change_request_linked_incident_uuid": "",
      "change_request_maintenance_window_query": "",
      "change_request_plan": "",
      "change_request_risk": "LOW",
      "change_request_type": "NORMAL",
      "closed_at": "2019-09-19T10:00:00.000Z",
      "created_at": "2024-01-01T00:00:00Z",
      "creation_source": "CS_MANUAL",
      "description": "Deploying new payment service v2.1",
      "end_date": "2024-01-02T15:00:00Z",
      "key": "CHM-1234",
      "modified_at": "2024-01-01T00:00:00Z",
      "plan_notebook_id": 0,
      "priority": "NOT_DEFINED",
      "project_id": "d4bbe1af-f36e-42f1-87c1-493ca35c320e",
      "start_date": "2024-01-01T03:00:00Z",
      "status": "OPEN",
      "title": "Deploy new payment service",
      "type": "CHANGE_REQUEST"
    },
    "id": "CHM-1234",
    "relationships": {
      "change_request_decisions": {
        "data": [
          {
            "id": "decision-id-0",
            "type": "change_request_decision"
          }
        ]
      },
      "created_by": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000000",
          "type": "user"
        }
      },
      "modified_by": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000000",
          "type": "user"
        }
      }
    },
    "type": "change_request"
  },
  "included": [
    {
      "attributes": {
        "email": "john.doe@example.com",
        "handle": "john.doe@example.com",
        "name": "John Doe"
      },
      "id": "00000000-0000-0000-0000-000000000000",
      "type": "user"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="400" %}
Bad Request

{% tabs %}
{% tab label="Model" %}
API error response.

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="404" %}
Not Found

{% tabs %}
{% tab label="Model" %}
API error response.

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="429" %}
Too many requests

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}
{% /tabs %}

### Code Example

{% tabs %}
{% tab label="Curl" %}
```bash
# Path parameters
export change_request_id="CHM-1234"

# Set your Datadog site and credentials
export DD_SITE="datadoghq.com" # Or us3.datadoghq.com, us5.datadoghq.com, datadoghq.eu, ap1.datadoghq.com, ap2.datadoghq.com, uk1.datadoghq.com, ddog-gov.com, us2.ddog-gov.com
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/change-management/change-request/${change_request_id}/branch" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "branch_name": "chm/CHM-1234",
      "repo_id": "DataDog/test-repo"
    },
    "type": "change_request_branch"
  }
}
EOF
```
{% /tab %}

{% tab label="Go" %}
```go
// Create a change request branch returns "OK" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	body := datadogV2.ChangeRequestBranchCreateRequest{
		Data: datadogV2.ChangeRequestBranchCreateData{
			Attributes: datadogV2.ChangeRequestBranchCreateAttributes{
				BranchName: "chm/CHM-1234",
				RepoId:     "DataDog/dd-source",
			},
			Type: datadogV2.CHANGEREQUESTBRANCHRESOURCETYPE_CHANGE_REQUEST_BRANCH,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
	configuration := datadog.NewConfiguration()
	configuration.SetUnstableOperationEnabled("v2.CreateChangeRequestBranch", true)
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewChangeManagementApi(apiClient)
	resp, r, err := api.CreateChangeRequestBranch(ctx, "change_request_id", body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `ChangeManagementApi.CreateChangeRequestBranch`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `ChangeManagementApi.CreateChangeRequestBranch`:\n%s\n", responseContent)
}
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=go) and then save the example to `main.go` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"
```
{% /tab %}

{% tab label="Java" %}
```java
// Create a change request branch returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.ChangeManagementApi;
import com.datadog.api.client.v2.model.ChangeRequestBranchCreateAttributes;
import com.datadog.api.client.v2.model.ChangeRequestBranchCreateData;
import com.datadog.api.client.v2.model.ChangeRequestBranchCreateRequest;
import com.datadog.api.client.v2.model.ChangeRequestBranchResourceType;
import com.datadog.api.client.v2.model.ChangeRequestResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
    defaultClient.setUnstableOperationEnabled("v2.createChangeRequestBranch", true);
    ChangeManagementApi apiInstance = new ChangeManagementApi(defaultClient);

    ChangeRequestBranchCreateRequest body =
        new ChangeRequestBranchCreateRequest()
            .data(
                new ChangeRequestBranchCreateData()
                    .attributes(
                        new ChangeRequestBranchCreateAttributes()
                            .branchName("chm/CHM-1234")
                            .repoId("DataDog/dd-source"))
                    .type(ChangeRequestBranchResourceType.CHANGE_REQUEST_BRANCH));

    try {
      ChangeRequestResponse result = apiInstance.createChangeRequestBranch("CHM-1234", body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling ChangeManagementApi#createChangeRequestBranch");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=java) and then save the example to `Example.java` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"
```
{% /tab %}

{% tab label="Python" %}
```python
"""
Create a change request branch returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.change_management_api import ChangeManagementApi
from datadog_api_client.v2.model.change_request_branch_create_attributes import ChangeRequestBranchCreateAttributes
from datadog_api_client.v2.model.change_request_branch_create_data import ChangeRequestBranchCreateData
from datadog_api_client.v2.model.change_request_branch_create_request import ChangeRequestBranchCreateRequest
from datadog_api_client.v2.model.change_request_branch_resource_type import ChangeRequestBranchResourceType

body = ChangeRequestBranchCreateRequest(
    data=ChangeRequestBranchCreateData(
        attributes=ChangeRequestBranchCreateAttributes(
            branch_name="chm/CHM-1234",
            repo_id="DataDog/dd-source",
        ),
        type=ChangeRequestBranchResourceType.CHANGE_REQUEST_BRANCH,
    ),
)

configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
configuration.unstable_operations["create_change_request_branch"] = True
with ApiClient(configuration) as api_client:
    api_instance = ChangeManagementApi(api_client)
    response = api_instance.create_change_request_branch(change_request_id="change_request_id", body=body)

    print(response)
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=python) and then save the example to `example.py` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"
```
{% /tab %}

{% tab label="Ruby" %}
```ruby
# Create a change request branch returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.access_token = ENV["DD_BEARER_TOKEN"]
  config.unstable_operations["v2.create_change_request_branch".to_sym] = true
end
api_instance = DatadogAPIClient::V2::ChangeManagementAPI.new

body = DatadogAPIClient::V2::ChangeRequestBranchCreateRequest.new({
  data: DatadogAPIClient::V2::ChangeRequestBranchCreateData.new({
    attributes: DatadogAPIClient::V2::ChangeRequestBranchCreateAttributes.new({
      branch_name: "chm/CHM-1234",
      repo_id: "DataDog/dd-source",
    }),
    type: DatadogAPIClient::V2::ChangeRequestBranchResourceType::CHANGE_REQUEST_BRANCH,
  }),
})
p api_instance.create_change_request_branch("change_request_id", body)
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=ruby) and then save the example to `example.rb` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"
```
{% /tab %}

{% tab label="Rust" %}
```rust
// Create a change request branch returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_change_management::ChangeManagementAPI;
use datadog_api_client::datadogV2::model::ChangeRequestBranchCreateAttributes;
use datadog_api_client::datadogV2::model::ChangeRequestBranchCreateData;
use datadog_api_client::datadogV2::model::ChangeRequestBranchCreateRequest;
use datadog_api_client::datadogV2::model::ChangeRequestBranchResourceType;

#[tokio::main]
async fn main() {
    let body = ChangeRequestBranchCreateRequest::new(ChangeRequestBranchCreateData::new(
        ChangeRequestBranchCreateAttributes::new(
            "chm/CHM-1234".to_string(),
            "DataDog/dd-source".to_string(),
        ),
        ChangeRequestBranchResourceType::CHANGE_REQUEST_BRANCH,
    ));
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.create_change_request_branch", true);
    let api = ChangeManagementAPI::with_config(configuration);
    let resp = api
        .create_change_request_branch("change_request_id".to_string(), body)
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=rust) and then save the example to `src/main.rs` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
```
{% /tab %}

{% tab label="TypeScript" %}
```typescript
/**
 * Create a change request branch returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration({
  authMethods: {
    AuthZ: {
      accessToken: process.env.DD_BEARER_TOKEN as string,
    },
  },
});
configuration.unstableOperations["v2.createChangeRequestBranch"] = true;
const apiInstance = new v2.ChangeManagementApi(configuration);

const params: v2.ChangeManagementApiCreateChangeRequestBranchRequest = {
  body: {
    data: {
      attributes: {
        branchName: "chm/CHM-1234",
        repoId: "DataDog/dd-source",
      },
      type: "change_request_branch",
    },
  },
  changeRequestId: "change_request_id",
};

apiInstance
  .createChangeRequestBranch(params)
  .then((data: v2.ChangeRequestResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=typescript) and then save the example to `example.ts` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"
```
{% /tab %}
{% /tabs %}
