{
  "openapi": "3.1.0",
  "info": {
    "title": "Ellora Platform API",
    "version": "1.0.0",
    "description": "Detects AI slop patterns in text. Findings only: no rewrites, no score.\nSubmitted text is never written to logs. By default the text and the findings of each call are stored for\n365 days and shown only to the workspace's admins; a workspace on Zero Data Retention stores nothing. Every\nsuccessful response says which (`stored`).\nBilling is prepaid and metered by word count.\n"
  },
  "servers": [
    {
      "url": "https://platform-api.getellora.com"
    }
  ],
  "security": [
    {
      "bearerKey": []
    }
  ],
  "paths": {
    "/v1/detect": {
      "post": {
        "operationId": "detect",
        "summary": "Detect AI slop patterns in text",
        "description": "Cost is ceil(words / 1000 x price per 1,000 words). Rejected requests are never charged, and a 500 is refunded.\n\nWhat counts as a word: split the text on whitespace; a piece counts as one word if it contains at least one letter or digit in any script.\nSo \"don't\", \"well-known\", \"3.14\" and a URL are one word each, and bare punctuation is not counted.\nChinese and Japanese have no spaces, so each Han, Hiragana or Katakana character counts as one word.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "text"
                ],
                "properties": {
                  "text": {
                    "type": "string",
                    "maxLength": 100000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Findings",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              },
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DetectResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/invalid_request"
          },
          "401": {
            "$ref": "#/components/responses/invalid_api_key"
          },
          "402": {
            "$ref": "#/components/responses/insufficient_credit"
          },
          "403": {
            "$ref": "#/components/responses/account_suspended"
          },
          "413": {
            "$ref": "#/components/responses/text_too_large"
          },
          "429": {
            "description": "rate_limited",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/internal_error"
          }
        }
      }
    },
    "/v1/requests/{id}": {
      "get": {
        "operationId": "getRequest",
        "summary": "A past call of your workspace, with its stored text and findings",
        "description": "Returns the text and the findings of an earlier successful call made by any key of the same workspace, while they\nare stored. It answers 404 `not_found` when nothing is stored: the call is older than the retention period (365\ndays), it was deleted, it was made under Zero Data Retention, or it belongs to another workspace. Reading is free.\n",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The `id` of the detect response (the `X-Request-Id` header).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The stored call",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoredRequest"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/invalid_api_key"
          },
          "404": {
            "$ref": "#/components/responses/not_found"
          },
          "429": {
            "description": "rate_limited",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "An API key (elk_live_...) created in the console."
      }
    },
    "responses": {
      "invalid_request": {
        "description": "invalid_request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "invalid_api_key": {
        "description": "invalid_api_key",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "insufficient_credit": {
        "description": "insufficient_credit",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "account_suspended": {
        "description": "account_suspended",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "text_too_large": {
        "description": "text_too_large",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "not_found": {
        "description": "not_found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "internal_error": {
        "description": "internal_error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "invalid_api_key",
                  "insufficient_credit",
                  "account_suspended",
                  "text_too_large",
                  "rate_limited",
                  "not_found",
                  "internal_error"
                ]
              },
              "message": {
                "type": "string"
              },
              "request_id": {
                "type": "string"
              }
            }
          }
        }
      },
      "Finding": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "A ULID. When the call is stored, it is the id of the stored finding."
          },
          "rule_id": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "severity": {
            "type": "string",
            "enum": [
              "red",
              "yellow",
              "blue"
            ]
          },
          "scope": {
            "type": "string",
            "enum": [
              "document",
              "sentence"
            ],
            "description": "What the finding is about. `document`: the text as a whole (it has no sentence). `sentence`: one sentence. Paragraph and word scopes are reserved."
          },
          "sentence": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The 1-based number of the sentence, counted after Markdown is converted to plain text. Null for a document finding."
          },
          "excerpt": {
            "type": [
              "string",
              "null"
            ],
            "description": "The whole sentence the finding is about, not only the matched words. Null for a document finding."
          },
          "reason": {
            "type": "string",
            "description": "Why it is flagged. Explanatory, and the same sentence can repeat across findings of a kind."
          },
          "suggestion": {
            "type": "string",
            "description": "A short fragment (\"use a specific verb\"), not a full sentence."
          }
        }
      },
      "DetectResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "ruleset_version": {
            "type": "string"
          },
          "words_count": {
            "type": "integer"
          },
          "characters_count": {
            "type": "integer"
          },
          "cost": {
            "type": "number",
            "example": 0.0041,
            "description": "What this call cost, in US dollars, exact to the micro-dollar."
          },
          "findings_count": {
            "type": "object",
            "properties": {
              "total": {
                "type": "integer"
              },
              "red": {
                "type": "integer"
              },
              "yellow": {
                "type": "integer"
              },
              "blue": {
                "type": "integer"
              }
            }
          },
          "findings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Finding"
            }
          },
          "stored": {
            "type": "boolean",
            "description": "True when the text and findings of this call were stored (the default). False under Zero Data Retention, or if storing failed (the call is still answered and charged)."
          }
        }
      },
      "StoredRequest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "ruleset_version": {
            "type": "string"
          },
          "words_count": {
            "type": "integer"
          },
          "characters_count": {
            "type": "integer"
          },
          "cost": {
            "type": "number"
          },
          "findings_count": {
            "type": "object",
            "properties": {
              "total": {
                "type": "integer"
              },
              "red": {
                "type": "integer"
              },
              "yellow": {
                "type": "integer"
              },
              "blue": {
                "type": "integer"
              }
            }
          },
          "text": {
            "type": "string",
            "description": "The text exactly as submitted."
          },
          "findings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Finding"
            }
          }
        }
      }
    }
  }
}