Merchant API: how to retrieve the channelId
About this article
This article explains how to retrieve your channel IDs with the GET /v2/channel endpoint of the Merchant API, how the response is structured, and how to use the IDs in other Merchant API endpoints.
Table of contents
Using channel IDs in other endpoints
Introduction
Many Merchant API endpoints ask for a channel ID (the number ChannelEngine uses to identify one of your marketplace connections). You need it to filter your returns by marketplace, or to see which products are listed on a specific marketplace. Looking up these IDs by hand does not scale, and hard-coding them makes your integration fragile.
The channels endpoint returns the full list in one call. Use it to find the ChannelId you need for other endpoints, to check which channels are enabled, or to keep a channel list in your own system in sync.
Requirements
-
Tenant URL: the base URL is
https://{tenant}.channelengine.net/api. -
Merchant API key: the unique code that identifies your account to ChannelEngine. Send it in the
X-CE-KEYheader. Find it at Settings, Merchant API keys.
Available API endpoints
One endpoint returns your channels.
-
Retrieve channels:
GET /v2/channels
Use this endpoint to retrieve the complete list of channels in your ChannelEngine account, grouped by global channel. The endpoint takes no parameters. You send your API key and receive the full list.
IsEnabled or CountryCode.
Channels and global channels
ChannelEngine uses two levels to describe a marketplace connection. The response groups them for you, so it helps to know the difference.
-
GlobalChannelId- the ID of a global channel on ChannelEngine, with a specific country and language, e.g.: Amazon NL. A global channel has aCountryCodeand aLanguageCode. The ChannelEngine team names the channel inGlobalChannelNameand can change this name without notice to you. -
ChannelId- the ID of your instance of a global channel and is the ID that other Merchant API endpoints ask for. Your channel instance has an enabled or disabled status; you name it inChannelName, and you can change this name in the ChannelEngine web interface at any time.
IsEnabled is false). If your integration loops over all channels, check this value first, so you do not request data for channels that you do not use.
Names and IDs
Both levels have a name and an ID. They look similar, but they behave differently.
| Field | Who sets it | Can it change? | Use it in code? |
GlobalChannelId |
ChannelEngine | No | Yes |
ChannelId |
ChannelEngine | No | Yes |
GlobalChannelName |
The ChannelEngine team | Yes, ChannelEngine can adjust it | No, use it as a display label only |
ChannelName |
You | Yes, you can change it in the ChannelEngine UI | No, use it as a display label only |
GlobalChannelId and ChannelId, never with the names. The IDs cannot be updated. The names can change at any time, by you or by ChannelEngine. If use a name in your code, your integration can silently stop working after a rename.
Which ID to use
Every channel belongs to a global channel. Therefore, every channel has both a GlobalChannelId and a ChannelId.
Use the ChannelId in filters, URLs, and request bodies of other Merchant API endpoints. Do not replace it with the GlobalChannelId.
Use the combination of GlobalChannelId and ChannelId only to identify channels in your own system when you have multiple channels of the same marketplace. For example, if you have three Amazon.de channels, they share one , GlobalChannelId and each has its own ChannelId. The combination tells you which overall channel a specific channel on your dashboard belongs to.
Retrieving your channels
- Send a request to
GET /v2/channelswith your key in theX-CE-KEYheader. You receive HTTP 200 withSuccess: true. - Read the global channels in
Content. Each item has aChannelslist with your channels for that global channel. Each channel shows itsChannelId,ChannelName, andIsEnabledvalue. - Store the IDs you need. Use the
ChannelIdin the endpoints described in Using channel IDs in other endpoints.
Example request
curl -X GET "https://{tenant}.channelengine.net/api/v2/channels" \
-H "Accept: application/json" \
-H "X-CE-KEY: YOUR_MERCHANT_API_KEY"Example response
{
"Content": [
{
"GlobalChannelId": 1,
"GlobalChannelName": "Amazon NL",
"CountryCode": "NL",
"LanguageCode": "nl",
"Channels": [
{
"ChannelId": 12,
"ChannelName": "Amazon NL",
"IsEnabled": true,
"Reference": null
}
]
},
{
"GlobalChannelId": 2,
"GlobalChannelName": "Bol.com",
"CountryCode": "NL",
"LanguageCode": "nl",
"Channels": [
{
"ChannelId": 27,
"ChannelName": "Bol.com",
"IsEnabled": false,
"Reference": null
}
]
}
],
"Count": 2,
"TotalCount": 2,
"ItemsPerPage": 2,
"StatusCode": 200,
"Success": true
}Response fields
Global channel fields
Each item in Content is a global channel.
| Field | Type | Description |
GlobalChannelId |
integer | The ID of the global channel. It cannot be updated. |
GlobalChannelName |
string | The name the ChannelEngine team uses for the global channel. ChannelEngine can change it, so do not use it to identify a channel. |
CountryCode |
string | The country code of the global channel. |
LanguageCode |
string | The language code of the global channel. |
Channels |
array | The channels that belong to this global channel. See the channel fields below. |
Channel fields
| Field | Type | Description |
ChannelId |
integer | The ID of the channel. It cannot be updated. Use it to identify the channel in your code and in other endpoints. |
ChannelName |
string | The name you use for the channel. You can change it in the ChannelEngine UI, so do not use it to identify a channel. |
IsEnabled |
boolean |
true if the channel is enabled, false if it is not. |
Reference |
string | A reference for the channel. The value can be empty. |
Standard collection fields
| Field | Description |
Count |
Number of items in this response. |
TotalCount |
Total number of items. |
ItemsPerPage |
Maximum number of items per page. |
StatusCode |
The HTTP status code. |
Success |
true if the request succeeded. Check this field as well as the HTTP status. |
Message, ExceptionType, ValidationErrors
|
Details about a failed request. Empty when Success is true. |
RequestId, LogId
|
Reference IDs for the request. Include them when you contact your ChannelEngine contact. |
Using channel IDs in other endpoints
You use a ChannelId in other Merchant API endpoints in one of two ways. Either you read data for a channel, or you change something on a channel. The ID appears in different places: in the URL path, in the query string, or in the request body. Filters that accept several IDs are called ChannelIds.
Endpoints for reading data per channel
These requests filter or look up data per channel. Almost all are GET requests, and nothing changes on ChannelEngine or on the marketplace.
| Endpoint | Channel ID | Use it to |
GET /v2/orders |
Filter: ChannelIds
|
Fetch orders from specific channels. Each order also shows its ChannelId. |
GET /v2/orders/new |
Response only | See which channel each new order came from. |
GET /v2/returns |
Filter: ChannelIds
|
Fetch all returns for specific channels. |
GET /v2/returns/merchant |
Filter: ChannelIds
|
Fetch marketplace returns for specific channels. |
GET /v2/returns/merchant/new |
Filter: ChannelIds
|
Fetch unhandled marketplace returns for specific channels. |
GET /v2/returns/merchant/{merchantOrderNo} |
Response only | See which channel a return belongs to. |
GET /v2/shipments/merchant |
Response only | See which channel a shipment belongs to. |
GET /v2/settlements |
Filter: ChannelIds
|
Fetch settlements for specific channels. |
GET /v2/orders/documents |
Filter: ChannelIds
|
Fetch order documents for specific channels. |
GET /v2/orders/documents/file |
Query: ChannelId
|
Get the document file for an order on a channel. |
GET /v2/purchase-orders |
Filter: ChannelIds
|
Fetch purchase orders for specific channels. |
GET /v2/purchase-orders/shipments/merchant |
Query: ChannelId
|
Fetch purchase order shipments for a channel. |
GET /v2/channels/{channelId}/products |
Path: channelId
|
See the products listed on a channel. |
GET /v2/offer/{channelId}/product-level-stock-limitations |
Path: channelId
|
See the product-level stock limitations set for a channel. |
GET /v2/competitionprices/buyboxprices |
Query: ChannelId
|
See the price of the buy box winner for a marketplace. |
GET /v2/reports/available |
Query: channelId (optional) |
List the available reports for a report type, for one channel. |
GET /v2/auditlogs |
Filter: ChannelIds
|
Fetch audit logs for specific channels. Only available to a selected set of tenants. |
GET /v2/product-attribute-group/linked-channels |
Response only | See which channels are linked to each custom attribute group. |
Endpoints for changing data on a channel
For these requests, the channel ID tells ChannelEngine where to apply a change. These are POST, PUT, and DELETE requests, and the change applies to that channel only.
| Endpoint | Channel ID | Use it to |
POST /v2/offer/{channelId}/product-level-stock-limitations |
Path: channelId
|
Set a stock limit or stock buffer per product and stock location for this channel. |
DELETE /v2/offer/{channelId}/product-level-stock-limitations |
Path: channelId
|
Remove the product-level stock limitations for this channel. |
POST /v2/settlements/upload |
Query: channelId
|
Upload a settlement file for a channel. |
POST /v2/targets |
Body: ChannelId
|
Create targets for a channel. |
PUT /v2/targets |
Body: ChannelId
|
Edit targets for a channel. |
DELETE /v2/targets |
Body: ChannelId
|
Delete targets for a channel. |
POST /v2/orders/documents/acknowledge |
Body: ChannelId
|
Confirm that you received a document. |
POST /v2/purchase-orders/invoice |
Body: ChannelId
|
Create a purchase order invoice on a channel. |
POST /v2/purchase-orders/invoice/bulk |
Body: ChannelId
|
Create purchase order invoices in bulk. |
POST /v2/purchase-orders/shipments |
Body: ChannelId
|
Create a purchase order shipment. |
PUT /v2/purchase-orders/shipments |
Body: ChannelId
|
Update a purchase order shipment. |
POST /v2/purchase-orders/lines/acknowledge |
Body: ChannelId
|
Acknowledge lines of a purchase order. |
ChannelId before you send an action request. A wrong ID applies your change to the wrong channel. Get the ID from GET /v2/channels instead of typing it by hand.
Stock updates
The endpoints that update your stock, PUT /v2/offer/stock and PUT /v2/offer, work with a stock location ID and not with a channel ID. To find your stock location IDs, use GET /v2/stocklocations.
The only endpoint that enables you to manage stock limits on the channel level is the product-level stock limitations endpoint, POST /v2/offer/{channelId}/product-level-stock-limitations.
Testing your setup
Test in your development environment before you go live.
- Call
GET /v2/channelswith your Merchant API key. Expect HTTP 200 andSuccess: true. - Compare the list with the channels in your ChannelEngine account. Expect each channel you use under its global channel, with the right
IsEnabledvalue. - Use one ID in another call, e.g.:
GET /v2/channels/{channelId}/products. Expect HTTP 200 with the products listed on that channel.
Common issues
| What you see | Likely cause and fix |
HTTP 401 or Success: false
|
The API key is missing or wrong. Use a Merchant API key in the X-CE-KEY header. |
| Your integration stops matching a channel after a rename | Your code matches on ChannelName or GlobalChannelName. Both names can change. Match on ChannelId and GlobalChannelId instead. |
| A channel is missing from the list | Check that you use the right tenant URL and API key. If the channel should be there, contact your ChannelEngine contact. |
Another endpoint returns no data for a ChannelId
|
Check that the channel is enabled, and that you used the ChannelId and not the GlobalChannelId. |
| Stock updates do not apply to one channel | Stock update endpoints use stock locations, not channels. To limit stock for one channel, use the product-level stock limitations endpoint. |
Still stuck? Contact your ChannelEngine contact and include the RequestId and LogId from the response.
Next steps
-
Managing returns via the Merchant API: filter your returns by channel with the
ChannelIdsparameter. - Retrieving listed products via the Merchant API: see which products are listed on a channel.
- Managing orders via the Merchant API: fetch, acknowledge, and ship your orders.
Comments
0 comments
Article is closed for comments.