{
  "openapi": "3.1.0",
  "info": {
    "title": "RMOZ Enterprise API",
    "version": "2.0.0",
    "description": "Versioned local pilot. Bearer credentials are OIDC JWTs or scoped RMOZ API credentials. Response field typing remains permissive; inputs are strictly validated."
  },
  "paths": {
    "/api/v2/organizations/{org}/evidence": {
      "get": {
        "operationId": "evidenceList",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": true
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      },
      "post": {
        "operationId": "uploadEvidence",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 120,
              "pattern": "^[-a-zA-Z0-9_:]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/evidence"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      }
    },
    "/api/v2/organizations/{org}/evidence/{id}/scan": {
      "post": {
        "operationId": "scanEvidence",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 120,
              "pattern": "^[-a-zA-Z0-9_:]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      }
    },
    "/api/v2/organizations/{org}/members/remove": {
      "post": {
        "operationId": "removeMember",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/removeMember"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      }
    },
    "/api/v2/organizations/{org}/sessions": {
      "get": {
        "operationId": "sessions",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": true
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      }
    },
    "/api/v2/organizations/{org}/sessions/current/revoke": {
      "post": {
        "operationId": "revokeCurrentSession",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/revokeSession"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      }
    },
    "/api/v2/organizations/{org}/sessions/{id}/revoke": {
      "post": {
        "operationId": "revokeSession",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/revokeSession"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      }
    },
    "/api/v2/organizations/{org}/evidence/{id}/delete": {
      "post": {
        "operationId": "deleteEvidence",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      }
    },
    "/api/v2/organizations/{org}/credentials": {
      "post": {
        "operationId": "createCredential",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/credential"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      },
      "get": {
        "operationId": "credentials",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": true
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      }
    },
    "/api/v2/organizations/{org}/credentials/{id}/rotate": {
      "post": {
        "operationId": "rotateCredential",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/rotateCredential"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      }
    },
    "/api/v2/organizations/{org}/credentials/{id}/revoke": {
      "post": {
        "operationId": "revokeCredential",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      }
    },
    "/api/v2/organizations": {
      "get": {
        "operationId": "organizations",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": true
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      },
      "post": {
        "operationId": "onboardOrganization",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/organization"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      }
    },
    "/api/v2/organizations/{org}/members": {
      "get": {
        "operationId": "members",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": true
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      },
      "post": {
        "operationId": "addMember",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/member"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      }
    },
    "/api/v2/organizations/{org}/assets": {
      "get": {
        "operationId": "assets",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": true
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      },
      "post": {
        "operationId": "registerAsset",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 120,
              "pattern": "^[-a-zA-Z0-9_:]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/asset"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      }
    },
    "/api/v2/organizations/{org}/evidence/{id}": {
      "get": {
        "operationId": "getEvidence",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      }
    },
    "/api/v2/organizations/{org}/certificates": {
      "get": {
        "operationId": "certificates",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": true
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      },
      "post": {
        "operationId": "requestCertificate",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 120,
              "pattern": "^[-a-zA-Z0-9_:]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/certificate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      }
    },
    "/api/v2/organizations/{org}/certificates/{id}/approve": {
      "post": {
        "operationId": "approveCertificate",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 120,
              "pattern": "^[-a-zA-Z0-9_:]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      }
    },
    "/api/v2/organizations/{org}/certificates/{id}/issue": {
      "post": {
        "operationId": "issueCertificate",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 120,
              "pattern": "^[-a-zA-Z0-9_:]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      }
    },
    "/api/v2/organizations/{org}/certificates/{id}/revoke": {
      "post": {
        "operationId": "revokeCertificate",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 120,
              "pattern": "^[-a-zA-Z0-9_:]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      }
    },
    "/api/v2/verify/{id}": {
      "get": {
        "operationId": "verifyCertificate",
        "security": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      }
    },
    "/api/v2/organizations/{org}/report": {
      "get": {
        "operationId": "report",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      }
    },
    "/api/v2/organizations/{org}/wallets": {
      "post": {
        "operationId": "registerWallet",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/wallet"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      }
    },
    "/api/v2/organizations/{org}/tokenization": {
      "post": {
        "operationId": "requestTokenization",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 120,
              "pattern": "^[-a-zA-Z0-9_:]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/tokenize"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      }
    },
    "/api/v2/organizations/{org}/assets/{id}/transfer": {
      "post": {
        "operationId": "transferAsset",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      }
    },
    "/api/v2/organizations/{org}/webhooks": {
      "post": {
        "operationId": "createWebhook",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/webhook"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      },
      "get": {
        "operationId": "webhooks",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": true
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      }
    },
    "/api/v2/organizations/{org}/webhooks/{id}/rotate": {
      "post": {
        "operationId": "rotateWebhook",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      }
    },
    "/api/v2/organizations/{org}/deliveries/{id}/replay": {
      "post": {
        "operationId": "replayWebhookDelivery",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      }
    },
    "/api/v2/organizations/{org}/deliveries": {
      "get": {
        "operationId": "webhookDeliveries",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation; attested certificate does not imply blockchain finality",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": true
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Tenant or role denied"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "State or idempotency conflict"
          },
          "500": {
            "description": "Sanitized internal failure"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "credential": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "subject": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "scopes": {
            "minItems": 1,
            "maxItems": 8,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "assets",
                "certificates",
                "getEvidence",
                "report",
                "registerAsset",
                "uploadEvidence",
                "requestCertificate",
                "verifyCertificate"
              ]
            }
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          }
        },
        "required": [
          "subject",
          "scopes",
          "expiresAt"
        ],
        "additionalProperties": false
      },
      "rotateCredential": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          }
        },
        "additionalProperties": false
      },
      "organization": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          }
        },
        "required": [
          "name"
        ],
        "additionalProperties": false
      },
      "member": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "subject": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "role": {
            "type": "string",
            "enum": [
              "admin",
              "issuer",
              "approver",
              "viewer"
            ]
          }
        },
        "required": [
          "subject",
          "role"
        ],
        "additionalProperties": false
      },
      "removeMember": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "subject": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "required": [
          "subject"
        ],
        "additionalProperties": false
      },
      "revokeSession": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 240
          }
        },
        "additionalProperties": false
      },
      "asset": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "category": {
            "type": "string",
            "enum": [
              "gold",
              "product",
              "document"
            ]
          },
          "transferPolicy": {
            "default": "restricted",
            "type": "string",
            "enum": [
              "restricted",
              "approval_required"
            ]
          }
        },
        "required": [
          "name",
          "category",
          "transferPolicy"
        ],
        "additionalProperties": false
      },
      "evidence": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "assetId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "mediaType": {
            "type": "string",
            "enum": [
              "text/plain",
              "application/pdf",
              "image/png",
              "image/jpeg"
            ]
          },
          "contentBase64": {
            "type": "string",
            "minLength": 4,
            "maxLength": 1398104,
            "pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$"
          },
          "retentionDays": {
            "default": 365,
            "type": "integer",
            "minimum": 1,
            "maximum": 3650
          }
        },
        "required": [
          "assetId",
          "mediaType",
          "contentBase64",
          "retentionDays"
        ],
        "additionalProperties": false
      },
      "certificate": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "assetId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "documentId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "publicTitle": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "publicConsent": {
            "type": "boolean",
            "const": true
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          }
        },
        "required": [
          "assetId",
          "documentId",
          "publicTitle",
          "publicConsent",
          "expiresAt"
        ],
        "additionalProperties": false
      },
      "webhook": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "maxLength": 2048,
            "format": "uri"
          }
        },
        "required": [
          "url"
        ],
        "additionalProperties": false
      },
      "wallet": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "network": {
            "type": "string",
            "enum": [
              "localnet",
              "testnet"
            ]
          },
          "address": {
            "type": "string",
            "pattern": "^0x[0-9a-f]{64}$"
          }
        },
        "required": [
          "network",
          "address"
        ],
        "additionalProperties": false
      },
      "tokenize": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "assetId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "network": {
            "type": "string",
            "enum": [
              "localnet",
              "testnet"
            ]
          }
        },
        "required": [
          "assetId",
          "network"
        ],
        "additionalProperties": false
      }
    }
  }
}
