> For the complete documentation index, see [llms.txt](https://oobla.gitbook.io/tyche/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://oobla.gitbook.io/tyche/reference/channels.md).

# Channels

#### Creat channel

## Create channel

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

create a new channel

**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="218">Name</th><th width="169">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>name</code> <mark style="color:red;">*</mark></td><td>string</td><td>name of channel</td></tr><tr><td><code>glAccountId</code> <mark style="color:red;">*</mark></td><td>string</td><td>id of the ledger attached to this channel</td></tr><tr><td><code>channelUserType</code> <mark style="color:red;">*</mark></td><td>array</td><td>channel user type (loans, deposits)</td></tr><tr><td><code>branch</code> <mark style="color:red;">*</mark></td><td>array</td><td>id or the branch or all_branches</td></tr><tr><td><code>status</code></td><td>string</td><td>status of the channel (active/inactive)</td></tr></tbody></table>

**Response**

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

```json
{
    "message": "channel successfully created",
    "data": {
        "organizationId": "153c58d7-c15b-41fa-a717-67b5ae8e3f98",
        "name": "name of the channel",
        "glAccountId": "08f743a6-757f-4e06-a729-dc3989001e30",
        "channelUserType": [
            "loans"
        ],
        "branch": [
            "all_branches"
        ],
        "status": "active",
        "id": "d8da13a4-3eed-4383-8f1e-2dd945881bc9",
        "created_at": "2024-04-02T08:25:41.884Z",
        "updated_at": "2024-04-02T08:25:41.884Z"
    }
}
```

{% endtab %}

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

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

{% endtab %}
{% endtabs %}

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

```
{
    "name": "name of the channel",
    "glAccountId": "08f743a6-757f-4e06-a729-dc3989001e30",
    "channelUserType":[ "loans"],
    "branch": ["all_branches"],
    "status": "active"
}
```

{% endtab %}

{% tab title="Sample response" %}

```
{
    "message": "channel successfully created",
    "data": {
        "organizationId": "153c58d7-c15b-41fa-a717-67b5ae8e3f98",
        "name": "name of the channel",
        "glAccountId": "08f743a6-757f-4e06-a729-dc3989001e30",
        "channelUserType": [
            "loans"
        ],
        "branch": [
            "all_branches"
        ],
        "status": "active",
        "id": "d8da13a4-3eed-4383-8f1e-2dd945881bc9",
        "created_at": "2024-04-02T08:25:41.884Z",
        "updated_at": "2024-04-02T08:25:41.884Z"
    }
}
```

{% endtab %}
{% endtabs %}

#### get channels

## Get channels

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

get channels

**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 per page |

**Response**

{% tabs %}
{% tab title="200: Ok channels fetched successfully " %}

```json
{
    "data": [
        {
            "id": "6de54c04-12e7-4b5e-afc2-9c528a087d15",
            "organizationId": "153c58d7-c15b-41fa-a717-67b5ae8e3f98",
            "glAccountId": "08f743a6-757f-4e06-a729-dc3989001e30",
            "name": "new channel",
            "channelUserType": [
                "deposits",
                "loans"
            ],
            "branch": [
                "all_branches"
            ],
            "status": "active",
            "created_at": "2024-02-06T06:25:21.684Z",
            "updated_at": "2024-02-06T06:25:21.684Z"
        }
    ],
    "pagination": {
        "currentPage": 1,
        "perPage": 15,
        "totalCount": 1,
        "totalPages": 1,
        "previousPage": 0,
        "nextPage": 1
    }
}
```

{% endtab %}

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

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

{% endtab %}
{% endtabs %}

#### get channel by id

## Get channel by id

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

get a single channel by id

**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 channel fetched successfully" %}

```json
{
    "data": {
        "id": "6de54c04-12e7-4b5e-afc2-9c528a087d15",
        "organizationId": "153c58d7-c15b-41fa-a717-67b5ae8e3f98",
        "glAccountId": "08f743a6-757f-4e06-a729-dc3989001e30",
        "name": "new channel",
        "channelUserType": [
            "deposits",
            "loans"
        ],
        "branch": [
            "all_branches"
        ],
        "status": "active",
        "created_at": "2024-02-06T06:25:21.684Z",
        "updated_at": "2024-02-06T06:25:21.684Z"
    }
}
```

{% endtab %}

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

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

{% endtab %}
{% endtabs %}

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

```
{
    "data": {
        "id": "6de54c04-12e7-4b5e-afc2-9c528a087d15",
        "organizationId": "153c58d7-c15b-41fa-a717-67b5ae8e3f98",
        "glAccountId": "08f743a6-757f-4e06-a729-dc3989001e30",
        "name": "new channel",
        "channelUserType": [
            "deposits",
            "loans"
        ],
        "branch": [
            "all_branches"
        ],
        "status": "active",
        "created_at": "2024-02-06T06:25:21.684Z",
        "updated_at": "2024-02-06T06:25:21.684Z"
    }
}
```

{% endtab %}
{% endtabs %}

#### update channel

## Update channel

<mark style="color:green;">`PATCH`</mark> `{base url}/v1/accounting/channel/{channelId}`

Update channel

**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="207">Name</th><th width="168">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>channelUserType</code></td><td>array</td><td>channel user type (loans, deposits)</td></tr><tr><td><code>branch</code></td><td>array</td><td>id or the branch or all_branches</td></tr><tr><td>status</td><td>string</td><td>status of branch</td></tr></tbody></table>

**Response**

{% tabs %}
{% tab title="200: Ok channel successfully updated" %}

```json
{
    "message": "channel successfully updated"
}

```

{% endtab %}

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

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

{% endtab %}
{% endtabs %}

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

```
{
    "channelUserType": ["loans"],
    "branch": ["all_branches"],
    "status": "inactive"
}
```

{% endtab %}

{% tab title="Sample response" %}

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

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://oobla.gitbook.io/tyche/reference/channels.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
