{
  "openapi": "3.1.0",
  "info": {
    "title": "CGBB agent API",
    "version": "1.0.0",
    "description": "The Council for Global Brand Building (CGBB, 品信會) is an open, non-profit council that sets standards for how trust is assessed and rated in business. AI agents can apply on behalf of a brand for free CGBB membership and, once approved with a confirmed domain, obtain a signed CGBB Member trust.json to publish at /.well-known/trust.json.",
    "contact": {
      "email": "secretariat@cgbb.org",
      "url": "https://cgbb.org/agents/"
    }
  },
  "servers": [
    {
      "url": "https://api.cgbb.org"
    }
  ],
  "paths": {
    "/api/agent/apply": {
      "post": {
        "operationId": "applyForMembership",
        "summary": "Apply for free CGBB membership on behalf of a brand",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "organisation",
                  "domain",
                  "contact_name",
                  "contact_email"
                ],
                "properties": {
                  "organisation": {
                    "type": "string",
                    "description": "Legal or brand name of the organisation"
                  },
                  "domain": {
                    "type": "string",
                    "description": "The brand’s own website domain, e.g. brand.com"
                  },
                  "contact_name": {
                    "type": "string"
                  },
                  "contact_email": {
                    "type": "string",
                    "format": "email",
                    "description": "A real person at the brand who will confirm by email"
                  },
                  "job_title": {
                    "type": "string"
                  },
                  "category": {
                    "type": "string",
                    "enum": [
                      "organizational",
                      "individual"
                    ],
                    "default": "organizational"
                  },
                  "country": {
                    "type": "string"
                  },
                  "markets": {
                    "type": "string",
                    "description": "Primary markets"
                  },
                  "about": {
                    "type": "string",
                    "description": "Short introduction to the brand (max 1200 characters)"
                  },
                  "agent_name": {
                    "type": "string",
                    "description": "Name of the AI agent or tool making the application"
                  },
                  "lang": {
                    "type": "string",
                    "enum": [
                      "en",
                      "zh"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Application created; returns the domain-verification token and next steps"
          }
        }
      }
    },
    "/api/agent/check-domain": {
      "post": {
        "operationId": "checkDomain",
        "summary": "Check that the domain-verification token has been published",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "application_id"
                ],
                "properties": {
                  "application_id": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Application status"
          }
        }
      }
    },
    "/api/agent/applications/{application_id}": {
      "get": {
        "operationId": "getApplicationStatus",
        "summary": "Status of an application",
        "parameters": [
          {
            "name": "application_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Application status"
          }
        }
      }
    },
    "/verify/{domain}": {
      "get": {
        "operationId": "verifyBrand",
        "summary": "Live CGBB record for a domain (add ?format=json)",
        "parameters": [
          {
            "name": "domain",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "json"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Verification record"
          }
        }
      }
    },
    "/trust/{domain}.json": {
      "get": {
        "operationId": "getTrustFile",
        "summary": "The signed CGBB trust.json for a domain",
        "parameters": [
          {
            "name": "domain",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "trust.json"
          },
          "404": {
            "description": "No valid record"
          }
        }
      }
    }
  }
}