{
  "openapi": "3.0.1",
  "info": {
    "title": "Criteria Checker: AI QA Gate for Emails & LLM Output",
    "description": "Pass/fail AI QA gate for automations: check text or JSON against templates or your own criteria with calibrated probabilities. Thresholds, review band and a report. Built-in classification engine, no external API key needed. For n8n, Make and MCP.",
    "version": "1.0",
    "x-build-id": "cEs9sntHqwdiPw0pJ"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/ferrolark~criteria-checker/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-ferrolark-criteria-checker",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/ferrolark~criteria-checker/runs": {
      "post": {
        "operationId": "runs-sync-ferrolark-criteria-checker",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/ferrolark~criteria-checker/run-sync": {
      "post": {
        "operationId": "run-sync-ferrolark-criteria-checker",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "state": {
            "title": "Content to check",
            "type": "string",
            "description": "The text to check, for example an AI-written email or answer. For many items use 'items'."
          },
          "reference": {
            "title": "Reference (optional)",
            "type": "string",
            "description": "Source material, the question asked, or the customer message the content must match. Needed by llm-answer-grounded and support-reply."
          },
          "template": {
            "title": "Template",
            "enum": [
              "none",
              "email-before-send",
              "llm-answer-grounded",
              "support-reply",
              "blog-post-prepublish",
              "product-description",
              "social-post"
            ],
            "type": "string",
            "description": "A ready set of criteria. Add your own below; a custom criterion with the same id replaces the template's.",
            "default": "email-before-send"
          },
          "criteria": {
            "title": "Custom criteria",
            "type": "array",
            "description": "List of {\"id\", \"instructions\", \"type\": \"noul\"|\"score\"|\"choice\", ...}. Noul: passThreshold (0.7), passWhenFalse. Score: criteria (levels low to high), scorePassMin. Choice: criteria (map), passOptions, minProbability. Any: required, weight, minConfidence, severity."
          },
          "disableCriteria": {
            "title": "Disable template criteria",
            "type": "array",
            "description": "Template criterion ids to skip.",
            "items": {
              "type": "string"
            }
          },
          "items": {
            "title": "Batch items (optional)",
            "type": "array",
            "description": "Up to 100 items: [{\"id\": \"msg-1\", \"state\": \"...\", \"reference\": \"...\"}]. One classification request per item (max 20,000 characters each)."
          },
          "noulThreshold": {
            "title": "Default pass threshold (yes/no criteria)",
            "type": "string",
            "description": "Probability needed to pass. Raise it where a wrong pass is expensive.",
            "default": "0.7"
          },
          "reviewBand": {
            "title": "Review band",
            "type": "string",
            "description": "Answers this far below the threshold are 'review' instead of 'fail'.",
            "default": "0.2"
          },
          "policy": {
            "title": "Overall rule",
            "enum": [
              "all_required",
              "weighted"
            ],
            "type": "string",
            "description": "How the overall result is computed.",
            "default": "all_required"
          },
          "minWeightedScore": {
            "title": "Minimum weighted score",
            "type": "string",
            "description": "For the weighted rule (0 to 1).",
            "default": "0.8"
          },
          "failClosed": {
            "title": "Treat 'review' as 'fail'",
            "type": "boolean",
            "description": "For gates where nothing uncertain may pass.",
            "default": false
          },
          "model": {
            "title": "Jev model",
            "type": "string",
            "description": "Classification model alias (default jev-latest). Pin a version such as jev-1.14.0 when you tune thresholds.",
            "default": "jev-latest"
          },
          "concurrency": {
            "title": "Parallel requests",
            "minimum": 1,
            "maximum": 4,
            "type": "integer",
            "description": "Parallel classification requests (capped at 4).",
            "default": 4
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}