---
description: >-
  The channels endpoints allow you to open channels with other Raiden nodes as
  well as closing channels, querying them for information and making deposits or
  withdrawals.
---

# Channels

## Channels Resource Overview

| HTTP Method | Resource                                                                                        | Description                                                                 |
| ----------- | ----------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| GET         | [`/api/<version>/channels`](#all-unsettled-channels-for-a-specific-token)                       | All unsettled channels                                                      |
| GET         | [`/api/<version>/channels/<token_address>`](#all-unsettled-channels-for-a-specific-token)       | All unsettled channels for a specific token                                 |
| GET         | [`/api/<version>/channels/<token_address>/<partner_address>`](#info-about-one-of-your-channels) | Info about one of your channels                                             |
| PUT         | [`/api/<version>/channels`](#create-a-channel)                                                  | Create a channel                                                            |
| PATCH       | [`/api/<version>/channels/<token_address>/<partner_address>`](#close-a-channel)                 | Close a channel, increase deposit, withdraw tokens or update reveal timeout |

{% hint style="warning" %}
**Alderaan Deposit Limits**

The maximum deposits per token and node for Alderaan are:

*   **DAI**

    The deposit limit is 1000 worth of DAI per channel participant making the maximum amount of DAI 2000 per channel.
*   **WETH**

    Details on the deposit limit for WETH will be added soon.
{% endhint %}

## Channels Resource Details

## All Unsettled Channels

<mark style="color:blue;">`GET`</mark> `http://localhost:5001/api/v1/channels`

#### Path Parameters

| Name    | Type   | Description        |
| ------- | ------ | ------------------ |
| version | string | Version of the API |

{% tabs %}
{% tab title="200 Successful query" %}
```bash
[
    {
        "token_network_address": "0xE5637F0103794C7e05469A9964E4563089a5E6f2",
        "channel_identifier": "20",
        "partner_address": "0x61C808D82A3Ac53231750daDc13c777b59310bD9",
        "token_address": "0xEA674fdDe714fd979de3EdF0F56AA9716B898ec8",
        "balance": "25000000",
        "total_deposit": "35000000",
        "total_withdraw": "5000000",
        "state": "opened",
        "settle_timeout": "100",
        "reveal_timeout": "30"
    }
]
```
{% endtab %}

{% tab title="500 " %}
```
Internal Raiden node error
```
{% endtab %}
{% endtabs %}

## All Unsettled Channels for a Specific Token

<mark style="color:blue;">`GET`</mark> `http://localhost:5001/api/v1/channels/0xEA67...8ec8`

#### Path Parameters

| Name           | Type   | Description        |
| -------------- | ------ | ------------------ |
| version        | string | Version of the API |
| token\_address | string | Address of a token |

{% tabs %}
{% tab title="200 Successfull query" %}
```bash
[
    {
        "token_network_address": "0xE5637F0103794C7e05469A9964E4563089a5E6f2",
        "channel_identifier": "20",
        "partner_address": "0x61C808D82A3Ac53231750daDc13c777b59310bD9",
        "token_address": "0xEA674fdDe714fd979de3EdF0F56AA9716B898ec8",
        "balance": "25000000",
        "total_deposit": "35000000",
        "total_withdraw": "5000000",
        "state": "opened",
        "settle_timeout": "100",
        "reveal_timeout": "30"
    }
]
```
{% endtab %}

{% tab title="404 " %}
```
The token address is not a valid EIP55-encoded Ethereum address
```
{% endtab %}

{% tab title="500 " %}
```
Internal Raiden node error
```
{% endtab %}
{% endtabs %}

## Info About One of Your Channels

<mark style="color:blue;">`GET`</mark> `http://localhost:5001/api/v1/channels/0xEA67...8ec8/0x61C8...0bD9`

The channel is specified by the address of a token and the address of the partner node which the channel is opened with.

#### Path Parameters

| Name             | Type   | Description                 |
| ---------------- | ------ | --------------------------- |
| version          | string | Version of the API          |
| token\_address   | string | Address of a token          |
| partner\_address | string | Address of the partner node |

{% tabs %}
{% tab title="200 Successful query" %}
```bash
{
    "token_network_address": "0xE5637F0103794C7e05469A9964E4563089a5E6f2",
    "channel_identifier": "20",
    "partner_address": "0x61C808D82A3Ac53231750daDc13c777b59310bD9",
    "token_address": "0xEA674fdDe714fd979de3EdF0F56AA9716B898ec8",
    "balance": "25000000",
    "total_deposit": "35000000",
    "total_withdraw": "5000000",
    "state": "opened",
    "settle_timeout": "100",
    "reveal_timeout": "30"
}
```
{% endtab %}

{% tab title="404 " %}
```
The token address is not a valid EIP55-encoded Ethereum address
The target address is not a valid EIP55-encoded Ethereum address
The channel does not exist
```
{% endtab %}

{% tab title="500 " %}
```
Internal Raiden node error
```
{% endtab %}
{% endtabs %}

## Create a Channel

<mark style="color:orange;">`PUT`</mark> `http://localhost:5001/api/v1/channels`

The request will open a channel and return a channel object.

#### Path Parameters

| Name    | Type   | Description        |
| ------- | ------ | ------------------ |
| version | string | Version of the API |

#### Request Body

| Name             | Type   | Description                                                     |
| ---------------- | ------ | --------------------------------------------------------------- |
| reveal\_timeout  | string | Value for the reveal timeout                                    |
| partner\_address | string | Address of the partner node with whom we're opening the channel |
| token\_address   | string | Address of the token to be used in the channel                  |
| total\_deposit   | string | Amount of tokens to be deposited into the channel               |
| settle\_timeout  | string | The number of blocks after which a channel can be settled       |

{% tabs %}
{% tab title="201 Channel successfully created" %}
```bash
{
    "token_network_address": "0xE5637F0103794C7e05469A9964E4563089a5E6f2",
    "channel_identifier": "20",
    "partner_address": "0x61C808D82A3Ac53231750daDc13c777b59310bD9",
    "token_address": "0xEA674fdDe714fd979de3EdF0F56AA9716B898ec8",
    "balance": "25000000",
    "total_deposit": "35000000",
    "total_withdraw": "0",
    "state": "opened",
    "settle_timeout": "500",
    "reveal_timeout": "30"
}
```
{% endtab %}

{% tab title="400 " %}
```
The provided JSON is in some way incorrect
```
{% endtab %}

{% tab title="402 " %}
```
Insufficient balance of ETH to pay for the on-chain transaction
```
{% endtab %}

{% tab title="409 " %}
```
Some invalid input has been provided, e.g. to low settle_timeout value
```
{% endtab %}

{% tab title="500 " %}
```
Internal Raiden node error
```
{% endtab %}
{% endtabs %}

#### Example request body:

```bash
{
    "partner_address": "0x61C808D82A3Ac53231750daDc13c777b59310bD9",
    "token_address": "0xEA674fdDe714fd979de3EdF0F56AA9716B898ec8",
    "total_deposit": "35000000",
    "settle_timeout": "500",
    "reveal_timeout": "50"
}
```

## Close a Channel

<mark style="color:purple;">`PATCH`</mark> `http://localhost:5001/api/v1/channels/0xEA67...8ec8/0x61C8...0bD9`

#### Path Parameters

| Name             | Type   | Description                 |
| ---------------- | ------ | --------------------------- |
| version          | string | Version of the API          |
| token\_address   | string | Address of a token          |
| partner\_address | string | Address of the partner node |

#### Request Body

| Name  | Type   | Description                     |
| ----- | ------ | ------------------------------- |
| state | string | Can only be set to **"closed"** |

{% tabs %}
{% tab title="200 Successfully closed channel" %}
```bash
{
    "token_network_address": "0xE5637F0103794C7e05469A9964E4563089a5E6f2",
    "channel_identifier": "20",
    "partner_address": "0x61C808D82A3Ac53231750daDc13c777b59310bD9",
    "token_address": "0xEA674fdDe714fd979de3EdF0F56AA9716B898ec8",
    "balance": "25000000",
    "total_deposit": "35000000",
    "total_withdraw": "5000000",
    "state": "closed",
    "settle_timeout": "500",
    "reveal_timeout": "30"
}
```
{% endtab %}

{% tab title="400 " %}
```
The provided JSON is in some way incorrect
"state" has not been provided or doesn't have the valid value "closed"
```
{% endtab %}

{% tab title="402 " %}
```
Insufficient balance of ETH to pay for the on-chain transactions
```
{% endtab %}

{% tab title="404 " %}
```
The token address is not a valid EIP55-encoded Ethereum address
The target address is not a valid EIP55-encoded Ethereum address
```
{% endtab %}

{% tab title="409 " %}
```
The channel does not exist
"total_withdraw" and/or "total_deposit" have been trying to update in the same request
```
{% endtab %}

{% tab title="500 " %}
```
Internal Raiden node error
```
{% endtab %}
{% endtabs %}

#### Example request body:

```bash
{
    "state": "closed"
}
```

## Increase Deposit

<mark style="color:purple;">`PATCH`</mark> `http://localhost:5001/api/v1/channels/0xEA67...8ec8/0x61C8...0bD9`

#### Path Parameters

| Name             | Type   | Description                 |
| ---------------- | ------ | --------------------------- |
| version          | string | Version of the API          |
| token\_address   | string | Address of a token          |
| partner\_address | string | Address of the partner node |

#### Request Body

| Name           | Type   | Description                                       |
| -------------- | ------ | ------------------------------------------------- |
| total\_deposit | string | Amount of tokens for increasing the total deposit |

{% tabs %}
{% tab title="200 Successfully increased the deposit" %}
```bash
{
    "token_network_address": "0xE5637F0103794C7e05469A9964E4563089a5E6f2",
    "channel_identifier": "20",
    "partner_address": "0x61C808D82A3Ac53231750daDc13c777b59310bD9",
    "token_address": "0xEA674fdDe714fd979de3EdF0F56AA9716B898ec8",
    "balance": "25000000",
    "total_deposit": "35000000",
    "total_withdraw": "5000000",
    "state": "closed",
    "settle_timeout": "500",
    "reveal_timeout": "30"
}
```
{% endtab %}

{% tab title="400 " %}
```
The provided JSON is in some way incorrect
"total_deposit" has not been provided
```
{% endtab %}

{% tab title="402 " %}
```
Insufficient balance of ETH to pay for the on-chain transactions
Insufficient token balance for making the desired deposit
```
{% endtab %}

{% tab title="404 " %}
```
The token address is not a valid EIP55-encoded Ethereum address
The target address is not a valid EIP55-encoded Ethereum address
```
{% endtab %}

{% tab title="408 " %}
```
The deposit event was not read on time by the Ethereum node
```
{% endtab %}

{% tab title="409 " %}
```
The channel does not exist"state" and/or "total_withdraw" have been trying to update in the same request
The amount of deposited tokens is lower than the current on-chain token balance in the channel
The amount of deposited tokens is higher than the allowed limit
```
{% endtab %}

{% tab title="500 " %}
```
Internal Raiden node error
```
{% endtab %}
{% endtabs %}

#### Example request body:

```bash
{
    "total_deposit": "100"
}
```

## Withdraw Tokens

<mark style="color:purple;">`PATCH`</mark> `http://localhost:5001/api/v1/channels/0xEA67...8ec8/0x61C8...0bD9`

#### Path Parameters

| Name             | Type   | Description                 |
| ---------------- | ------ | --------------------------- |
| version          | string | Version of the API          |
| token\_address   | string | Address of a token          |
| partner\_address | string | Address of the partner node |

#### Request Body

| Name            | Type   | Description                  |
| --------------- | ------ | ---------------------------- |
| total\_withdraw | string | Amount of tokens to withdraw |

{% tabs %}
{% tab title="200 Successfully withdrawn tokens" %}
```bash
{
    "token_network_address": "0xE5637F0103794C7e05469A9964E4563089a5E6f2",
    "channel_identifier": "20",
    "partner_address": "0x61C808D82A3Ac53231750daDc13c777b59310bD9",
    "token_address": "0xEA674fdDe714fd979de3EdF0F56AA9716B898ec8",
    "balance": "25000000",
    "total_deposit": "35000000",
    "total_withdraw": "5000000",
    "state": "closed",
    "settle_timeout": "500",
    "reveal_timeout": "30"
}
```
{% endtab %}

{% tab title="400 " %}
```
The provided JSON is in some way incorrect
"total_withdraw" has not been provided
```
{% endtab %}

{% tab title="402 " %}
```
Insufficient balance of ETH to pay for the on-chain transactions
```
{% endtab %}

{% tab title="404 " %}
```
The token address is not a valid EIP55-encoded Ethereum address
The target address is not a valid EIP55-encoded Ethereum address
```
{% endtab %}

{% tab title="409 " %}
```
The channel does not exist
"state" and/or "total_deposit" have been trying to update in the same request
```
{% endtab %}

{% tab title="500 " %}
```
Internal Raiden node error
```
{% endtab %}
{% endtabs %}

#### Example request body:

```bash
{
    "total_withdraw": "50"
}
```

## Update Reveal Timeout

<mark style="color:purple;">`PATCH`</mark> `http://localhost:5001/api/v1/channels/0xEA67...8ec8/0x61C8...0bD9`

This request will update the number of blocks that are allowed between setting a hashlock and the revealing of the related secret.

#### Path Parameters

| Name             | Type   | Description                 |
| ---------------- | ------ | --------------------------- |
| version          | string | Version of the API          |
| token\_address   | string | Address of a token          |
| partner\_address | string | Address of the partner node |

#### Request Body

| Name            | Type   | Description                      |
| --------------- | ------ | -------------------------------- |
| reveal\_timeout | string | Value for the new reveal timeout |

{% tabs %}
{% tab title="200 " %}
```
Successfully updated the reveal timeout
```
{% endtab %}
{% endtabs %}

#### Example request body:

```bash
{
    "reveal_timeout": "50"
}
```
