# Branch

create branch

## Create branch

<mark style="color:green;">`POST`</mark> `{base url}/v1/branch`

Create branch

**Headers**

<table><thead><tr><th width="302">Name</th><th width="156">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>Authorization header</code><mark style="color:red;">*</mark></td><td><code>String</code></td><td><code>API user secret key</code></td></tr></tbody></table>

**Body**

<table><thead><tr><th width="213">Name</th><th width="193">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>name</code></td><td>string</td><td>Name of the branch</td></tr><tr><td><code>location</code></td><td>string</td><td>Location of branch</td></tr><tr><td><code>Status</code></td><td>string</td><td>status of branch (active/ inactive)</td></tr></tbody></table>

**Response**

{% tabs %}
{% tab title="200: OK branch created successfully" %}

```json
{
    "responseCode": "00",
    "message": "branch successfully created",
    "data": {
        "organizationId": "153c58d7-c15b-41fa-a717-67b5ae8e3f98",
        "name": "ojodues",
        "location": "20 Marina road, Lagos",
        "status": "active",
        "id": "e83baea7-9a46-4c3c-a1e0-9214d2006493",
        "created_at": "2024-04-02T07:32:13.798Z",
        "updated_at": "2024-04-02T07:32:13.798Z"
    }
}
```

{% endtab %}

{% tab title="400: Forbidden unauthorised " %}

```json
{
    "message": "No authorization token found",
    "code": 90
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Sample request" %}

```
{
    "name": "Ojodues",
    "location": "20 Marina road, Lagos",
    "status": "active"
}
```

{% endtab %}

{% tab title="Sample response" %}

```
{
    "responseCode": "00",
    "message": "branch successfully created",
    "data": {
        "organizationId": "153c58d7-c15b-41fa-a717-67b5ae8e3f98",
        "name": "ojodues",
        "location": "20 Marina road, Lagos",
        "status": "active",
        "id": "e83baea7-9a46-4c3c-a1e0-9214d2006493",
        "created_at": "2024-04-02T07:32:13.798Z",
        "updated_at": "2024-04-02T07:32:13.798Z"
    }
}
```

{% endtab %}
{% endtabs %}

#### get branches

## Get branches

<mark style="color:green;">`GET`</mark> `{base url}/v1/branch`

Fetch all branches

**Headers**

<table><thead><tr><th width="302">Name</th><th width="156">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>Authorization header</code><mark style="color:red;">*</mark></td><td><code>String</code></td><td><code>API user secret key</code></td></tr></tbody></table>

**Query parameters**&#x20;

| Name      | Type   | Description               |
| --------- | ------ | ------------------------- |
| `page`    | number | page to fetch             |
| `perPage` | number | number of items on a page |

**Response**

{% tabs %}
{% tab title="200: OKk branches fetch successfully" %}

```json
{
    "responseCode": "00",
    "message": "branches fetch successfully",
    "data": [
        {
            "id": "e83baea7-9a46-4c3c-a1e0-9214d2006493",
            "organizationId": "153c58d7-c15b-41fa-a717-67b5ae8e3f98",
            "name": "ojodues",
            "location": "20 Marina road, Lagos",
            "status": "active",
            "created_at": "2024-04-02T07:32:13.798Z",
            "updated_at": "2024-04-02T07:32:13.798Z"
        },
    ],
    "pagination": {
        "currentPage": 1,
        "perPage": 15,
        "totalCount": 18,
        "totalPages": 2,
        "previousPage": 0,
        "nextPage": 2
    }
}
```

{% endtab %}

{% tab title="400: Forbidden unauthorised " %}

```json
{
    "message": "No authorization token found",
    "code": 90
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Sample request" %}

```
{
    "responseCode": "00",
    "message": "branches fetch successfully",
    "data": [
        {
            "id": "e83baea7-9a46-4c3c-a1e0-9214d2006493",
            "organizationId": "153c58d7-c15b-41fa-a717-67b5ae8e3f98",
            "name": "ojodues",
            "location": "20 Marina road, Lagos",
            "status": "active",
            "created_at": "2024-04-02T07:32:13.798Z",
            "updated_at": "2024-04-02T07:32:13.798Z"
        },
    ],
    "pagination": {
        "currentPage": 1,
        "perPage": 15,
        "totalCount": 18,
        "totalPages": 2,
        "previousPage": 0,
        "nextPage": 2
    }
}
```

{% endtab %}
{% endtabs %}

#### get a branch

## Get a branch

<mark style="color:green;">`GET`</mark>  `{base url}/v1/branch/{branchId}`

Fetch a single branch details

**Headers**

<table><thead><tr><th width="302">Name</th><th width="156">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>Authorization header</code><mark style="color:red;">*</mark></td><td><code>String</code></td><td><code>API user secret key</code></td></tr></tbody></table>

**Response**

{% tabs %}
{% tab title="200: OK branch successfully fetch" %}

```json
{
    "responseCode": "00",
    "message": "branch successfully fetch",
    "data": {
        "id": "e83baea7-9a46-4c3c-a1e0-9214d2006493",
        "organizationId": "153c58d7-c15b-41fa-a717-67b5ae8e3f98",
        "name": "ojodues",
        "location": "20 Marina road, Lagos",
        "status": "active",
        "created_at": "2024-04-02T07:32:13.798Z",
        "updated_at": "2024-04-02T07:32:13.798Z"
    }
}
```

{% endtab %}

{% tab title="400: Forbidden unauthorised " %}

```json
{
    "message": "No authorization token found",
    "code": 90
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Sample response" %}

```
{
    "responseCode": "00",
    "message": "branch successfully fetch",
    "data": {
        "id": "e83baea7-9a46-4c3c-a1e0-9214d2006493",
        "organizationId": "153c58d7-c15b-41fa-a717-67b5ae8e3f98",
        "name": "ojodues",
        "location": "20 Marina road, Lagos",
        "status": "active",
        "created_at": "2024-04-02T07:32:13.798Z",
        "updated_at": "2024-04-02T07:32:13.798Z"
    }
}
```

{% endtab %}
{% endtabs %}

#### update branch

## Update branch

<mark style="color:green;">`PATCH`</mark> `{base url}/v1/branch/{branchId}`

Update a single branch

**Headers**

<table><thead><tr><th width="302">Name</th><th width="156">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>Authorization header</code><mark style="color:red;">*</mark></td><td><code>String</code></td><td><code>API user secret key</code></td></tr></tbody></table>

**Body**

<table><thead><tr><th width="213">Name</th><th width="193">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>name</code></td><td>string</td><td>Name of the branch</td></tr><tr><td><code>location</code></td><td>string</td><td>Location of branch</td></tr><tr><td><code>Status</code></td><td>string</td><td>status of branch (active/ inactive)</td></tr></tbody></table>

**Response**

{% tabs %}
{% tab title="200: OK branch updated successfully" %}

```json
{
    "responseCode": "00",
    "message": "branch successfully fetch",
    "data": {
        "id": "e83baea7-9a46-4c3c-a1e0-9214d2006493",
        "organizationId": "153c58d7-c15b-41fa-a717-67b5ae8e3f98",
        "name": "ojodues",
        "location": "20 Marina road, Lagos",
        "status": "active",
        "created_at": "2024-04-02T07:32:13.798Z",
        "updated_at": "2024-04-02T07:32:13.798Z"
    }
}
```

{% endtab %}

{% tab title="400: Forbidden unauthorised " %}

```json
{
    "message": "No authorization token found",
    "code": 90
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Sample request" %}

```
{
    "location": "20 Abule-Ajah, Lagos"
}
```

{% endtab %}

{% tab title="Sample response" %}

```
{
    "responseCode": "00",
    "message": "branch updated successfully",
    "data": {
        "id": "e83baea7-9a46-4c3c-a1e0-9214d2006493",
        "organizationId": "153c58d7-c15b-41fa-a717-67b5ae8e3f98",
        "name": "ojodues",
        "location": "20 Abule-Ajah, Lagos",
        "status": "active",
        "created_at": "2024-04-02T07:32:13.798Z",
        "updated_at": "2024-04-02T07:32:13.798Z"
    }
}
```

{% endtab %}
{% endtabs %}


---

# 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://oobla.gitbook.io/tyche/reference/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.
