RouteMateRouteMate
开发者 API

使用 RouteMate 构建

通过我们的 REST API 连接你的平台。从电商系统导入停靠点,触发路线优化,并以编程方式追踪配送。

RouteMate API
POST /v1/integration-import

请求

{
  "external_job_id": "BATCH-001",
  "title": "Morning Deliveries",
  "driver_email": "driver@example.com",
  "stops": [
    {
      "external_stop_id": "STOP-1",
      "address": "1 George St, Brisbane QLD 4000",
      "label": "Customer A",
      "parcel_count": 2
    }
  ]
}

响应

{
  "job_id": "e7ad097b-...",
  "optimization": {
    "total_distance_km": 12.4,
    "total_duration_minutes": 25
  },
  "stops": [ /* optimized order */ ],
  "warnings": [...]
}

获取凭证

在 RouteMate 控制台设置页面生成 client ID 和 secret。

请求令牌

将凭证换成一个有效期为 1 小时的 bearer token。

调用 API

在导入和状态查询请求中,将令牌放入 Authorization 头。

身份验证

客户端凭证流程

RouteMate API 使用 OAuth2 客户端凭证流程。使用 client ID 和 secret 换取短期 bearer token,然后在后续请求的 Authorization 头中携带。

01

获取凭证

在 RouteMate 控制台设置页面生成 client ID 和 secret。

02

请求令牌

将凭证换成一个有效期为 1 小时的 bearer token。

03

调用 API

在导入和状态查询请求中,将令牌放入 Authorization 头。

API

核心 API 端点

这些端点覆盖最常见的配送工作流集成任务。

POST/v1/integration-token

获取访问令牌

将 client credentials 换成一个有效期 1 小时的临时访问令牌。

请求

{
  "client_id": "rm_ci_your_client_id",
  "client_secret": "rm_cs_your_client_secret"
}

响应

{
  "access_token": "rm_at_e5988dd1b91a...",
  "token_type": "Bearer",
  "expires_in": 3600
}
POST/v1/integration-import

导入任务并优化路线

提交包含停靠点的配送任务,对地址进行地理编码,优化顺序并分配给司机。

请求

{
  "external_job_id": "BATCH-001",
  "title": "Morning Deliveries",
  "driver_email": "driver@example.com",
  "stops": [
    {
      "external_stop_id": "STOP-1",
      "address": "1 George St, Brisbane QLD 4000",
      "label": "Customer A",
      "parcel_count": 2
    }
  ]
}

响应

{
  "job_id": "e7ad097b-...",
  "optimization": {
    "total_distance_km": 12.4,
    "total_duration_minutes": 25
  },
  "stops": [ /* optimized order */ ],
  "warnings": [...]
}
GET/v1/integration-jobs

查询任务状态

随时查看任务状态、停靠点进度和配送结果。

请求

// GET request

响应

{
  "job_id": "e7ad097b-...",
  "status": "assigned",
  "stop_count": 3,
  "status_counts": {
    "pending": 2,
    "completed": 1
  },
  "stops": [...]
}
代码示例

几分钟内上手

使用下面的示例完成认证、导入任务并检查配送状态。

curl
curl -X POST https://api.routemate.app/v1/integration-token \
  -H "Content-Type: application/json" \
  -d '{"client_id":"rm_ci_your_client_id","client_secret":"rm_cs_your_client_secret"}'
node
const tokenRes = await fetch("https://api.routemate.app/v1/integration-token", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    client_id: "rm_ci_your_client_id",
    client_secret: "rm_cs_your_client_secret",
  }),
});
python
import requests

token_res = requests.post(
    "https://api.routemate.app/v1/integration-token",
    json={
        "client_id": "rm_ci_your_client_id",
        "client_secret": "rm_cs_your_client_secret",
    },
)
为 SaaS 团队打造

从第一天起即可投入生产

专为可靠的配送流程、重试机制和下游操作而设计。

安全认证
短期 bearer token 与受控的凭证交换。
快速导入
通过一次请求即可从你的系统推送配送任务。
可靠重试
使用幂等键安全重试失败请求。
状态可见
以编程方式追踪任务和停靠点进度。

需要定制集成?

联系我们讨论合作伙伴工作流、定制入门和企业级 API 访问。