❮  集成

公司 API

您的客户把权限授予您的公司,您自己的应用里就有了「开启」按钮。钥匙不经过聊天流转,每次开启都署上按下按钮的员工姓名。

适合谁:员工需要驶入封闭院落的服务——保姆与家教、保洁、上门补胎与洗车、快递与配送、上门护理与采样。客户保留现有道闸;您得到的是一个按钮,而不是在大门口给客户打电话。

工作原理

  1. 客户在您的界面里说明需要驶入。您先确认两点:道闸能用他的号码打电话开启,且他的手机保持在线。若道闸装了 Entrixy 控制器,则完全不需要手机。
  2. 您创建一次请求并展示它的二维码。客户扫码、安装应用、添加道闸并授予权限——您的公司已经在列表里等着。
  3. 您通过 API 开启并注明是哪位员工。客户在日志里看到带该姓名的开启记录,随时一点即可收回权限。
钥匙并不以链接形式存在。公司拿到的是指向它的引用而非钥匙本身,没有可复制或转发的东西;钥匙绑定在您的账户上,只能通过本 API 使用。无法把权限再转交给员工——这是刻意为之,也正因如此客户才放心授予。

认证

There are two ways in, and the difference is what the client sees.

Signature bound to your domain

You publish a public key on your own domain and sign every call with the private one. We take the key from the domain itself, so the right to call and the right to be shown under that domain are the same thing: the file disappears, the domain moves or changes hands — the calls stop within a day. There is no one-off "verified" tick to outlive reality.

https://<your domain>/.well-known/entrixy.json

{ "key": "<Ed25519 public key, 32 bytes, base64>" }

Then each request carries four headers:

X-Entrixy-Org:   your-domain.com
X-Entrixy-Ts:    1750000000          // unix seconds, ±300 s
X-Entrixy-Nonce: 0011…ff             // 32 hex, used once
X-Entrixy-Sig:   <base64>            // Ed25519 over the base string

base = "<domain>.<ts>.<nonce>." + sha256(raw request body)

A repeated nonce is refused, and so is a body that does not match the signature. This is the mode where the client sees your domain and your logo.

A domain written in national characters goes into the header and into the base string in its punycode form — xn--… — the same form it takes in the address of the key file. The client is still shown the readable spelling.

A secret, if you have no domain

Register, issue a secret in the cabinet and put it in the body. Your calls work the same, but the client is shown only the name you wrote for yourself, with a note that the domain is not confirmed — no logo, no domain. A company that has set a domain can no longer use a secret: otherwise a leaked secret would speak in the name of a confirmed one.

POST https://entrixy.com/api/company.php?a=<action>
Content-Type: application/json

{ "org_id": 17, "secret": "…", … }

创建请求

POST /api/company.php?a=request
{ "org_id": 17, "secret": "…", "ref": "order-517", "ttl_hours": 72 }

→ { "code": "rrGzNweV31rkHV6Q",
    "url":  "https://entrixy.com/c/rrGzNweV31rkHV6Q",
    "expires_in_hours": 72 }

ref 是您自己的订单号,会在状态里回传。请把 url 放进二维码展示给客户。

请求状态

POST /api/company.php?a=status
{ "org_id": 17, "secret": "…", "code": "rrGzNweV31rkHV6Q" }

→ { "state": "issued", "key_ref": 4821, "ref": "order-517",
    "claimed_at": "2026-09-09 12:20:11", "issued_at": "2026-09-09 12:24:03" }
状态Meaning
new二维码已创建,客户尚未到来
claimed客户已打开应用——正在进行中
issued权限已授予; key_ref 用它来开启
revoked客户收回了权限
expired客户到来之前请求已过期

开启

POST /api/company.php?a=open
{ "org_id": 17, "secret": "…", "key_ref": 4821,
  "number_id": 93, "actor": "Ivan P., shift 12" }

→ { "ok": 1 }

actor 是必填项:客户在日志里看到的就是它。凡是能在您那边认出员工的都行——姓名、工号、班次。不填则调用被拒。

响应Meaning
403 forbidden这把钥匙不属于您,或其中没有该对象
403 revoked客户收回了权限
403 expired钥匙的有效期已结束
400 actor_required未注明员工
429 rate_limit同一把钥匙每分钟开启次数过多

您在应用中的名片

注册公司时把名称和方形标志发给我们。客户会在扫码打开的页面、授权确认页以及日志的每一行旁看到它们——一眼就知道放谁进来。标志由我们自己提供,不从其他服务器加载图片。

快速上手

在您的账户里注册公司:先提交申请,随后密钥、回调地址、标志和请求列表都在公司后台。申请由人工审核——客户信任的是被我们放进列表的公司。

公司后台