Connect a channel

Creating a channel is handing Fenicia access to a marketplace account. That is the only moment the access travels: after it, you refer to the channel by its channelId.

Create a channel

Creates a channel by running the connection flow for the given type

{
  "channel": {
    "type": "walmart",
    "name": "Mi tienda Walmart",
    "credentials": {
      "clientId": "3f1a…",
      "clientSecret": "9c7e…",
      "country": "MX"
    }
  },
  "config": { "locationId": "65f2a0b1c4d5e6f7a8b9c0bb" }
}
201Channel created and connected
{
  "channel": {
    "id": "65f3a1b2c4d5e6f7a8b9c0d1",
    "tenantId": "65f2a0b1c4d5e6f7a8b9c0aa",
    "name": "Mi tienda Walmart",
    "handle": "mi-tienda-walmart",
    "type": "walmart",
    "status": "active",
    "settings": {
      "locationId": "65f2a0b1c4d5e6f7a8b9c0bb"
    },
    "createdAt": "2026-08-19T03:12:44.000Z",
    "updatedAt": "2026-08-19T03:12:44.000Z"
  }
}
400Missing the fulfillment location, required for this type
{
  "code": "bad-request/location-required",
  "message": "A fulfillment location is required to connect this channel",
  "params": "locationId"
}
400Channel type missing or not supported by this route
{
  "code": "bad-request/invalid-channel-type",
  "message": "Channel type is missing or invalid",
  "typesSupported": [
    "shopify",
    "claro-shop",
    "mercado-libre",
    "amazon",
    "woo-commerce",
    "shein",
    "walmart",
    "coppel",
    "t1-comercios",
    "sears",
    "sanborns",
    "tienda-nube"
  ]
}
422The location exists in the request but does not belong to your tenant
{
  "code": "unprocessable-entity/location-invalid",
  "message": "The selected location does not exist for this tenant",
  "params": "locationId"
}
422The marketplace rejected the authorization code
{
  "code": "unprocessable-entity/invalid-connection-code",
  "message": "Invalid connection code"
}
curl -X POST https://api.fenicia.io/channels \
  -H "Authorization: Bearer fkapi_tu_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "channel": { "type": "mercado-libre", "code": "TG-66c1f0e8a5d0ed5c1db25a06-123456789" },
    "config": { "locationId": "65f2a0b1c4d5e6f7a8b9c0bb" }
  }'

Returns the created channel under the channel key, with its credentials already exchanged and persisted.

Required permission: channels:create

Parameters

channelobjectrequired

The channel to create. Note: the authorization data goes INSIDE this object, not at the root of the body.

channel.typeenumrequired

Which marketplace this is. Accepted values: shopify, claro-shop, mercado-libre, woo-commerce, walmart, coppel, t1-comercios, sears, sanborns, tienda-nube. REJECTS tiktok-shop with 400: it completes setup through its own OAuth callback. amazon and shein do appear in typesSupported but their setup is NOT built, see below.

channel.namestring

Display name of the channel. Required except for shein, mercado-libre, amazon and tienda-nube, which derive it from the profile returned by the marketplace, and for shopify when you send intentNonce. Missing where required: 400 bad-request/missing-param.

channel.credentialsobjectestructura libre

The already-resolved access to the account: a token, an API key, or a username/password pair, depending on the type. NOT an authorization_code — a code is only redeemable with the client_id and client_secret it was requested with, and those are yours. It is an open bag (Mixed in the schema) because its shape changes with each type: see the example tabs and the table below.

channel.intentNoncestring

Shopify install-intent nonce, when setup comes from the embedded app. Only for type shopify; if you send it, the channel is finalized from the intent and name is not required.

configobject

Connection configuration. This is where the fulfillment location goes.

config.locationIdstring

ID of the Fenicia location where this channel's orders are fulfilled. Required for 10 of the 10 creatable types — see below.

The fulfillment location is required almost always

A channel that imports orders needs to know where they are fulfilled from. The eight types you connect from here require it, and without it setup fails with 400 bad-request/location-required:

walmart · coppel · woo-commerce · t1-comercios · sears · sanborns · claro-shop · shopify

If the channel was connected from the portal — mercado-libre and tienda-nube — the location is set there. And from this API you can change it whenever you want with PUT /channels/{channelId}/settings.

Four names for the same location

config accepts locationId, ordersLocation, orderBranch and inventoryLocation, and takes the first non-empty one in that order. The last three are historical aliases kept for compatibility; Fenicia normalizes them all to the same canonical value before persisting. Use locationId — the others exist so old integrations do not break, not as design options.

Setup errors

CodeHTTPWhen
bad-request/invalid-channel-type400type missing, or not one of the ten supported
bad-request/missing-param400Missing name on a type that requires it
bad-request/location-required400Missing location on one of the ten types that require it
bad-request/invalid-config400config does not have the shape that type expects
bad-request/missing-url400Missing the store URL (woo-commerce)
unprocessable-entity/location-invalid422The location does not belong to your tenant
unprocessable-entity/invalid-connection-code422The marketplace rejected the authorization code
unprocessable-entity/invalid-api-keys422The marketplace rejected the app keys
unprocessable-entity/intent-not-found422The intentNonce does not exist, was consumed, or expired
server-error/channel-creation-failed500The exchange worked but persistence failed

The shape each channel expects

Each type expects a different body, and what decides which one is who ran the authorization flow. That is the fork, and it is worth having clear before you write a line:

Fenicia's app   →  OAuth  →  returns to app.fenicia.io  →  Fenicia exchanges  →  channel
Your app        →  YOUR OAuth  →  YOU exchange          →  you give us the token  →  channel

The eight types you connect with credentials

You hand Fenicia the already-resolved access, once. If there was an OAuth behind it, you ran it and what you send is its result.

Typechannel.credentialsIf missing
walmart{ clientId, clientSecret, country? } — country defaults to MX; accepts US, MX, CA400 bad-request/missing-param
coppel{ apiKey, shopId, baseUrl? } — baseUrl defaults to https://coppel.mirakl.net/api400 bad-request/missing-param
t1-comercios · sears · sanborns{ storeId, username, password }400 bad-request/missing-param
woo-commerce{ userName, password, storeUrl }400 bad-request/missing-param, or missing-url if the store is missing
claro-shop · shopify (your own app)your application's, passed through as-is422 unprocessable-entity/invalid-api-keys if the marketplace rejects them

Shopify: also, without touching credentials

Shopify has a second route, and it is the only type that does: the install intent. There the merchant installs Fenicia's application, the embedded app attaches the token, and you finalize the channel with a nonce. You never see a credential.

It is described step by step in Shopify install intent.

MercadoLibre and Tienda Nube: today, portal only

These two cannot be connected from this API with your own application. Their setup accepts an authorization_code only, and per the explanation above yours would not be redeemable.

While that remains the case, the connection is made from the Fenicia portal: the merchant authorizes, the flow returns to app.fenicia.io, and Fenicia redeems the code with its own application. The channel gets created and from then on you operate it through this API as usual — sync, publish, query: everything works the same.

The two types that cannot be created today

amazon and shein are real Fenicia marketplaces — their read routes work — but the setup token exchange is not built yet.

`typesSupported` lists them, and they still fail

This is the trap, and there is no way to deduce it from the API: typesSupported returns twelve values, amazon and shein included, but only ten can be created.

Send one of those two without its parameters and you get a 400 asking for them — bad-request/missing-param for Amazon, bad-request/invalid-auth for Shein. Send them complete and the call fails with a server error: there is nothing behind it to run.

Do not retry, and do not build a setup flow against them. Treat them as non-creatable until this page says otherwise.

The summary you need before writing code

TypeHow you connect itname required?Location required?
walmartchannel.credentialsYesYes
coppelchannel.credentialsYesYes
woo-commercechannel.credentialsYesYes
t1-comercioschannel.credentialsYesYes
sears · sanbornschannel.credentialsYesYes
claro-shopchannel.credentialsYesYes
shopify (your own app)channel.credentialsYesYes
shopify (Fenicia app)channel.intentNonceNo — from the storeYes
mercado-librefrom the Fenicia portal——
tienda-nubefrom the Fenicia portal——
amazon · sheincannot be created yet——

Reconnect a channel

When the refresh token dies, the channel stops operating and health.refreshTokenInvalid flips to true. Reconnecting exchanges a fresh authorization code and reactivates the channel, preserving its configuration: location, import settings and product bindings all stay.

Renews a MercadoLibre channel's credentials with a fresh authorization code

{
  "channelId": "65f3a1b2c4d5e6f7a8b9c0d1",
  "authorization_code": "TG-66c1f0e8a5d0ed5c1db25a06-123456789"
}
200Channel reconnected and reactivated
{
  "success": true,
  "channel": {
    "id": "65f3a1b2c4d5e6f7a8b9c0d1",
    "_id": "65f3a1b2c4d5e6f7a8b9c0d1",
    "name": "Mi cuenta MercadoLibre",
    "handle": "mi-cuenta-mercadolibre",
    "type": "mercado-libre",
    "status": "active"
  },
  "message": "Channel reconnected successfully. Credentials have been updated."
}
400The code was already used or expired (10-minute validity)
{
  "code": "oauth/invalid-grant",
  "message": "The authorization code has already been used or has expired. Please try reconnecting again."
}
400A required parameter is missing
{
  "code": "bad-request/missing-param",
  "message": "Missing channelId",
  "params": "channelId"
}
curl -X POST https://api.fenicia.io/channels/reconnect \
  -H "Authorization: Bearer fkapi_tu_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "channelId": "65f3a1b2c4d5e6f7a8b9c0d1",
    "authorization_code": "TG-66c1f0e8a5d0ed5c1db25a06-123456789"
  }'

Returns a summary of the reconnected channel. It does not return the new credentials — they are persisted and stay inside.

Required permission: channels:update

Parameters

channelIdstringrequired

ID of the channel to reconnect. It goes in the body, not the path — this route has no path parameter.

authorization_codestringrequired

Fresh OAuth authorization code. In snake_case, unlike channel.code used at setup.

MercadoLibre only — and this is how you reconnect everything else

Despite the generic name, POST /channels/reconnect routes to MercadoLibre's reconnection. There is no generic reconnect route.

For the other nine creatable types, reconnecting means running setup again: POST /channels with fresh credentials, the same body you used the first time. It does not duplicate the channel — on save, Fenicia upserts by handle (the one derived from the store domain or account), so the existing channel keeps its renewed credentials, its settings, its location and its product bindings.

On Shopify that means repeating the five steps of the install intent, with a fresh nonce.

Errors

The channel is checked before MercadoLibre is touched: if it does not exist, or is of another type, you find out without burning the authorization code — which is single-use.

CodeHTTPWhat happened
not-found/channel404There is no channel with that channelId in your account.
bad-request/channel-type400The channel exists but is not a MercadoLibre one. The message names the actual type.
bad-request/missing-param400channelId or authorization_code is missing.

Exchange errors start with oauth/ and return 400. Any other failure returns 500.

CodeWhat happened
oauth/invalid-grantThe code was already used or expired. Valid for 10 minutes, single use.
oauth/invalid-clientThe application credentials are invalid. The merchant cannot fix this.
oauth/invalid-scopeThe requested scope is not valid.
oauth/invalid-requestThe OAuth request is malformed.
oauth/token-exchange-failedGeneric exchange failure.

If the MercadoLibre account changed

Fenicia compares the new token's user_id against the one the channel had. If they differ, the reconnection proceeds anyway and only a warning is written to the log. That is: you can reconnect a channel pointing it at a different account, and the API will not stop you. If that matters in your flow, compare it yourself before reconnecting.

Shopify install intent

Connecting Shopify takes five steps and three actors, and only two of the steps are yours. The install intent is the token that ties the two halves of the flow together.

Who does what

#StepWho does it
1POST /channels/shopify/install-intents → you get a nonceYou, with your API key
2The merchant installs the Fenicia app on their store and authorizes itThe merchant, on Shopify
3The Shopify token is attached to the intent, which becomes authenticatedFenicia's embedded app, with its own secret
4The merchant returns to your returnUrlShopify / the embedded app
5POST /channels with channel.intentNonce → the channel is createdYou, with your API key

Step 5 fails if step 3 has not finished — and the error does not distinguish it

POST /channels with an intentNonce requires the intent to already be authenticated, that is, for the embedded app to have attached the token. If you call earlier, you get:

422 unprocessable-entity/intent-not-found

That single code means four different things: the nonce does not exist, it was already consumed, it expired, or it is not authenticated yet. The response does not separate them.

Practical consequence: do not fire step 5 on a timer. Fire it when the merchant lands on your returnUrl, which is the signal that step 3 finished. And if you still get the 422, retrying a moment later is reasonable once — beyond that, assume the intent is dead and start again from step 1.

Registers a single-use install intent before redirecting to Shopify

{
  "shop": "mi-tienda.myshopify.com",
  "returnUrl": "https://app.fenicia.io/channels/shopify/done"
}
201Intent registered
{
  "nonce": "d3f1a9c2b8e74a15",
  "expiresAt": "2026-08-19T04:12:44.000Z"
}
400The store domain is not valid
{
  "code": "bad-request/invalid-shop",
  "message": "shop must be a valid Shopify subdomain (got \"mi tienda\")"
}
401The API key did not resolve to a user
{
  "code": "bad-request/missing-user",
  "message": "No user identity found in the authorizer context"
}
400The return URL is not on the allowlist
{
  "code": "bad-request/return-url-not-allowed",
  "message": "returnUrl host not in allowlist"
}

Returns the nonce and its expiresAt. The nonce is consumed when the channel is created and cannot be reused; past that time, POST /channels returns 422 unprocessable-entity/intent-not-found — the same code as if it had never existed. Register the intent as close to the redirect as you can.

Required permission: channels:create

Parameters

shopstringrequired

Shopify store domain. It is normalized; if it is not a valid myshopify.com subdomain, it returns 400 bad-request/invalid-shop.

returnUrlstringrequired

Where to come back to when the install finishes. It is validated against an allowlist; see below which code each case returns.

The two `returnUrl` codes do NOT split the way you would expect

  • bad-request/invalid-return-url covers only the field being empty or not a string. Nothing else.
  • bad-request/return-url-not-allowed covers everything else, including a malformed URL. Its message is dynamic and says exactly what failed.

That is: "not-a-url" returns return-url-not-allowed, not invalid-return-url — the code name suggests the opposite.

The second one's possible messages: returnUrl is required · returnUrl must be an absolute URL · returnUrl protocol must be http or https · returnUrl must use https in production · returnUrl host not in allowlist · fenicia.io returnUrl must use https · localhost returnUrl must use port 5179.

Next steps

  • Errors — the domain's full code catalog.