


# Internal branch OpenAPIs for TiDB Cloud
The TiDB Cloud API uses HTTP Digest Authentication. It protects your private key from being sent over the network.The API key contains a public key and a private key, which act as the username and password required in the HTTP Digest Authentication. The private key only displays upon the key creation.
  

## Informations

### Version

alpha

## Tags

  ### <span id="tag-branch-service"></span>BranchService

## Content negotiation

### URI Schemes
  * https

### Consumes
  * application/json

### Produces
  * application/json

## All endpoints

###  branch_service

| Method  | URI     | Name   | Summary |
|---------|---------|--------|---------|
| POST | /api/internal/projects/{project_id}/clusters/{cluster_id}/branches | [create branch](#create-branch) | Create a branch. |
| DELETE | /api/internal/projects/{project_id}/clusters/{cluster_id}/branches/{branch_name} | [delete branch](#delete-branch) | Delete a branch. |
| GET | /api/internal/projects/{project_id}/clusters/{cluster_id}/branches/{branch_name} | [get branch](#get-branch) | Get a branch. |
| GET | /api/internal/projects/{project_id}/clusters/{cluster_id}/branches | [list branches](#list-branches) | List all branches in the cluster. |
  


## Paths

### <span id="create-branch"></span> Create a branch. (*CreateBranch*)

```
POST /api/internal/projects/{project_id}/clusters/{cluster_id}/branches
```

#### Parameters

| Name | Source | Type | Go type | Separator | Required | Default | Description |
|------|--------|------|---------|-----------| :------: |---------|-------------|
| cluster_id | `path` | uint64 (formatted string) | `string` |  | ✓ |  | The ID of the cluster. |
| project_id | `path` | uint64 (formatted string) | `string` |  | ✓ |  | The ID of the project. |
| body | `body` | [CreateBranchBody](#create-branch-body) | `CreateBranchBody` | | ✓ | |  |

#### All responses
| Code | Status | Description | Has headers | Schema |
|------|--------|-------------|:-----------:|--------|
| [200](#create-branch-200) | OK | A successful response. |  | [schema](#create-branch-200-schema) |
| [default](#create-branch-default) | | An unexpected error response. |  | [schema](#create-branch-default-schema) |

#### Responses


##### <span id="create-branch-200"></span> 200 - A successful response.
Status: OK

###### <span id="create-branch-200-schema"></span> Schema
   
  

[OpenapiCreateBranchResp](#openapi-create-branch-resp)

##### <span id="create-branch-default"></span> Default Response
An unexpected error response.

###### <span id="create-branch-default-schema"></span> Schema

  

[GooglerpcStatus](#googlerpc-status)

###### Inlined models

**<span id="create-branch-body"></span> CreateBranchBody**


  



**Properties**

| Name | Type | Go type | Required | Default | Description | Example |
|------|------|---------|:--------:| ------- |-------------|---------|
| branch_name | string| `string` | ✓ | | The name of creating branch. |  |
| parent_branch_id | string| `string` | ✓ | | The id of the parent branch. If the parent is a cluster, provide the cluster id. |  |



### <span id="delete-branch"></span> Delete a branch. (*DeleteBranch*)

```
DELETE /api/internal/projects/{project_id}/clusters/{cluster_id}/branches/{branch_name}
```

#### Parameters

| Name | Source | Type | Go type | Separator | Required | Default | Description |
|------|--------|------|---------|-----------| :------: |---------|-------------|
| branch_name | `path` | string | `string` |  | ✓ |  | The name of creating branch. |
| cluster_id | `path` | uint64 (formatted string) | `string` |  | ✓ |  | The ID of the cluster. |
| project_id | `path` | uint64 (formatted string) | `string` |  | ✓ |  | The ID of the project. |
| root_branch_id | `query` | string | `string` |  | ✓ |  | The id of the root branch. |

#### All responses
| Code | Status | Description | Has headers | Schema |
|------|--------|-------------|:-----------:|--------|
| [200](#delete-branch-200) | OK | A successful response. |  | [schema](#delete-branch-200-schema) |
| [default](#delete-branch-default) | | An unexpected error response. |  | [schema](#delete-branch-default-schema) |

#### Responses


##### <span id="delete-branch-200"></span> 200 - A successful response.
Status: OK

###### <span id="delete-branch-200-schema"></span> Schema
   
  

any

##### <span id="delete-branch-default"></span> Default Response
An unexpected error response.

###### <span id="delete-branch-default-schema"></span> Schema

  

[GooglerpcStatus](#googlerpc-status)

### <span id="get-branch"></span> Get a branch. (*GetBranch*)

```
GET /api/internal/projects/{project_id}/clusters/{cluster_id}/branches/{branch_name}
```

#### Parameters

| Name | Source | Type | Go type | Separator | Required | Default | Description |
|------|--------|------|---------|-----------| :------: |---------|-------------|
| branch_name | `path` | string | `string` |  | ✓ |  | The name of creating branch. |
| cluster_id | `path` | uint64 (formatted string) | `string` |  | ✓ |  | The ID of the cluster. |
| project_id | `path` | uint64 (formatted string) | `string` |  | ✓ |  | The ID of the project. |
| root_branch_id | `query` | string | `string` |  | ✓ |  | The id of the root branch. |

#### All responses
| Code | Status | Description | Has headers | Schema |
|------|--------|-------------|:-----------:|--------|
| [200](#get-branch-200) | OK | A successful response. |  | [schema](#get-branch-200-schema) |
| [default](#get-branch-default) | | An unexpected error response. |  | [schema](#get-branch-default-schema) |

#### Responses


##### <span id="get-branch-200"></span> 200 - A successful response.
Status: OK

###### <span id="get-branch-200-schema"></span> Schema
   
  

[OpenapiGetBranchResp](#openapi-get-branch-resp)

##### <span id="get-branch-default"></span> Default Response
An unexpected error response.

###### <span id="get-branch-default-schema"></span> Schema

  

[GooglerpcStatus](#googlerpc-status)

### <span id="list-branches"></span> List all branches in the cluster. (*ListBranches*)

```
GET /api/internal/projects/{project_id}/clusters/{cluster_id}/branches
```

#### Parameters

| Name | Source | Type | Go type | Separator | Required | Default | Description |
|------|--------|------|---------|-----------| :------: |---------|-------------|
| cluster_id | `path` | uint64 (formatted string) | `string` |  | ✓ |  | The ID of the cluster. |
| project_id | `path` | uint64 (formatted string) | `string` |  | ✓ |  | The ID of the project. |
| page | `query` | int32 (formatted integer) | `int32` |  |  | `1` | The number of pages. |
| page_size | `query` | int32 (formatted integer) | `int32` |  |  | `10` | The size of a page. |
| root_branch_id | `query` | string | `string` |  | ✓ |  | The id of the root branch. |

#### All responses
| Code | Status | Description | Has headers | Schema |
|------|--------|-------------|:-----------:|--------|
| [200](#list-branches-200) | OK | A successful response. |  | [schema](#list-branches-200-schema) |
| [default](#list-branches-default) | | An unexpected error response. |  | [schema](#list-branches-default-schema) |

#### Responses


##### <span id="list-branches-200"></span> 200 - A successful response.
Status: OK

###### <span id="list-branches-200-schema"></span> Schema
   
  

[OpenapiListBranchesResp](#openapi-list-branches-resp)

##### <span id="list-branches-default"></span> Default Response
An unexpected error response.

###### <span id="list-branches-default-schema"></span> Schema

  

[GooglerpcStatus](#googlerpc-status)

## Models

### <span id="googlerpc-status"></span> googlerpcStatus


  



**Properties**

| Name | Type | Go type | Required | Default | Description | Example |
|------|------|---------|:--------:| ------- |-------------|---------|
| code | int32 (formatted integer)| `int32` |  | |  |  |
| details | [][ProtobufAny](#protobuf-any)| `[]*ProtobufAny` |  | |  |  |
| message | string| `string` |  | |  |  |



### <span id="openapi-create-branch-resp"></span> openapiCreateBranchResp


  



**Properties**

| Name | Type | Go type | Required | Default | Description | Example |
|------|------|---------|:--------:| ------- |-------------|---------|
| id | string| `string` | ✓ | | The ID of the branch. | `branch-SDUAOISD` |



### <span id="openapi-get-branch-resp"></span> openapiGetBranchResp


> BranchItem is the information of branch.
  





**Properties**

| Name | Type | Go type | Required | Default | Description | Example |
|------|------|---------|:--------:| ------- |-------------|---------|
| cloud_provider_name | string| `string` | ✓ | | The name of cloud provider. |  |
| created_at | date-time (formatted string)| `strfmt.DateTime` | ✓ | | The creation timestamp of the branch. |  |
| created_by_id | uint64 (formatted string)| `string` | ✓ | | The ID of the user who created the branch. | `1` |
| creation_finished_time | date-time (formatted string)| `strfmt.DateTime` |  | | The creation finished timestamp of the branch. |  |
| id | string| `string` | ✓ | | The ID of the branch. |  |
| name | string| `string` | ✓ | | The name of the branch. |  |
| parent_branch_id | string| `string` | ✓ | | The ID of the parent branch. |  |
| project_id | uint64 (formatted string)| `string` | ✓ | | The ID of the project. | `1` |
| region_name | string| `string` | ✓ | | The name of cloud provider. |  |
| root_branch_id | string| `string` | ✓ | | The ID of the root branch. |  |
| status | [OpenapiGetBranchRespStatus](#openapi-get-branch-resp-status)| `OpenapiGetBranchRespStatus` | ✓ | | The status of the branch. |  |
| tenant_id | uint64 (formatted string)| `string` | ✓ | | The ID of the tenant. | `1` |



### <span id="openapi-get-branch-resp-status"></span> openapiGetBranchRespStatus


  

| Name | Type | Go type | Default | Description | Example |
|------|------|---------| ------- |-------------|---------|
| openapiGetBranchRespStatus | string| string | |  |  |



### <span id="openapi-list-branches-resp"></span> openapiListBranchesResp


  



**Properties**

| Name | Type | Go type | Required | Default | Description | Example |
|------|------|---------|:--------:| ------- |-------------|---------|
| branches | [][OpenapiGetBranchResp](#openapi-get-branch-resp)| `[]*OpenapiGetBranchResp` | ✓ | | The items of branches in the cluster. |  |
| total | int64 (formatted string)| `string` | ✓ | | The total number of branches in the cluster. |  |



### <span id="protobuf-any"></span> protobufAny


  



**Properties**

| Name | Type | Go type | Required | Default | Description | Example |
|------|------|---------|:--------:| ------- |-------------|---------|
| @type | string| `string` |  | |  |  |


