开始
任务类型
运行设置
匹配方式
选择平台
上传型号
循环时间段
变化方式
面板
| 时间 | 平台 | 型号 | 类型 | 变化前 | 变化后 | 价格 | 链接 |
|---|
用量信息
总消耗(积分)
各任务消耗
各平台消耗
API
API Key
读不到 API Key,请稍后再试
接口说明
异步:createTask → getTaskResult一、鉴权
鉴权请求头:
X-Api-Key: sk_xxxxxxxxxxxxxxxxxxxx
请求体为 JSON 时,设置 Content-Type: application/json。
平台编码
platforms 可以传平台名(不区分大小写),也可以传下面的编码:
二、getBalance:查询账户余额
请求地址:https://lilachip.com/api/v1/getBalance
请求格式:POST application/json
请求参数
无。鉴权使用 X-Api-Key 请求头。
请求示例
{}响应数据
| 参数 | 类型 | 描述 |
|---|---|---|
errorId | Integer | 0 = 没有错误,1 = 有错误。 |
errorCode | string | 错误代码;成功为空串。 |
errorDescription | string | 错误详细描述;成功为空串。 |
balance | Integer | 账户余额(积分)。 |
响应示例
{
"errorId": 0,
"errorCode": "",
"errorDescription": "",
"balance": 5000
}三、createTask:创建任务
创建型号查询任务,通过参数指定平台和型号。
请求地址:https://lilachip.com/api/v1/createTask
请求格式:POST application/json
请求参数
| 参数 | 类型 | 必须 | 描述 |
|---|---|---|---|
platforms | array / string | 是 | 平台名或编号,1~32 个;数组,或逗号/空白分隔的字符串。 |
models | array / string | 是 | 待查询型号;数组,或换行/竖线分隔;逗号不作为分隔符(BAV99,215 为一个料号)。 |
task | string | 否 | 可省略或设为 models;其他值返回 400 bad_task。 |
countries | array / string | 否 | 这一次问哪几个国家店铺(只对 Element14 / Farnell / Newark 有意义),如 ["sg", "hk"];每多一个国家 = 多打一次接口,结果行带 country。只作用于这一发,不改网页上选的国家;认不出来返回 400 bad_country。 |
一次最多 32 个平台、32 个国家;同一平台已有运行中的任务时不重复派发,其当前轮次归入新 taskId。
请求示例
{
"platforms": ["TI", "DigiKey"],
"models": ["NE555", "BAV99"]
}响应数据
| 参数 | 类型 | 描述 |
|---|---|---|
errorId | Integer | 0 = 没有错误,1 = 有错误。 |
errorCode | string | 错误代码;成功为空串。 |
errorDescription | string | 错误详细描述;成功为空串。 |
taskId | string | 创建的任务 ID(UUID),使用 getTaskResult 接口获取结果。 |
响应示例
{
"errorId": 0,
"errorCode": "",
"errorDescription": "",
"taskId": "2376919c-1863-11ec-a012-94e6f7355a0b" // save this ID for getTaskResult
}四、getTaskResult:获取结果
使用 createTask 返回的 taskId 轮询。
status 表示整批状态,state 表示单个平台状态。
请求地址:https://lilachip.com/api/v1/getTaskResult
请求格式:POST application/json
请求参数
| 参数 | 类型 | 必须 | 描述 |
|---|---|---|---|
taskId | string | 是 | createTask 返回的那个 UUID。 |
limit | Integer | 否 | 每个平台返回的型号上限,默认 500,最大 5000。 |
请求示例
{
"taskId": "2376919c-1863-11ec-a012-94e6f7355a0b"
}响应数据
| 参数 | 类型 | 描述 |
|---|---|---|
errorId | Integer | 0 = 没有错误,1 = 有错误。 |
errorCode | string | 错误代码。 |
errorDescription | string | 错误详细描述。 |
status | String | 整批:processing 表示仍有平台运行,建议 3 秒后重试;finished 表示全部收尾,结果见 solution。 |
solution.platforms[] | array | 本批每个平台一条。 |
solution.platforms[]:
| 参数 | 类型 | 描述 |
|---|---|---|
platform | string | 平台规范名(非编号)。 |
state | string | 本平台:running 运行中;succeeded 已完成;failed 无结果或被取消。 |
cancelled | Bool | 是否由控制台「停止此平台」停止;对外 API 不提供停止接口。 |
model_count | Integer | 本轮提交的型号总数(非当前页条数)。 |
processed_count | Integer | 已处理数。 |
ok_count | Integer | 查到结果的型号数。 |
no_result_count | Integer | 平台无结果的型号数(计入计费)。 |
failed_count | Integer | 失败的型号数。 |
error | string | 失败原因;运行中、成功或取消时为空串。 |
currency | string | 价格币种(如 USD / CNY);仅已收尾平台提供。 |
models | array | 型号行;仅已收尾平台提供此键。 |
status 和 state 的区别
| 判断目标 | 字段 | 判断规则 |
|---|---|---|
| 整批是否完成 | status | processing 继续轮询;finished 全部完成 |
| 单个平台是否完成 | solution.platforms[].state | running 运行中;succeeded / failed 已完成 |
| 是否全部成功 | status + 每个 state | finished 且所有 state 均为 succeeded |
finished 只代表全部收尾,不代表全部成功;succeeded 也不代表每个型号都查到(参考 failed_count / no_result_count)。
t=9s DigiKey succeeded status=processing t=15s SzLcsc succeeded status=processing t=21s TI succeeded status=finished
响应示例
{
"errorId": 0,
"errorCode": "",
"errorDescription": "",
"status": "processing",
"solution": {
"platforms": [
{"platform": "TI", "state": "succeeded", "model_count": 2,
"models": [ ... ]},
{"platform": "DigiKey", "state": "running", "model_count": 2}
]
}
}型号字段(22 个键)
| 字段 | 描述 |
|---|---|
model | 输入型号。 |
lookup_result | ok 查到 / no_result 平台没有 / failed 这一条失败。 |
country | 这一条属于哪一家国家店铺(国家键,如 sg / hk);勾了几个国家就一国一条,没选国家的平台为 null。 |
currency | 这条报价的币种(如 SGD);prices[].price 是这个币种的价。 |
manufacturer | 厂商。 |
part_number | 厂商型号。 |
product_status | 平台给的产品状态(如 ACTIVE / Obsolete);平台没给为 null。 |
stock_quantity | 库存数量(字符串,保留平台原样,如 "1,234" / "1000+");没给为 null。 |
stock_status | 货态(如 InStock / OutOfStock);没给为 null。 |
prices[] | 阶梯价数组,每条 {qty, price};qty 是起订量,平台只给一个价时 qty 是 null。 |
futures[] | 期货,每条 {qty, date};没有为 []。 |
datasheets[] | 手册 URL 数组;没有为 []。 |
images[] | 图片 URL 数组;没有为 []。 |
specifications{} | 参数表对象(键值对);没有为 {}。 |
package_type | 封装。 |
packaging_type | 包装方式。 |
lead_time | 交期(平台原文)。 |
description | 描述。 |
category | 分类。 |
product_url | 产品页 URL。 |
updated_at | 这一条的时间,Unix 秒。 |
other_listings[] | 同一个型号的其它产品;每条含除 model / lookup_result / country / currency / other_listings 之外的 17 个键,结构同上。 |
五、错误码
请求失败时 errorId 为 1,具体原因参见 errorCode 与 errorDescription。
{"errorId": 1, "errorCode": "bad_platform", "errorDescription": "Unknown platform: NoSuchPlatform"}通用 API 错误码
| errorCode | errorDescription | 描述 |
|---|---|---|
login_required | 登录已失效 | 钥匙无效、已作废或客户已停用。 |
rate_limited | API 调用太频繁 | 创建任务频率超限;按 Retry-After 等待后重试。 |
bad_request | 请求无效 | 请求体不是合法 JSON,或字段类型不正确。 |
db_busy | 服务器繁忙 | 数据库繁忙,请稍后重试。 |
internal_error | 服务器错误 | 服务端内部错误;持续出现请联系客服。 |
任务创建失败错误码
| errorCode | errorDescription | 描述 |
|---|---|---|
bad_task | 仅支持查型号 | 不要传 task,或设为 task=models。 |
no_platform | platforms 为空 | platforms 为空。 |
bad_platform | 平台名或编号无效 | 平台名或编号无效;参见上方平台表。 |
bad_country | 国家店铺无效 | 平台没有国家可选,或国家键不在该平台的清单里;或一次超过 32 个国家(不花钱)。 |
no_models | models 为空 | models 为空。 |
too_many_targets | 一次最多 32 个平台 | 分批提交。 |
too_many_rows | 超过上传上限 | 型号数超过当前等级上限(普通 300 / PLUS 2000)。 |
need_credits | 积分不足 | 余额不足(预检阶段拒绝)。 |
tier_required | 这档任务只对某些等级开放 | 请联系管理员开通。 |
platform_closed | 平台已停用 | 该平台已被管理员停用或隐藏。 |
dispatch_failed | 任务未启动 | 抓取服务不可用(未启动、满载或熔断),请稍后重试。 |
查询失败错误码
| errorCode | errorDescription | 描述 |
|---|---|---|
no_task_id | 缺少 taskId | 未提供 taskId。 |
task_not_found | 找不到这个 taskId | taskId 不存在或不属于当前客户。 |
六、计费
按结果计费:ok 与 no_result 均计一次,failed 不计费。一次 createTask 中,每个平台分别计费。
七、完整示例
curl -s -X POST https://lilachip.com/api/v1/createTask \
-H "X-Api-Key: sk_xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"platforms": ["TI", "DigiKey"], "models": ["NE555"]}'import json, time, urllib.request
BASE, KEY = "https://lilachip.com", "sk_xxxxxxxx"
def call(path, body):
req = urllib.request.Request(BASE + path, method="POST",
data=json.dumps(body).encode())
req.add_header("X-Api-Key", KEY)
req.add_header("Content-Type", "application/json")
with urllib.request.urlopen(req, timeout=60) as resp:
return json.loads(resp.read())
created = call("/api/v1/createTask",
{"platforms": ["TI", "DigiKey"], "models": ["NE555"]})
if created["errorId"]:
raise SystemExit(created)
task_id = created["taskId"] # save this ID for getTaskResult
while True:
time.sleep(3)
result = call("/api/v1/getTaskResult", {"taskId": task_id})
if result["errorId"]:
raise SystemExit(result)
for platform in result["solution"]["platforms"]:
if platform["state"] != "running":
print(platform["platform"], platform["state"],
len(platform.get("models", [])))
if result["status"] == "finished":
break八、注意
- 一个 taskId 对应一批任务,无需按平台逐个轮询。
- 每个客户每分钟最多创建 60 个任务;超出后返回 429,请按 Retry-After 等待后重试。
价格
PLUS PLAN
- 获取总价值200美金200,000积分
- 独享线路,速度大幅提升
- 解锁更多专属任务
如需充值或升级 PLUS,请联系我们
| 平台 | 美金/千次 |
|---|




