Skip to content

REST api & sourceId

There are many REST endpoints that require passing a sourceId parameter.

Where do I get the value for sourceId?

https://magento.redoc.ly/2.4.5-admin/tag/inventorysources#operation/GetV1InventorySources

GET https://mymagentodomain.com/rest/V1/inventory/sources
returns

{
    "items": [
        {
            "source_code": "default",
            "name": "Default Source",
            "enabled": true,
            "description": "Default Source",
            "latitude": 0,
            "longitude": 0,
            "country_id": "US",
            "postcode": "00000",
            "use_default_carrier_config": true,
            "carrier_links": [],
            "extension_attributes": {
                "is_pickup_location_active": false,
                "frontend_name": ""
            }
        }
    ],
    "search_criteria": {
        "filter_groups": []
    },
    "total_count": 1
}

Where’s the sourceId ?