激活连接器

export CONNECTOR_API_BASE="$GROWTHOS_CONNECTOR_API_URL/api/connector/v1"

curl -X POST "$CONNECTOR_API_BASE/auth/activate" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: activate-customer-example-com" \
  -d '{
    "licenseCode": "YOUR_LICENSE_CODE",
    "domain": "YOUR_CUSTOMER_SITE_ORIGIN",
    "platform": "custom",
    "siteName": "Customer Site",
    "primaryLocale": "zh-CN",
    "supportedLocales": ["zh-CN"]
  }'
成功后会返回 data.token。这个 token 只能保存在客户站点的服务端或插件配置中。
{
  "ok": true,
  "data": {
    "token": "gos_site_...",
    "tenant": {
      "id": "tenant_id",
      "name": "Customer"
    },
    "site": {
      "id": "site_id",
      "domain": "YOUR_CUSTOMER_SITE_ORIGIN"
    }
  },
  "requestId": "req_123"
}

后续请求

Authorization: Bearer <site_token>
Content-Type: application/json
写操作建议同时带:
Idempotency-Key: <stable-operation-key>

SDK 示例

import { activateGrowthOSConnector } from "@growthos/connector";

const activation = await activateGrowthOSConnector({
  baseUrl: process.env.GROWTHOS_CONNECTOR_API_URL!,
  licenseCode: process.env.GROWTHOS_LICENSE_CODE!,
  domain: "YOUR_CUSTOMER_SITE_ORIGIN",
  platform: "custom",
  primaryLocale: "zh-CN",
  supportedLocales: ["zh-CN"]
});

console.log(activation.token);