GPTZero API

AI content detection API — analyze text and document files for AI-generated content, submit asynchronous batch jobs, and retrieve detection reports. Returns classification (human/ai/mixed) with document-, paragraph-, and sentence-level probabilities.

OpenAPI Specification

gptzero-openapi-original.json Raw ↑
{
  "openapi": "3.0.3",
  "info": {
    "title": "GPTZero API",
    "description": "AI content detection API for analyzing text to detect AI-generated content.",
    "version": "1.0.0",
    "x-jentic-source-url": "https://gptzero.stoplight.io/",
    "contact": {}
  },
  "servers": [
    {
      "url": "https://api.gptzero.me/v2"
    }
  ],
  "paths": {
    "/predict/text": {
      "post": {
        "tags": [
          "Detection"
        ],
        "summary": "Analyze text",
        "operationId": "analyzeText",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TextAnalysisInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Analysis complete",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnalysisResult"
                }
              }
            }
          }
        },
        "description": "Analyze text"
      }
    },
    "/predict/files": {
      "post": {
        "tags": [
          "Documents"
        ],
        "summary": "Analyze document",
        "operationId": "analyzeDocument",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Analysis complete",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentAnalysisResult"
                }
              }
            }
          }
        },
        "description": "Analyze document"
      }
    },
    "/batch": {
      "post": {
        "tags": [
          "Batch"
        ],
        "summary": "Create batch analysis",
        "operationId": "createBatchAnalysis",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Batch created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Batch"
                }
              }
            }
          }
        },
        "description": "Create batch analysis"
      }
    },
    "/batch/{batchId}": {
      "get": {
        "tags": [
          "Batch"
        ],
        "summary": "Get batch status",
        "operationId": "getBatchStatus",
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Batch"
                }
              }
            }
          }
        },
        "description": "Get batch status"
      }
    },
    "/batch/{batchId}/results": {
      "get": {
        "tags": [
          "Batch"
        ],
        "summary": "Get batch results",
        "operationId": "getBatchResults",
        "parameters": [
          {
            "name": "batchId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AnalysisResult"
                  }
                }
              }
            }
          }
        },
        "description": "Get batch results"
      }
    },
    "/reports": {
      "get": {
        "tags": [
          "Detection"
        ],
        "summary": "List reports",
        "operationId": "listReports",
        "parameters": [
          {
            "name": "startDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Report"
                  }
                }
              }
            }
          }
        },
        "description": "List reports"
      }
    },
    "/reports/{reportId}": {
      "get": {
        "tags": [
          "Detection"
        ],
        "summary": "Get report",
        "operationId": "getReport",
        "parameters": [
          {
            "name": "reportId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Report"
                }
              }
            }
          }
        },
        "description": "Get report"
      }
    }
  },
  "components": {
    "schemas": {
      "TextAnalysisInput": {
        "type": "object",
        "required": [
          "document"
        ],
        "properties": {
          "document": {
            "type": "string",
            "description": "Text to analyze"
          },
          "multilingual": {
            "type": "boolean",
            "default": false
          }
        }
      },
      "AnalysisResult": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "documentId": {
            "type": "string"
          },
          "completely_generated_prob": {
            "type": "number",
            "format": "float",
            "description": "Probability that text is completely AI-generated"
          },
          "average_generated_prob": {
            "type": "number",
            "format": "float",
            "description": "Average probability across sentences"
          },
          "overall_burstiness": {
            "type": "number",
            "format": "float"
          },
          "perplexity": {
            "type": "number",
            "format": "float"
          },
          "sentences": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "sentence": {
                  "type": "string"
                },
                "generated_prob": {
                  "type": "number",
                  "format": "float"
                },
                "perplexity": {
                  "type": "number",
                  "format": "float"
                }
              }
            }
          },
          "classification": {
            "type": "string",
            "enum": [
              "human",
              "ai",
              "mixed"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DocumentAnalysisResult": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "filename": {
            "type": "string"
          },
          "classification": {
            "type": "string",
            "enum": [
              "human",
              "ai",
              "mixed"
            ]
          },
          "completely_generated_prob": {
            "type": "number",
            "format": "float"
          },
          "pageResults": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "pageNumber": {
                  "type": "integer"
                },
                "classification": {
                  "type": "string",
                  "enum": [
                    "human",
                    "ai",
                    "mixed"
                  ]
                },
                "generated_prob": {
                  "type": "number",
                  "format": "float"
                }
              }
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "BatchInput": {
        "type": "object",
        "required": [
          "documents"
        ],
        "properties": {
          "documents": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "Batch": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "processing",
              "completed",
              "failed"
            ]
          },
          "totalDocuments": {
            "type": "integer"
          },
          "processedDocuments": {
            "type": "integer"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "completedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Report": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "documentCount": {
            "type": "integer"
          },
          "averageGeneratedProb": {
            "type": "number",
            "format": "float"
          },
          "classifications": {
            "type": "object",
            "properties": {
              "human": {
                "type": "integer"
              },
              "ai": {
                "type": "integer"
              },
              "mixed": {
                "type": "integer"
              }
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      }
    },
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    }
  },
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "tags": [
    {
      "name": "Detection",
      "description": "AI content detection"
    },
    {
      "name": "Documents",
      "description": "Document analysis"
    },
    {
      "name": "Batch",
      "description": "Batch processing"
    }
  ]
}