开发者 API

将 AssessFit 集成到您的 ATS、Zapier 或内部工具——创建职位、邀请候选人、拉取结果,并在候选人完成的那一刻收到签名的 Webhook。

身份验证

Employer Dashboard → Settings → API & integrations 生成 API 密钥,并随每个请求发送:

curl https://assessfit.com/api/v1/jobs \
  -H "X-Api-Key: tp_live_…"

密钥按工作区隔离。轮换密钥会立即使旧密钥失效。请求限速为每 IP 每分钟 300 次。

接口

GET/api/v1/jobs

列出职位及其邀请数与完成数。

POST/api/v1/jobs

一次调用即可创建职位并邀请候选人。邀请邮件自动发送;每个邀请消耗一个额度。

curl -X POST https://assessfit.com/api/v1/jobs \
  -H "X-Api-Key: tp_live_…" -H "Content-Type: application/json" \
  -d '{
    "title": "Senior Accountant",
    "roleKey": "accountant",
    "tests": ["attention", "financial", "numerical", "conscientiousness"],
    "cameraRequired": true,
    "shareResults": false,
    "candidates": [
      { "name": "Ana Putri", "email": "ana@example.com" }
    ]
  }'

职位键: accountant, engineer, sales, support, marketing, analyst, custom。可以省略 tests吗?不行——请传入您想要的测试键;测试库可在仪表盘查看。

GET/api/v1/jobs/:id

职位完整详情:每个邀请及其漏斗时间戳(tracking.sent/opened/loggedIn)、个人邀请 link,以及完成后的 result 对象。

POST/api/v1/jobs/:id/invites

向已有职位添加候选人: {"candidates":[{"name":"…","email":"…"}]}。返回创建的邀请及其链接。

GET/api/v1/invites/:id/result

拉取单个候选人的完成结果:总分、分测试得分、诚信分、结论与标记,以及时间分析。候选人完成前返回 404。

Webhook

在 Settings 中设置 Webhook URL。AssessFit 以 POST 发送 JSON 事件,并用您的 API 密钥 作为密钥对原始请求体计算 HMAC-SHA256 签名:

POST https://your-app.example.com/hooks/assessfit
X-AssessFit-Event: candidate.completed
X-AssessFit-Signature: sha256=3f5a…

{
  "event": "candidate.completed",
  "createdAt": "2026-07-22T09:14:03.000Z",
  "data": {
    "inviteId": "inv_…",
    "jobId": "job_…",
    "jobTitle": "Senior Accountant",
    "candidate": { "name": "Ana Putri", "email": "ana@example.com" },
    "overall": 84,
    "scores": { "attention": 83, "numerical": 100 },
    "integrity": { "score": 100, "verdict": "clean" }
  }
}

在信任任何载荷之前请先验证签名:

// Node.js
const crypto = require("crypto");
function verify(rawBody, signatureHeader, apiKey) {
  const expected = "sha256=" +
    crypto.createHmac("sha256", apiKey).update(rawBody).digest("hex");
  return crypto.timingSafeEqual(Buffer.from(signatureHeader), Buffer.from(expected));
}

投递重试 3 次(立即、+2 秒、+8 秒)。每次尝试都可在 Settings → Recent webhook deliveries中查看,您还可以随时用 "Send Test Event" 按钮触发 webhook.test 事件。事件包括: candidate.completed, webhook.test.

集成方案