# Get Branch

## API Name

API Name: Branch – Get

***

## Overview

This API retrieves the details of a specific branch within a given project.

MBSE Core uses this API to:

* Validate branch existence
* Retrieve branch metadata
* Support branch-based synchronization

Connector responsibility:

* Retrieve the branch identified by `branchId` within the specified `projectId`
* Return branch details in key-value format
* If the branch does not exist, return HTTP `404 Not Found`

***

### API URI

```bash
GET: /mbse/api/1.0/branches/{branchId}
    ?projectId={projectId}
```

***

### Path Parameters

| Name     | Mandatory | Type   | Description                   |
| -------- | --------- | ------ | ----------------------------- |
| branchId | True      | String | ID of the branch to retrieve. |

***

### URI Parameters

| Name      | Mandatory | Type   | Description                                   |
| --------- | --------- | ------ | --------------------------------------------- |
| projectId | True      | String | ID of the project in which the branch exists. |

***

### Behavior Rules

1. The API must retrieve the branch within the context of the given project.
2. If the branch exists:
   * Return branch details.
3. If the branch does not exist:
   * Return HTTP `404 Not Found`.
4. The response must not return unrelated branch data.
5. Branch lookup must be project-scoped.

***

### Response Payload

#### Sample Response

```json
{
  "branchId": "main",
  "branchName": "Main Branch"
}
```

***

### Response Parameters

| Name       | Required | Type   | Description                      |
| ---------- | -------- | ------ | -------------------------------- |
| branchId   | True     | String | Unique identifier of the branch. |
| branchName | True     | String | Display name of the branch.      |

***

### Error Handling

| HTTP Status | Description                                |
| ----------- | ------------------------------------------ |
| 404         | Branch not found in the specified project. |
| 400         | Invalid input parameters.                  |

***

### Example Use Case

#### Get Branch Details

```bash
GET /mbse/api/1.0/branches/main?
projectId=123
```

***

### Implementation Guidelines

* Connector must ensure branch lookup is scoped to the provided `projectId`.
* Branch identifiers must be unique within a project.
* Do not return null response for non-existing branch — explicitly return HTTP `404`.

***

### Design Rationale

This API provides:

* Strict branch validation
* Clear project scoping
* Deterministic behavior for multi-branch systems

It ensures branch-level


---

# 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://opstech.gitbook.io/opstech-docs/7.223/mbse-connector-sdk-index/mbse-sdk-connector-apis/branch-apis/get-branch.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.
