Connections

Update fulfillment mapping

Replaces the warehouses that feed the marketplace stock locations.

PATCH
/v1/connections/{id}/fulfillment-mapping

Read inventory and locations

  • MockDevelopment only
  • Mercado LivreNot supported
  • MagaluPlanned
  • AmazonPlanned
  • TikTok ShopPlanned
  • ShopeePlanned

Send entries with locationId and warehouseIds. Only the locations you send are replaced; the omitted ones stay as they are. warehouseIds: [] clears that location's mapping, whatever its type and status. The answer is the whole mapping.

curl -X PATCH "$BACKEND_URL/v1/connections/$CONNECTION_ID/fulfillment-mapping" \
  -H "Authorization: Bearer mk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"entries":[{"locationId":"'$LOCATION_ID'","warehouseIds":["'$WAREHOUSE_ID'"]}]}'

Errors

  • 404: location from another Connection, or warehouse from another seller.
  • 400: marketplace_fulfillment location (read-only), a warehouse repeated in two locations, a warehouse that already feeds another location of the Connection that the request does not send (the error names that location), or a missing location with warehouses (it only accepts []).
  • 409 warehouse_archived: the warehouse is archived.
  • 422 CAPABILITY_UNSUPPORTED: the marketplace does not support inventory.read (today, Mercado Livre).

Notes

  • It publishes what changed location by itself. When a warehouse enters, leaves or switches location, marketapi creates an automatic inventory.publish job for the Variants with balance in those warehouses, and for the kits that depend on them, on this Connection only. The response does not wait for the job. There is no job if nothing changed or if the Connection is not active (the reconnection publishes later). If the mapping is left with no mapped location, there is a job only when a location lost its last warehouse and already received a quantity above 0 from us: it gets 0 once (see Locations at the marketplace). Clearing the last location of the mapping also creates that job. Listings with manual stock do not receive it: use Resend stock.
  • At most 100 entries and 100 warehouseIds per location; above that, 400 VALIDATION_ERROR.
  • A mapped warehouse cannot be archived: remove it from the mapping first.
  • Only a real change fires the connection.updated webhook, one per request. A PATCH that changes nothing emits nothing.

Authorization

api_key
headerAuthorizationBearer <token>

API key (mk_...)

Path Parameters

id*string

Identifier of the resource, as returned by the API.

Match^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Formatuuid

Request Body

application/json
  1. body

Replaces the warehouses of the locations listed. When a warehouse starts or stops feeding a location, the stock held there is published in the background.

entries*array<>

The locations to change, from 1 to 100. A location left out keeps its warehouses.

Items1 <= items <= 100

Response Body

The whole mapping after the change, as GET shows it. The locations sent are replaced all together or not at all; the ones left out keep their warehouses, and warehouseIds: [] clears a location of any type and status. A warehouse feeds at most one location of a connection, and it may feed one of each connection. A request that changes no location (the warehouses sent are the ones it already has) changes nothing and emits nothing. When a warehouse starts or stops feeding a location, the stock of the variants held there is published to the marketplace in the background, as an inventory.publish job, for the listings whose inventory sync is automatic; the answer does not wait for it. Works on a revoked connection, so its warehouses can be released (nothing is published there). Emits connection.updated when the mapping changes.

application/json
  1. response

Which warehouses of the seller feed which stock location of this connection.

connectionId*string

The connection this mapping belongs to.

Match^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Formatuuid
entries*array<>

One entry per active seller_location of the connection, ordered by the location externalId, including the ones with no warehouse yet, plus any other location (marketplace fulfillment, or missing) that still holds warehouses mapped before it changed.

curl -X PATCH "https://example.com/v1/connections/3d1c8a52-7f0e-4b0a-8a65-9c1b2f6d7e01/fulfillment-mapping" \  -H "Content-Type: application/json" \  -d '{    "entries": [      {        "locationId": "5d0c8e2a-7b41-4f36-9a58-1c2e3f4a5b6c",        "warehouseIds": [          "b7e2a1c4-5d3f-4e8a-9b6c-2f1d0a8e7c35"        ]      }    ]  }'
{  "connectionId": "9a1b2c3d-4e5f-4a6b-8c7d-0e1f2a3b4c5d",  "entries": [    {      "location": {        "id": "5d0c8e2a-7b41-4f36-9a58-1c2e3f4a5b6c",        "connectionId": "9a1b2c3d-4e5f-4a6b-8c7d-0e1f2a3b4c5d",        "externalId": "mock-main",        "type": "seller_location",        "name": "Main location",        "isPrimary": true,        "status": "active",        "marketplaceData": {},        "syncedAt": "2026-10-12T06:00:00.000Z",        "createdAt": "2026-10-12T06:00:00.000Z",        "updatedAt": "2026-10-12T06:00:00.000Z"      },      "warehouseIds": [        "b7e2a1c4-5d3f-4e8a-9b6c-2f1d0a8e7c35"      ]    },    {      "location": {        "id": "8e1f2a3b-4c5d-4e6f-8a7b-9c0d1e2f3a4b",        "connectionId": "9a1b2c3d-4e5f-4a6b-8c7d-0e1f2a3b4c5d",        "externalId": "mock-secondary",        "type": "seller_location",        "name": "Secondary location",        "isPrimary": false,        "status": "active",        "marketplaceData": {},        "syncedAt": "2026-10-12T06:00:00.000Z",        "createdAt": "2026-10-12T06:00:00.000Z",        "updatedAt": "2026-10-12T06:00:00.000Z"      },      "warehouseIds": []    }  ]}