概述
REST Admin API 是 SHOPLINE 为应用提供的标准数据通道,用于访问和管理店铺数据。在调用 REST Admin API 之前,你的应用必须先获取店铺授权。授权完成后,你需使用获取到的 access token 在已授权的权限范围内发起接口请求。
店铺授权
店铺授权分为私有应用授权、自定义应用授权和公共应用授权。其中,自定义应用授权和公共应用授权采用 OAuth 2.0 授权。当授权成功后,你 可以获得包含指定 AccessScope(权限点)的 access token。
自定义应用和公共应用
自定义应用和公共应用的 access token 可以通过 OAuth 2.0 授权获取。
- 有效期:10 小时。你需要检查 access token 是否即将过期,并在过期前调用 刷新令牌 接口刷新。
- 失效机制:access token 被刷新后,原 access token 不会立即失效,而是在 5 分钟后失效。
私有应用
私有应用的 access token 需要在 SHOPLINE 商家后台获取。
-
登录 SHOPLINE 商家后台。
-
点击左侧导航栏中的 应用,然后点击右上角的 开发应用。

-
在 开发应用 页面,点击对应应用的 编辑。

-
点击 API 凭据,即可获取对应应用的 access token。

私有应用的 access token 机制如下:
- 有效期:3 年。access token 即将过期时,店铺邮箱会收到提醒邮件,你需要前往 SHOPLINE 商家后台刷新 access token。
- 失效机制:access token 刷新后,原 access token 不会立即失效,而是在 30 分钟后失效。
- 解除授权:如需取消店铺授权,你需要前往 SHOPLINE 商家后台删除应用。删除应用后,原 access token 将立即失效。
版本选择
REST Admin API 会按时间窗口滑动维持 8 个版本。你可以参考 版本说明,在页面右上角切换合适的版本进行调用。
不同版本的 REST Admin API 会带有不同的版本号。例如,调用 v20260901 版本的 批量查询商品,请求地址格式如下:
https://{handle}.myshopline.com/admin/openapi/v20260901/products/products.json
其中,v20260901 为版本号。
接口调用
当你授权成功获得 access token,并且选定好接口版本后,就可以在程序中调用 REST Admin API。下面以调用 v20260901 版本的 批量查询商品 为例。
请求示例
curl --location --request GET 'https://{handle}.myshopline.com/admin/openapi/v20260901/products/products.json' \
--header 'Authorization: Bearer {accessToken}'
其中,accessToken 为你通过授权获得的有效 access token。
成功响应示例
{
"products": [
{
"path": "/products/multi-color-stitching-dress",
"product_behavior": "",
"id": "16070259818748421542564095",
"options": [
{
"option_values": [
{
"id": "16270259818752783618824095",
"value": "Yellow"
},
{
"id": "16270259818752783618964095",
"value": "Black"
},
{
"id": "16270259818752783619034095",
"value": "Grey"
}
],
"product_id": "16070259818748421542564095",
"values": [
"Yellow",
"Black",
"Grey"
],
"values_colors": {},
"values_images": {},
"id": "16170259818752783618814095",
"name": "Color"
},
{
"values_images": {},
"id": "16170259818752783618844095",
"name": "Size",
"option_values": [
{
"id": "16270259818752783618854095",
"value": "S"
},
{
"id": "16270259818752783618914095",
"value": "M"
},
{
"id": "16270259818752783618984095",
"value": "L"
}
],
"product_id": "16070259818748421542564095",
"values": [
"S",
"M",
"L"
],
"values_colors": {}
}
],
"published_at": "2025-06-05T15:41:02+08:00",
"standard_category_id": "",
"template_path": null,
"media": [
{
"id": "7025981872526871687",
"preview_image": null,
"src": "https://img.myshopline.com/image/store/1749109647423/harperwu-A-young-20-year-old-European-and-American-girl-wearing-419899a9-4f73-42a4-b3ff-57107ee49ae3.png?w=1024&h=1024",
"alt": null,
"caption": null,
"content_type": "IMAGE"
}
],
"featured_media": {
"alt": null,
"caption": null,
"content_type": "IMAGE",
"id": "7025981872526871687",
"preview_image": null,
"src": "https://img.myshopline.com/image/store/1749109647423/harperwu-A-young-20-year-old-European-and-American-girl-wearing-419899a9-4f73-42a4-b3ff-57107ee49ae3.png?w=1024&h=1024"
},
"handle": "multi-color-stitching-dress",
"combined_listing": null,
"is_gift_card": false,
"created_at": "2025-06-05T15:41:02+08:00",
"product_category": null,
"tags": "Hot Sale",
"title": "Multi-color stitching dress",
"updated_at": "2025-06-05T15:41:05+08:00",
"images": [
{
"src": "https://img.myshopline.com/image/store/1749109647423/harperwu-A-young-20-year-old-European-and-American-girl-wearing-419899a9-4f73-42a4-b3ff-57107ee49ae3.png?w=1024&h=1024",
"alt": null,
"id": "7025981872526871687"
}
],
"published_scope": "web",
"spu": null,
"variants": [
{
"sku": "240",
"barcode": "273847",
"inventory_policy": "continue",
"id": "18070259818752783618794095",
"image": null,
"option4": null,
"product_id": "16070259818748421542564095",
"weight_unit": "g",
"inventory_tracker": true,
"option5": null,
"position": 1,
"taxable": true,
"weight": "500.00",
"option1": "Yellow",
"option2": "S",
"title": "Yellow · S",
"inventory_item_id": "7025981877056704002",
"required_shipping": true,
"option3": null,
"price": "100.00",
"inventory_quantity": 100,
"compare_at_price": "56.00"
},
{
"product_id": "16070259818748421542564095",
"compare_at_price": "56.00",
"inventory_tracker": true,
"required_shipping": true,
"option5": null,
"image": null,
"option1": "Yellow",
"inventory_quantity": 100,
"sku": "242",
"position": 2,
"taxable": true,
"title": "Yellow · M",
"weight": "300.00",
"inventory_policy": "continue",
"option3": null,
"id": "18070259818752783618884095",
"option2": "M",
"option4": null,
"weight_unit": "g",
"inventory_item_id": "7025981877073481222",
"barcode": null,
"price": "100.00"
},
{
"price": "100.00",
"sku": "244",
"weight": "700.00",
"option5": null,
"position": 3,
"id": "18070259818752783618944095",
"option2": "L",
"option4": null,
"inventory_quantity": 100,
"title": "Black · L",
"weight_unit": "g",
"compare_at_price": "56.00",
"inventory_tracker": true,
"taxable": true,
"inventory_item_id": "7025981877056704004",
"required_shipping": true,
"option3": null,
"option1": "Black",
"product_id": "16070259818748421542564095",
"barcode": "273847",
"inventory_policy": "continue",
"image": null
},
{
"option2": "S",
"option4": null,
"title": "Grey · S",
"required_shipping": true,
"barcode": "273847",
"inventory_policy": "continue",
"price": "100.00",
"inventory_quantity": 100,
"weight_unit": "g",
"sku": "241",
"option3": null,
"option5": null,
"position": 4,
"id": "18070259818752783619014095",
"product_id": "16070259818748421542564095",
"taxable": true,
"inventory_item_id": "7025981877056704000",
"inventory_tracker": true,
"weight": "700.00",
"option1": "Grey",
"compare_at_price": "56.00",
"image": null
}
],
"vendor": null,
"status": "archived",
"combined_listing_role": null,
"product_type": "NORMAL",
"body_html": "<div class=\"xxkkk2\" style=\"margin: 0px; padding: 0px; box-sizing: border-box; font-family: ProximaNova-Regular; line-height: 1.7; letter-spacing: 1px; white-space: normal; background-color: rgb(255, 255, 255); color: rgb(45, 45, 45); font-size: 14px;\">\n<div class=\"xxkkk2\" style=\"margin: 0px; padding: 0px; box-sizing: border-box; line-height: 1.7;\"><span style=\"margin: 0px; padding: 0px; box-sizing: border-box; font-family: Arial;\"><span style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif; line-height: 1.7;'>Style:</span> Cozy<br style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: \"Noto Serif\", \"Noto Sans\", serif;'></span></div>\n<div class=\"xxkkk\" style=\"margin: 0px; padding: 0px; box-sizing: border-box; line-height: 1.7;\"><div class=\"xxkkk20\" style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: \"Noto Serif\", \"Noto Sans\", serif; line-height: 1.7;'>\n<p style='margin-top: 0px; margin-bottom: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif; line-height: 1.7;'><span style=\"margin: 0px; padding: 0px; box-sizing: border-box; font-family: Arial;\"><span style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif; line-height: 1.7;'>Occasion:Casual & Street</span></span></p>\n<span style=\"margin: 0px; padding: 0px; box-sizing: border-box; font-family: Arial;\"><span style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif; line-height: 1.7;'>Material:Polyester</span><br style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif;'><span style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif; line-height: 1.7;'>Length:</span> Medium<br style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif;'><span style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif; line-height: 1.7;'>Sleeves Length:Long Sleeves</span><br style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif;'><span style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif; line-height: 1.7;'>Pattern Type:Mixed Color</span><br style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif;'><span style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif; line-height: 1.7;'>Material Stretch:Slight Stretch</span><br style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif;'><span style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif; line-height: 1.7;'>Season:</span> Fall<br style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif;'><span style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif; line-height: 1.7;'>With Belt:No</span><br style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif;'><span style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif; line-height: 1.7;'>Weight:0.310kg</span><br style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif;'><span style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif; line-height: 1.7;'>Package:</span> 1 x Dress</span>\n</div></div>\n<div class=\"xxkkk20\" style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: \"Noto Serif\", \"Noto Sans\", serif; line-height: 1.7;'><span style=\"margin: 0px; padding: 0px; box-sizing: border-box; font-family: Arial;\"></span></div>\n</div><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px; box-sizing: border-box; font-family: ProximaNova-Regular; line-height: 1.7; letter-spacing: 1px; white-space: normal; color: rgb(45, 45, 45); font-size: 14px;\"><span style=\"margin: 0px; padding: 0px; box-sizing: border-box; font-family: Arial;\"><strong style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif;'><br style=\"margin: 0px; padding: 0px; box-sizing: border-box;\">Please Note:</strong><br style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif;'></span></p><div id=\"ext_statement\" style=\"margin: 0px; padding: 0px; box-sizing: border-box; font-family: ProximaNova-Regular; white-space: normal; color: rgb(45, 45, 45); font-size: 14px;\">\n<div class=\"xxKKK2\" style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif;'><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px; box-sizing: border-box; line-height: 20px;\"><span style=\"margin: 0px; padding: 0px; box-sizing: border-box; font-family: Arial;\">Due to possible physical differences between different monitors (e.g. models, settings, color gamut, panel type, screen glare, etc), the product photography is illustrative only and may not precisely reflect the actual color of the item received.<br style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif;'></span></p></div>\n<div class=\"xxKKK2\" style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif;'>\n<span style=\"margin: 0px; padding: 0px; box-sizing: border-box; font-family: Arial;\"><strong style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif;'>Style and Fit Disclaimer:</strong><br style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif;'></span><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px; box-sizing: border-box; line-height: 20px;\"><span style=\"margin: 0px; padding: 0px; box-sizing: border-box; font-family: Arial;\">We can guarantee that the overall style displayed in the photography is accurate, however there may be differences in how the style appears during wear. This depends on other physical variables, e.g. personal body size, body shape, limb proportion, height, etc.<br style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif;'><strong style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif;'>Instruction:</strong><br style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif;'></span></p>\n</div>\n<div class=\"xxKKK2\" style='margin: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif;'><span style=\"margin: 0px; padding: 0px; box-sizing: border-box; font-family: Arial;\">There may be 1 - 3cm differ due to manual measurement. Please choose the right one according to your actual situation.</span></div>\n</div><p style='margin-top: 0px; margin-bottom: 0px; padding: 0px; box-sizing: border-box; font-family: andy-money, \"Noto Sans TC\", system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif; line-height: 20px;'><br style=\"margin: 0px; padding: 0px; box-sizing: border-box; color: rgb(51, 51, 51); font-size: 14px; white-space: normal; background-color: rgb(255, 255, 255);\"></p><p><br></p>",
"image": {
"alt": null,
"id": "7025981872526871687",
"src": "https://img.myshopline.com/image/store/1749109647423/harperwu-A-young-20-year-old-European-and-American-girl-wearing-419899a9-4f73-42a4-b3ff-57107ee49ae3.png?w=1024&h=1024"
},
"subtitle": ""
}
]
}
失败响应示例
HTTP/1.1 401 Unauthorized
{
"errors": "ACCESS_TOKEN is expired!"
}
当请求失败时,你可以根据返回的 HTTP 状态码 和错误信息决定是否重试请求。
注意事项
在调用 REST Admin API 时,需要遵循如下数据传输和格式规范。
- 当你请求的接口需要分页查询时,可参考 分页机制。
- REST Admin API 的响应大小上限为 8 MB,建议结合分页机制控制单次请求返回的数据量。
- 请求和响应中的时间类型字段都遵循 ISO 8601 标准。
- 在处理响应数据时,你需要根据业务将时间转换成对应的时区。可结合 查询店铺信息 接口返回的
iana_timezone(店铺所在时区)字段进行转换。
调用限制
当出现以下场景时,SHOPLINE 会限制你的请求:
- 店铺冻结、店铺打烊或店铺套餐过期。
- 你的请求频率超过了 REST Admin API 的 流控限制。