Skip to content

API 参考 ​

接口版本 1.0.0。基础地址:https://app.daz5.cn/api/integrations/v1。

下载 OpenAPI 3.1 · 运行时协议发现

调用约定 ​

管理端使用 SaaS Cookie;写操作需同源且带 X-Heyso-Admin: 1 或 X-Heyso-Client: local-ui。应用服务端调用 token/introspect/check/revoke 时在 body 提交 client_id/client_secret,支持 JSON 和 form,不把这些凭据交给浏览器。

以下请求结构来自实际 OpenAPI。$ref 指向本页末尾的数据结构;完整代码示例见 SDK 和 登录流程。

GET /contract ​

Read versioned contract

成功响应:

json
{
  "type": "object"
}

GET /manifest-schema ​

Read versioned manifest-schema

成功响应:

json
{
  "type": "object"
}

GET /openapi ​

Read versioned openapi

成功响应:

json
{
  "type": "object"
}

GET /registry ​

List app registrations (superadmin only)

成功响应:

json
{
  "type": "object"
}

POST /registry ​

Create/update registration; changes invalidate old authorizations

参数:

名称位置必填
X-Heyso-Adminheader是

请求结构:

json
{
  "type": "object",
  "properties": {
    "revision": {
      "type": "integer"
    },
    "manifest": {
      "$ref": "#/components/schemas/Manifest"
    }
  },
  "required": [
    "revision",
    "manifest"
  ]
}

成功响应:

json
{
  "type": "object"
}

GET /organizations/ ​

Read installation and member grants (organization admin)

Returns installations with read-only effectiveGrants explanations: userId, role (null when denied), source (explicit/organization/unassigned), requested role, viewerCeiling, scopes, enabled, and projectBound. Project-bound explanations remain subject to the selected project permission at entry. These explanations are not authorization credentials; every business request must use /check.

参数:

名称位置必填
tenantIdpath是

成功响应:

json
{
  "type": "object"
}

POST /organizations/ ​

Install, disable or update app/member grants

参数:

名称位置必填
tenantIdpath是
X-Heyso-Adminheader是

请求结构:

json
{
  "$ref": "#/components/schemas/Installation"
}

成功响应:

json
{
  "type": "object"
}

GET /catalog ​

List current selected organization apps accessible to current member

Available applications include read-only category (official or third-party) and authorizationMode (organization or user-consent). Classification cannot be submitted in a manifest.

成功响应:

json
{
  "$ref": "#/components/schemas/ApplicationCatalog"
}

POST /authorize ​

Issue 60-second code after explicit browser consent

参数:

名称位置必填
X-Heyso-Adminheader是

请求结构:

json
{
  "$ref": "#/components/schemas/Authorize"
}

成功响应:

json
{
  "type": "object",
  "properties": {
    "redirectUri": {
      "type": "string"
    }
  },
  "required": [
    "redirectUri"
  ]
}

POST /token ​

Redeem single-use audience-bound code with PKCE S256

Confidential server-to-server request. client_id and client_secret in request body; JSON and form encoding supported. Never call from browser JavaScript.

请求结构:

json
{
  "$ref": "#/components/schemas/Token"
}

成功响应:

json
{
  "$ref": "#/components/schemas/TokenResult"
}

POST /introspect ​

Check live account, session, organization, app and project access

Confidential server-to-server request. client_id and client_secret in request body; JSON and form encoding supported. Never call from browser JavaScript.

请求结构:

json
{
  "$ref": "#/components/schemas/ClientToken"
}

成功响应:

json
{
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "active": {
          "const": false
        }
      },
      "required": [
        "active"
      ]
    },
    {
      "allOf": [
        {
          "$ref": "#/components/schemas/Identity"
        },
        {
          "type": "object",
          "properties": {
            "active": {
              "const": true
            }
          },
          "required": [
            "active"
          ]
        }
      ]
    }
  ]
}

POST /check ​

Authorize an exact tenant/project permission

Confidential server-to-server request. client_id and client_secret in request body; JSON and form encoding supported. Never call from browser JavaScript.

请求结构:

json
{
  "$ref": "#/components/schemas/Check"
}

成功响应:

json
{
  "type": "object",
  "properties": {
    "allowed": {
      "type": "boolean"
    },
    "identity": {
      "$ref": "#/components/schemas/Identity"
    }
  },
  "required": [
    "allowed",
    "identity"
  ]
}

POST /revoke ​

Idempotently revoke own-app token

Confidential server-to-server request. client_id and client_secret in request body; JSON and form encoding supported. Never call from browser JavaScript.

请求结构:

json
{
  "$ref": "#/components/schemas/ClientToken"
}

成功响应:

json
{
  "type": "object",
  "properties": {
    "ok": {
      "const": true
    }
  },
  "required": [
    "ok"
  ]
}

数据结构 ​

Error ​

json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "code": {
      "type": "string"
    },
    "requestId": {
      "type": "string"
    }
  },
  "required": [
    "error",
    "code"
  ]
}

Manifest ​

json
{
  "title": "HeySO SaaS application manifest 1.0.0",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "contractVersion",
    "id",
    "name",
    "description",
    "launchUrl",
    "redirectUris",
    "secretEnv",
    "scopes",
    "scope",
    "status"
  ],
  "properties": {
    "contractVersion": {
      "const": "1.0.0"
    },
    "id": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9-]{1,47}$",
      "not": {
        "const": "heyso"
      }
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "description": {
      "type": "string",
      "maxLength": 500
    },
    "launchUrl": {
      "type": "string",
      "format": "uri",
      "pattern": "^https://"
    },
    "redirectUris": {
      "type": "array",
      "minItems": 1,
      "maxItems": 8,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "format": "uri",
        "pattern": "^https://"
      }
    },
    "secretEnv": {
      "type": "string",
      "pattern": "^HEYSO_APP_[A-Z0-9_]+_SECRET$"
    },
    "scopes": {
      "type": "array",
      "uniqueItems": true,
      "contains": {
        "const": "identity.read"
      },
      "items": {
        "enum": [
          "identity.read",
          "data.read",
          "data.write",
          "app.manage"
        ]
      }
    },
    "scope": {
      "enum": [
        "tenant",
        "project"
      ]
    },
    "status": {
      "enum": [
        "active",
        "disabled"
      ]
    }
  },
  "description": "Server additionally checks URL credentials/fragments, redirect origin equality, unique credential environment references and readiness before activation."
}

Identity ​

json
{
  "type": "object",
  "properties": {
    "contractVersion": {
      "type": "string"
    },
    "issuer": {
      "type": "string"
    },
    "audience": {
      "type": "string"
    },
    "subject": {
      "type": "string"
    },
    "tenantId": {
      "type": "string"
    },
    "displayName": {
      "type": "string"
    },
    "organizationRole": {
      "type": "string"
    },
    "appRole": {
      "type": "string"
    },
    "projectId": {
      "type": [
        "string",
        "null"
      ]
    },
    "scopes": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "expiresAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "contractVersion",
    "issuer",
    "audience",
    "subject",
    "tenantId",
    "scopes"
  ]
}

Client ​

json
{
  "type": "object",
  "properties": {
    "client_id": {
      "type": "string"
    },
    "client_secret": {
      "type": "string",
      "writeOnly": true
    }
  },
  "required": [
    "client_id",
    "client_secret"
  ]
}

Authorize ​

json
{
  "type": "object",
  "properties": {
    "client_id": {
      "type": "string"
    },
    "tenant_id": {
      "type": "string"
    },
    "project_id": {
      "type": "string"
    },
    "redirect_uri": {
      "type": "string"
    },
    "scope": {
      "type": "string"
    },
    "state": {
      "type": "string"
    },
    "code_challenge": {
      "type": "string"
    },
    "code_challenge_method": {
      "type": "string"
    }
  },
  "required": [
    "client_id",
    "tenant_id",
    "redirect_uri",
    "scope",
    "state",
    "code_challenge",
    "code_challenge_method"
  ]
}

Token ​

json
{
  "type": "object",
  "properties": {
    "client_id": {
      "type": "string",
      "writeOnly": false
    },
    "client_secret": {
      "type": "string",
      "writeOnly": true
    },
    "grant_type": {
      "type": "string",
      "writeOnly": false
    },
    "code": {
      "type": "string",
      "writeOnly": true
    },
    "code_verifier": {
      "type": "string",
      "writeOnly": true
    },
    "redirect_uri": {
      "type": "string",
      "writeOnly": false
    }
  },
  "required": [
    "client_id",
    "client_secret",
    "grant_type",
    "code",
    "code_verifier",
    "redirect_uri"
  ]
}

TokenResult ​

json
{
  "type": "object",
  "properties": {
    "access_token": {
      "type": "string"
    },
    "token_type": {
      "const": "Bearer"
    },
    "expires_in": {
      "type": "integer"
    },
    "scope": {
      "type": "string"
    },
    "identity": {
      "$ref": "#/components/schemas/Identity"
    }
  },
  "required": [
    "access_token",
    "token_type",
    "expires_in",
    "scope",
    "identity"
  ]
}

ClientToken ​

json
{
  "type": "object",
  "properties": {
    "client_id": {
      "type": "string"
    },
    "client_secret": {
      "type": "string",
      "writeOnly": true
    },
    "token": {
      "type": "string",
      "writeOnly": true
    }
  },
  "required": [
    "client_id",
    "client_secret",
    "token"
  ]
}

Check ​

json
{
  "type": "object",
  "properties": {
    "client_id": {
      "type": "string"
    },
    "client_secret": {
      "type": "string",
      "writeOnly": true
    },
    "token": {
      "type": "string",
      "writeOnly": true
    },
    "tenantId": {
      "type": "string"
    },
    "projectId": {
      "type": [
        "string",
        "null"
      ]
    },
    "permission": {
      "enum": [
        "identity.read",
        "data.read",
        "data.write",
        "app.manage"
      ]
    }
  },
  "required": [
    "client_id",
    "client_secret",
    "token",
    "tenantId",
    "permission"
  ]
}

Installation ​

json
{
  "type": "object",
  "properties": {
    "revision": {
      "type": "integer"
    },
    "appId": {
      "type": "string"
    },
    "status": {
      "enum": [
        "active",
        "disabled"
      ]
    },
    "accessMode": {
      "enum": [
        "organization",
        "members"
      ]
    },
    "scopes": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "grants": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "userId": {
            "type": "string"
          },
          "role": {
            "enum": [
              "admin",
              "editor",
              "viewer",
              "none"
            ]
          }
        },
        "required": [
          "userId",
          "role"
        ]
      }
    }
  },
  "required": [
    "revision",
    "appId",
    "status",
    "accessMode",
    "scopes",
    "grants"
  ]
}

ApplicationCategory ​

json
{
  "type": "string",
  "enum": [
    "official",
    "third-party"
  ],
  "readOnly": true,
  "description": "Platform-owned classification; not accepted in a submitted manifest."
}

ApplicationPresentation ​

json
{
  "type": "object",
  "properties": {
    "category": {
      "$ref": "#/components/schemas/ApplicationCategory"
    },
    "authorizationMode": {
      "type": "string",
      "enum": [
        "organization",
        "user-consent"
      ],
      "readOnly": true
    }
  },
  "description": "Official platform-managed same-origin applications use organization-approved server sessions without user consent. Third-party applications retain consent and PKCE. Both enforce live tenant/member/record permissions."
}

ApplicationCatalog ​

json
{
  "type": "object",
  "required": [
    "contractVersion",
    "tenantId",
    "applications"
  ],
  "properties": {
    "contractVersion": {
      "const": "1.0.0"
    },
    "tenantId": {
      "type": "string"
    },
    "applications": {
      "type": "array",
      "items": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ApplicationPresentation"
          },
          {
            "type": "object",
            "required": [
              "id",
              "name",
              "category",
              "authorizationMode",
              "effectiveScopes"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "effectiveScopes": {
                "type": "array",
                "items": {
                  "enum": [
                    "identity.read",
                    "data.read",
                    "data.write",
                    "app.manage"
                  ]
                }
              }
            }
          }
        ]
      }
    }
  }
}

状态码与处理 ​

状态处理方式
400检查请求、版本、字段、回调和 PKCE
401凭据或会话无效,重新登录或核对服务端配置
403当前身份无权限,不重试绕过
409配置并发冲突或应用未就绪,重新载入核对
429降低请求频率;服务端按来源 IP 与应用每分钟限制 600 次

失败响应包含 error、code 和可用的 requestId。不要记录完整请求或秘密值。introspect 对失效授权返回 active: false;check 的 allowed 必须为 true,且应用还需验证目标对象所属组织/项目。

应用接入协议 1.0.0 · 与平台代码同步维护