CA Trade Lookup
🏠 首页 API文档
⭐ 0

加拿大 HS Code 与税率智能查询

搜索加拿大海关税则,为进口到加拿大的任何产品查找 HS Code 和适用税率

Try:

Search Results

Showing 4 results for "Fresh Atlantic Salmon"
0302.11.00

Fresh Atlantic Salmon

Salmonidae, fresh or chilled, excluding fillets, meat, livers and roes

Chapter 03 Fish & Crustaceans ✓ Exact Match
MFN: Free · GST: 5%
GST 5%
View Details ›
0302.14.00

Pacific Salmon (Sockeye, Coho, Chinook)

Pacific salmon species, fresh or chilled, whole or in pieces

Chapter 03 Fish & Crustaceans ✓ Exact Match
MFN: Free · GST: 5%
GST 5%
View Details ›
0303.11.00

Frozen Sockeye Salmon

Sockeye salmon (Oncorhynchus nerka), frozen, excluding fillets

Chapter 03 Fish & Crustaceans – Related
MFN: Free · GST: 5%
GST 5%
View Details ›
0304.42.00

Salmon Fillets, Fresh

Fresh or chilled fillets and other meat of salmonidae, fresh

Chapter 03 Fish & Crustaceans – Related
MFN: Free · GST: 5%
GST 5%
View Details ›

Semantic Search

Describe your product in natural language — our AI maps it to the correct HS code classification automatically.

Complete Duty Breakdown

View MFN rates, GST, PST, and any applicable preferential tariff treatments (CUSMA, CPTPP, etc.).

REST API Access

Integrate HS code lookup into your own systems with our developer-friendly API. Rate-limited free tier available.

API 开发者文档

通过 REST API 批量提交 HS Code 查询任务,支持 Webhook 回调通知

Base URL https://hscode.proxy.jiayouexp.com/api

0 快速开始

Step 1: 获取 API Key

登录后前往「个人中心 → API Keys」创建你的 API Key 和 Secret。

📌 每个用户最多创建 10 个 API Key,Secret 仅在创建时显示一次,请务必妥善保存。

Step 2: 提交查询

cURL
curl -X POST https://hscode.proxy.jiayouexp.com/api/api/submit \
  -H "X-Api-Key: sk_your_api_key" \
  -H "X-Api-Secret: your_api_secret" \
  -H "Content-Type: application/json" \
  -d '{"products": ["Fresh Atlantic Salmon"]}'

Step 3: 获取结果

任务提交后通过以下两种方式获取结果:

  • 轮询:调用 GET /api/api/tasks 查询任务状态
  • Webhook:配置回调 URL,任务完成后自动推送结果

1 鉴权规则

API 支持两种鉴权方式(二选一):

方式一:API Key(推荐)

在请求头中携带 API Key 和 Secret:

Request Headers
X-Api-Key: sk_your_api_key_here
X-Api-Secret: your_api_secret_here

📌 API Key 格式:sk_ 开头 + 32 位十六进制字符

🔒 Secret 用于签名验证,请妥善保管

方式二:Bearer Token

使用用户登录后的 JWT Token:

Request Headers
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

2 提交查询任务

POST /api/api/submit

批量提交 HS Code 查询任务,最多 500 个品名/次。积分不足时超出部分将标记为 paused 状态。

请求参数

参数类型必填说明
productsarray是商品品名数组,最多 500 个,每个品名 ≤ 512 字符
webhook_urlstring否本次任务专用的回调 URL(可选,会额外触发)

请求示例

cURL
curl -X POST https://hscode.proxy.jiayouexp.com/api/api/submit \
  -H "X-Api-Key: sk_your_key" \
  -H "X-Api-Secret: your_secret" \
  -H "Content-Type: application/json" \
  -d '{
    "products": [
      "Fresh Atlantic Salmon",
      "Cotton T-shirts",
      "Wireless Bluetooth Mouse"
    ],
    "webhook_url": "https://your-server.com/webhook"
  }'

响应示例

JSON 200 OK
{
  "code": 0,
  "message": "任务已提交,共3条",
  "data": {
    "batch_no": "BAT20240422123456001",
    "total": 3,
    "processed": 3,
    "paused": 0,
    "balance": 47,
    "task_ids": [101, 102, 103],
    "paused_ids": []
  }
}

响应字段说明

字段类型说明
batch_nostring批次号,用于后续查询
totalint提交的总品名数
processedint已扣除积分并进入队列的任务数
pausedint因积分不足暂停的任务数
balanceint当前剩余积分
task_idsarray已提交的任务 ID 列表
paused_idsarray暂停的任务 ID 列表

3 查询任务状态

GET /api/api/tasks

分页查询当前用户的任务列表和状态统计。

查询参数

参数类型必填说明
pageint否页码,默认 1
limitint否每页数量,默认 20,最大 100
batch_nostring否按批次号筛选
statusstring否按状态筛选

任务状态说明

状态说明
queued排队中,等待 Worker 处理
processing正在查询中
success查询成功,已返回 HS Code
failed查询失败,已退还积分
paused因积分不足暂停,充值后可继续

请求示例

cURL
# 查询所有任务
curl "https://hscode.proxy.jiayouexp.com/api/api/tasks?page=1&limit=20" \
  -H "X-Api-Key: sk_your_key" \
  -H "X-Api-Secret: your_secret"

# 按批次号查询
curl "https://hscode.proxy.jiayouexp.com/api/api/tasks?batch_no=BAT20240422123456001" \
  -H "X-Api-Key: sk_your_key" \
  -H "X-Api-Secret: your_secret"

# 查询成功任务
curl "https://hscode.proxy.jiayouexp.com/api/api/tasks?status=success" \
  -H "X-Api-Key: sk_your_key" \
  -H "X-Api-Secret: your_secret"

响应示例

JSON 200 OK
{
  "code": 0,
  "message": "ok",
  "data": {
    "tasks": {
      "items": [
        {
          "id": 101,
          "batch_no": "BAT20240422123456001",
          "type": "api",
          "product_name": "Fresh Atlantic Salmon",
          "hscode": "0302110000",
          "status": "success",
          "error_msg": null,
          "points_deducted": 1,
          "created_at": "2024-04-22 12:34:56",
          "finished_at": "2024-04-22 12:35:01"
        }
      ],
      "total": 150,
      "page": 1,
      "limit": 20,
      "pages": 8
    },
    "stats": {
      "total": 150,
      "success": 145,
      "failed": 2,
      "running": 3,
      "paused": 0
    }
  }
}

4 批量同步查询(优先历史记忆)

POST /api/api/batch-query

同步批量查询 HS Code,优先从历史记忆(Redis/MySQL 缓存)获取结果, 缓存未命中时才调用外部 API。每条查询均扣 1 积分(无论是否命中缓存)。 适合需要即时返回结果的场景。

请求参数

参数类型必填说明
productsarray是商品品名数组,最多 500 个(自动去重),每个品名 ≤ 512 字符

请求示例

cURL
curl -X POST https://hscode.proxy.jiayouexp.com/api/api/batch-query \
  -H "X-Api-Key: sk_your_key" \
  -H "X-Api-Secret: your_secret" \
  -H "Content-Type: application/json" \
  -d '{
    "products": [
      "Fresh Atlantic Salmon",
      "Cotton T-shirts",
      "Wireless Bluetooth Mouse"
    ]
  }'

响应示例

JSON 200 OK
{
  "code": 0,
  "message": "查询完成,共3条(缓存命中2条),调用 API 1 次",
  "data": {
    "results": [
      {
        "product_name": "Fresh Atlantic Salmon",
        "hscode": "0302110000",
        "cache_hit": true
      },
      {
        "product_name": "Cotton T-shirts",
        "hscode": "6109100012",
        "cache_hit": false
      },
      {
        "product_name": "Wireless Bluetooth Mouse",
        "hscode": "3924900010",
        "cache_hit": true
      }
    ],
    "total": 3,
    "success": 3,
    "cache_hits": 2,
    "api_calls": 1,
    \"points_used\": 3,
    \"balance\": 97
  }
}

响应字段说明

字段类型说明
resultsarray查询结果列表,顺序与请求一致
results[].product_namestring商品品名
results[].hscodestring10 位 HS Code,查询失败时为空
results[].cache_hitbool是否命中历史记忆缓存
results[].errorstring错误信息(仅在查询失败时出现)
totalint查询的总品名数(去重后)
successint成功查询的数量
cache_hitsint命中缓存的数量(不扣积分)
api_callsint调用外部 API 的次数(扣积分)
points_usedint本次消耗的积分(等于 api_calls)
balanceint查询后的剩余积分

💡 与 /api/api/submit 的区别:

  • /api/api/batch-query:同步接口,即时返回结果;优先查历史记忆,每条查询均扣 1 积分
  • /api/api/submit:异步接口,提交后需轮询 /api/api/tasks 获取结果;所有品名均扣积分

5 Webhook 管理

Webhook 允许你在任务完成后自动接收通知。需要 JWT Token 认证(通过 Web 界面管理)。

4.1 创建 Webhook

POST /api/webhook/create
参数类型必填说明
webhook_urlstring是回调 URL(需为合法 URL 格式)
secretstring否签名密钥,不提供则自动生成(32 位)

4.2 查看 Webhook 列表

GET /api/webhook/list

4.3 启用/禁用 Webhook

POST /api/webhook/toggle
参数类型必填说明
webhook_idint是Webhook ID
statusint是1=启用,0=禁用

4.4 删除 Webhook

POST /api/webhook/delete

4.5 查看 Webhook 调用日志

GET /api/webhook/logs

6 Webhook 回调规则

回调触发时机

当任务处理完成后(成功或失败),系统会自动向以下 URL 发送 HTTP POST 请求:

  • 用户配置的所有已启用 Webhook URL
  • 提交任务时指定的 webhook_url(如有)

回调 Payload

Webhook POST Body
{
  "event": "task.completed",
  "task_id": 101,
  "batch_no": "BAT20240422123456001",
  "type": "api",
  "product_name": "Fresh Atlantic Salmon",
  "hscode": "0302110000",
  "confidence": 0,
  "status": "success",
  "error_msg": null,
  "created_at": "2024-04-22 12:34:56",
  "finished_at": "2024-04-22 12:35:01"
}

字段说明

字段类型说明
eventstring固定值 task.completed
task_idint任务 ID
batch_nostring批次号
typestring任务来源:api / single / batch
product_namestring商品品名
hscodestring匹配到的 10 位 HS Code(失败时为空)
statusstringsuccess 或 failed
error_msgstring/null失败时的错误信息

签名验证

如果 Webhook 配置了 Secret,回调请求头会包含签名:

Request Headers
Content-Type: application/json
X-Webhook-Signature: sha256=abc123def456...
X-Webhook-Timestamp: 1713772496

验证方式:HMAC-SHA256(payload_body, secret)

Python 验证示例
import hmac, hashlib

signature = request.headers['X-Webhook-Signature'].replace('sha256=', '')
expected = hmac.new(secret.encode(), request.body, hashlib.sha256).hexdigest()
assert hmac.compare_digest(signature, expected), "Invalid signature"

重试机制

🔄 回调失败时自动重试,最多重试 3 次:

  • 第 1 次重试:等待 2 分钟
  • 第 2 次重试:等待 4 分钟
  • 第 3 次重试:等待 8 分钟
  • 超过 3 次后标记为 failed

响应要求

您的 Webhook 服务应在 10 秒内返回 HTTP 2xx 状态码,否则视为回调失败。

7 错误码

codeHTTP 状态码说明常见原因
-1401鉴权失败API Key 无效 / Secret 错误 / Token 过期 / 未提供认证信息
-1401API Key 无效或已禁用Key 不存在 / 状态为 0(已禁用)/ Secret 不匹配
-1405请求方法不允许使用了错误的 HTTP 方法(如 GET 代替 POST)
-1400请求参数错误products 为空数组 / 无有效品名 / 超过 500 限制
-1500服务器内部错误RabbitMQ 连接失败 / 数据库异常
Error Response Format
{
  "code": -1,
  "message": "错误描述",
  "data": []
}

Welcome back

Log in to continue using HS Code lookup services

Don't have an account? Sign up

Create account

Register to start using HS Code intelligent lookup

Already have an account? Log in

HS Code 智能查询

AI 驱动的商品品名匹配加拿大 HS Code 服务

🔍

单个查询

输入品名查询 HS Code

📊

批量查询

上传 Excel 批量处理

📋

任务列表

查看所有任务和进度

💰

充值积分

1 元 = 50 积分

🔑

API Keys

管理 API 密钥和 Secret

任务概览

最近任务

View all →

🔍 单个 HS Code 查询

输入商品品名,AI 自动匹配加拿大 HS Code

← Back

每个品名消耗 1 积分

📊 批量上传查询

上传 Excel 文件,批量处理多个品名

📥 下载模板 ← Back

Click or drag file here

First column: product names, supports .xlsx and .csv

📦 批次列表

📋 任务列表

← Back

📈 Batch Progress

← Back

💰 充值积分

为账户充值积分,用于 HS Code 查询

← Back
Rate1 CNY = 50 points
Points to receive:0

📝 Usage Log

← Back

🔑 API Keys

管理你的 API 密钥,用于程序化访问 HS Code 查询服务

← Back

创建 API Key

请输入密钥名称以创建新的 API Key 和 Secret

⚠️ Secret 仅在创建时显示一次,请务必妥善保存!

API Key:
Secret:
Data Source: CBSA Customs Tariff Privacy Policy Terms of Use Contact

Data sourced from the Canada Border Services Agency (CBSA) Canadian Customs Tariff. Updated regularly. Not legal advice.