> Documentation index: [Saleor](/llms.txt) · [This section](/developer/llms.txt)
> Source: https://docs.saleor.io/developer/channels/api

# Channel API guide

<a id="getting-channel-details"></a>

## Getting Channel Details

Use the [`channel`](/api-reference/channels/queries/channel.md) query to get channel details.

The `channel` query requires a channel ID or channel slug.

Available fields:

-   `id`: Channel object ID
-   `slug`: When using channel-dependent queries, the slug is used to select the right channel (for example, when requesting product details).
-   `name`: Channel name
-   `isActive`: Flag signaling that the channel is available for shop customers.
-   `currencyCode`: Currency code used by the channel.
-   `hasOrders`: Returns `true` when there are already created orders using that channel. If that's the only channel using this currency, you won't be able to remove it.
-   `defaultCountry`: Default country for the channel. The default country is used in checkout to determine stock quantities or calculate taxes when the country is not explicitly provided, either as a query parameter or through a shipping address.
-   `warehouses`: Warehouses that are available in the given channel.
-   `countries`: List of shippable countries for the channel.
-   `availableShippingMethodsPerCountry`: Shipping methods that are available for the channel.
-   `stockSettings`: Contains all stock-related settings, e.g., the [allocation strategy](/developer/stock/stock-allocation.md#allocation-strategies) for the channel.
-   `orderSettings`: Channel-specific order settings.
-   `checkoutSettings`: Controls automatic checkout completion and error handling.
-   `paymentSettings`: Defines the default transaction flow strategy: `AUTHORIZATION` or `CHARGE`.

**Query**

```graphql
query channel($slug: String) {
  channel(slug: $slug) {
    id
    slug
    name
    isActive
    currencyCode
    hasOrders
    defaultCountry {
      code
      country
    }
    warehouses {
      slug
    }
    countries {
      code
      country
    }
    availableShippingMethodsPerCountry {
      countryCode
      shippingMethods {
        id
        name
      }
    }
    stockSettings {
      allocationStrategy
    }
    orderSettings {
      allowUnpaidOrders
    }
  }
}
```

**Variables**

```json
{
  "slug": "mobile"
}
```

**Result**

```json
{
  "data": {
    "channel": {
      "id": "Q2hhbm5lbDo0MzM=",
      "slug": "mobile",
      "name": "Mobile",
      "isActive": false,
      "currencyCode": "USD",
      "hasOrders": true,
      "defaultCountry": {
        "code": "US",
        "country": "United States of America"
      },
      "warehouses": [
        {
          "slug": "oceania"
        },
        {
          "slug": "europe"
        }
      ],
      "availableShippingMethodsPerCountry": [
        {
          "countryCode": "AD",
          "shippingMethods": [
            {
              "id": "U2hpcHBpbmdNZXRob2Q6Mg==",
              "name": "DHL"
            },
            {
              "id": "U2hpcHBpbmdNZXRob2Q6Mw==",
              "name": "UPS"
            },
            {
              "id": "U2hpcHBpbmdNZXRob2Q6NA==",
              "name": "Registered priority"
            },
            {
              "id": "U2hpcHBpbmdNZXRob2Q6NQ==",
              "name": "DB Schenker"
            }
          ]
        }
        // ... more countries
      ],
      "stockSettings": {
        "allocationStrategy": "PRIORITIZE_HIGH_STOCK"
      },
      "orderSettings": {
        "allowUnpaidOrders": false
      }
    }
  }
}
```

<a id="permissions"></a>

## Permissions

Listing channels is allowed only for users with the active [`isStaff`](/api-reference/users/objects/user.md#is-staff) flag.

You need the `MANAGE_CHANNELS` permission to create, edit, and remove channels. Changing `ChannelListing` does not require additional permissions. For example, changing product availability requires only the `MANAGE_PRODUCTS` permission.

Objects with customized per-channel visibility are restricted by channel permissions. If a user with restricted channel access fetches per-channel objects, only objects from accessible channels are returned. Read more about channel permissions in [Permissions](/developer/permissions.md).

<a id="creating-a-new-channel"></a>

## Creating a New Channel

You can create a new channel using the [`channelCreate`](/api-reference/channels/mutations/channel-create.md) mutation. During channel creation, you can configure not only slug or currency but also stock, order, checkout, payment behaviors, and assign warehouses and shipping zones.

**Mutation**

```graphql
mutation channelCreate($input: ChannelCreateInput!) {
  channelCreate(input: $input) {
    channel {
      id
      isActive
      name
      slug
      currencyCode
      defaultCountry {
        code
        country
      }
      stockSettings {
        allocationStrategy
      }
      orderSettings {
        automaticallyConfirmAllNewOrders
      }
      checkoutSettings {
        automaticallyCompleteFullyPaidCheckouts
      }
      paymentSettings {
        defaultTransactionFlowStrategy
      }
      warehouses {
        name
      }
    }
    errors {
      code
      field
      message
    }
  }
}
```

**Variables**

```json
{
  "input": {
    "currencyCode": "USD",
    "defaultCountry": "US",
    "name": "Mobile",
    "slug": "mobile",
    "stockSettings": {
      "allocationStrategy": "PRIORITIZE_HIGH_STOCK"
    },
    "orderSettings": {
      "automaticallyConfirmAllNewOrders": true
    },
    "checkoutSettings": {
      "automaticallyCompleteFullyPaidCheckouts": true
    },
    "paymentSettings": {
      "defaultTransactionFlowStrategy": "CHARGE"
    },
    "addWarehouses": [
      "V2FyZWhvdXNlOjQwZWY1MTQwLWQ5OTYtNDVlNy04NzUzLTlkZThkMTdhMjg1Yw=="
    ],
    "addShippingZones": [
      "U2hpcHBpbmdab25lOjI=",
      "U2hpcHBpbmdab25lOjU="
    ]
  }
}
```

**Result**

```json
{
  "data": {
    "channelCreate": {
      "channel": {
        "id": "Q2hhbm5lbDo0MzM=",
        "isActive": false,
        "name": "Mobile",
        "slug": "mobile",
        "currencyCode": "USD",
        "defaultCountry": {
          "code": "US",
          "country": "United States of America"
        },
        "stockSettings": {
          "allocationStrategy": "PRIORITIZE_HIGH_STOCK"
        },
        "orderSettings": {
          "automaticallyConfirmAllNewOrders": true
        },
        "checkoutSettings": {
          "automaticallyCompleteFullyPaidCheckouts": true
        },
        "paymentSettings": {
          "defaultTransactionFlowStrategy": "CHARGE"
        },
        "warehouses": [
          {
            "name": "Default"
          }
        ]
      },
      "errors": []
    }
  }
}
```

<a id="channel-settings"></a>

## Channel Settings

Each channel can have an independent configuration for orders, checkout, stock, and payments. These settings are available under the fields: `orderSettings`, `checkoutSettings`, `stockSettings`, and `paymentSettings`.

<a id="stock-settings"></a>

### Stock Settings

Channel-level stock settings control how inventory is allocated to orders.

-   `allocationStrategy`: Determines which warehouse is used first when reserving stock.
    -   `PRIORITIZE_HIGH_STOCK`: Prefer warehouses with higher on-hand stock.
    -   `PRIORITIZE_SORTING_ORDER`: Follow the warehouse order defined for the channel (default).

Read more about [stock allocation](/developer/stock/stock-allocation.md).

<a id="reorder-warehouses-within-channels"></a>

#### Reorder Warehouses Within Channels

You can change the warehouse order using the [`channelReorderWarehouses`](/api-reference/channels/mutations/channel-reorder-warehouses.md) mutation.

The `sortOrder` in the `moves` input represents the new relative position of the item. When `1` is provided, the item is moved one position forward; when `-1`, one position backward.

Assume we have a `channel` with three warehouses in the following order:

```json
{
  "data": {
    "channel": {
      "id": "Q2hhbm5lbDox",
      "warehouses": [
        {
          "id": "V2FyZWhvdXNlOjU1NTZiOWI0LTc1ZTItNGI3YS1hZWM1LTQxOTY4NDA2OGE4OA==",
          "slug": "europe"
        },
        {
          "id": "V2FyZWhvdXNlOjQwZWY1MTQwLWQ5OTYtNDVlNy04NzUzLTlkZThkMTdhMjg1Yw==",
          "slug": "oceania"
        },
        {
          "id": "V2FyZWhvdXNlOjY4M2FkMzZhLTRmNjktNDI2ZS1iYzUyLTMyZGJiZTQ2NjUyZA==",
          "slug": "americas"
        }
      ]
    }
  }
}
```

To move the `americas` warehouse to the first position and the `europe` warehouse to the third position, run the following mutation:

**Mutation**

```graphql
mutation channelReorderWarehouses($channelId: ID!, $moves: [ReorderInput!]!) {
  channelReorderWarehouses(channelId: $channelId, moves: $moves) {
    channel {
      id
      warehouses {
        id
        slug
      }
    }
    errors {
      field
      code
      message
      warehouses
    }
  }
}
```

**Variables**

```json
{
  "channelId": "Q2hhbm5lbDox",
  "moves": [
    {
      "id": "V2FyZWhvdXNlOjY4M2FkMzZhLTRmNjktNDI2ZS1iYzUyLTMyZGJiZTQ2NjUyZA==",
      "sortOrder": -2
    },
    {
      "id": "V2FyZWhvdXNlOjU1NTZiOWI0LTc1ZTItNGI3YS1hZWM1LTQxOTY4NDA2OGE4OA==",
      "sortOrder": 1
    }
  ]
}
```

**Result**

```json
{
  "data": {
    "channelReorderWarehouses": {
      "channel": {
        "id": "Q2hhbm5lbDox",
        "warehouses": [
          {
            "id": "V2FyZWhvdXNlOjY4M2FkMzZhLTRmNjktNDI2ZS1iYzUyLTMyZGJiZTQ2NjUyZA==",
            "slug": "americas"
          },
          {
            "id": "V2FyZWhvdXNlOjQwZWY1MTQwLWQ5OTYtNDVlNy04NzUzLTlkZThkMTdhMjg1Yw==",
            "slug": "oceania"
          },
          {
            "id": "V2FyZWhvdXNlOjU1NTZiOWI0LTc1ZTItNGI3YS1hZWM1LTQxOTY4NDA2OGE4OA==",
            "slug": "europe"
          }
        ]
      },
      "errors": []
    }
  }
}
```

<a id="order-settings"></a>

### Order Settings

Channel-level order settings influence how orders behave after being placed (post-checkout or created from draft). You can define auto-confirmation, gift card auto-fulfillment, order expiration, and whether unpaid orders are allowed.

Read more about [order settings](/developer/order/overview.md#channel-specific-settings).

<a id="checkout-settings"></a>

### Checkout Settings

Channel-specific checkout behavior allows you to enable automatic completion of paid checkouts.

Read more about [automatic checkout completion](/developer/payments/transactions.md#automatic-checkout-completion).

<a id="payment-settings"></a>

### Payment Settings

Channel-level payment settings influence how the payment flow is handled. Use `defaultTransactionFlowStrategy` to set the default flow.

Read more about the [transaction strategy](/developer/payments/transaction-flow-strategy.md).

<a id="channel-list"></a>

## Channel List

Because some channels may be considered non-public (for example, a channel for business partners), non-staff users cannot use the [`channels`](/api-reference/channels/queries/channels.md) query.

**Query**

```graphql
query {
  channels {
    name
  }
}
```

**Result**

```json
{
  "data": {
    "channels": [
      {
        "name": "Mobile"
      },
      {
        "name": "Website"
      }
    ]
  }
}
```

<a id="managing-channels"></a>

## Managing Channels

<a id="activate-or-deactivate-a-channel"></a>

### Activate or Deactivate a Channel

To make a channel unavailable for customers, change its status to `deactivated` using the [`channelDeactivate`](/api-reference/channels/mutations/channel-deactivate.md) mutation:

**Mutation**

```graphql
mutation channelDeactivate($id: ID!) {
  channelDeactivate(id: $id) {
    channel {
      name
      isActive
    }
    errors {
      message
    }
  }
}
```

**Variables**

```json
{
  "id": "Q2hhbm5lbDox"
}
```

**Result**

```json
{
  "data": {
    "channelDeactivate": {
      "channel": {
        "name": "Facebook",
        "isActive": false
      },
      "channelErrors": []
    }
  }
}
```

To reverse the previous operation, use the [`channelActivate`](/api-reference/channels/mutations/channel-activate.md) mutation:

**Mutation**

```graphql
mutation channelActivate($id: ID!) {
  channelActivate(id: $id) {
    channel {
      name
      isActive
    }
    errors {
      message
    }
  }
}
```

**Variables**

```json
{
  "id": "Q2hhbm5lbDox"
}
```

**Result**

```json
{
  "data": {
    "channelActivate": {
      "channel": {
        "name": "Facebook",
        "isActive": true
      },
      "channelErrors": []
    }
  }
}
```

<a id="update-channel"></a>

### Update Channel

Use the [`channelUpdate`](/api-reference/channels/mutations/channel-update.md) mutation to edit channel fields such as `name`, `shipping zones` or `settings`.

**Mutation**

```graphql
mutation ChannelUpdate($id: ID!, $input: ChannelUpdateInput!) {
  channelUpdate(id: $id, input: $input) {
    channel {
      id
      slug
      warehouses{
        name
      }
      orderSettings {
        automaticallyConfirmAllNewOrders
      }
      checkoutSettings {
        automaticallyCompleteFullyPaidCheckouts
      }
      paymentSettings {
        defaultTransactionFlowStrategy
      }
    }
    errors {
      field
      code
      message
    }
  }
}
```

**Variables**

```json
{
  "id": "Q2hhbm5lbDoxMjM=",
  "input": {
    "addShippingZones": ["U2hpcHBpbmdab25lOjI=", "U2hpcHBpbmdab25lOjU="],
    "addWarehouses": ["V2FyZWhvdXNlOjc1MjYwYWRjLTJjZjAtNGQ0ZC1hOTM5LTBmZGY2Y2FlYjBjMQ=="],
    "orderSettings": {
      "automaticallyConfirmAllNewOrders": true
    },
    "checkoutSettings": {
      "automaticallyCompleteFullyPaidCheckouts": true
    },
    "paymentSettings": {
      "defaultTransactionFlowStrategy": "CHARGE"
    }
  }
}
```

**Result**

```json
{
  "data": {
    "channelUpdate": {
      "channel": {
        "id": "Q2hhbm5lbDoxMjM=",
        "slug": "us",
        "warehouses": [
          {
            "name": "Americas"
          }
        ],
        "orderSettings": {
          "automaticallyConfirmAllNewOrders": true
        },
        "checkoutSettings": {
          "automaticallyCompleteFullyPaidCheckouts": true
        },
        "paymentSettings": {
          "defaultTransactionFlowStrategy": "CHARGE"
        }
      },
      "errors": []
    }
  }
}
```

<a id="removing-a-channel"></a>

### Removing a Channel

Channels can be removed only when:

-   There are no orders created in them.
-   If there are existing orders, it is required to provide the ID of a destination channel in `ChannelDeleteInput` using the field `channelId`. Its currency must be the same as the channel you are about to delete. All orders will be moved to this channel.

Use [`channelDelete`](/api-reference/channels/mutations/channel-delete.md) to remove channel.

**Mutation**

```graphql
mutation channelDelete($id: ID!, $input: ChannelDeleteInput) {
  channelDelete(id: $id, input: $input) {
    errors {
      field
      code
      message
    }
    channel{
      name
    }
  }
}
```

**Variables**

```json
{
  "id": "Q2hhbm5lbDoxMjI=",
  "input": {
    "channelId": "Q2hhbm5lbDox"
  }
}
```

**Result**

```json
{
  "data": {
    "channelDelete": {
      "errors": [],
      "channel": {
        "name": "us"
      }
    }
  }
}
```
