{
  "openapi": "3.1.0",
  "info": {
    "title": "Blackline AI API",
    "version": "1.0.0",
    "description": "Programmatic document and text redaction. Detect sensitive entities and redact them — for white-label embeds and enterprise pipelines.",
    "contact": {
      "name": "Blackline AI",
      "email": "contact@blackline-documents.com"
    }
  },
  "servers": [
    {
      "url": "https://blackline-documents.com"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/api/public/v1/detect": {
      "post": {
        "summary": "Detect sensitive entities in text",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "text"
                ],
                "properties": {
                  "text": {
                    "type": "string",
                    "maxLength": 40000
                  },
                  "categories": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Entities found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DetectResult"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "403": {
            "description": "Key lacks the required scope (detect:read)"
          }
        }
      }
    },
    "/api/public/v1/redact": {
      "post": {
        "summary": "Redact sensitive entities in text",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "text"
                ],
                "properties": {
                  "text": {
                    "type": "string",
                    "maxLength": 40000
                  },
                  "categories": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "replacement": {
                    "type": "string",
                    "enum": [
                      "block",
                      "label",
                      "stars"
                    ],
                    "default": "block"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Redacted text",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RedactResult"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/redact-pdf": {
      "post": {
        "summary": "Redact a PDF (Private Beta — returns a job id)",
        "responses": {
          "202": {
            "description": "Job queued"
          }
        }
      }
    },
    "/api/public/v1/jobs/{id}": {
      "get": {
        "summary": "Poll a redaction job",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Job status"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "blk_live_…"
      }
    },
    "schemas": {
      "DetectResult": {
        "type": "object",
        "properties": {
          "entities": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "text": {
                  "type": "string"
                },
                "category": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "RedactResult": {
        "type": "object",
        "properties": {
          "redacted_text": {
            "type": "string"
          },
          "entities_detected": {
            "type": "integer"
          },
          "entities_replaced": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "text": {
                  "type": "string"
                },
                "category": {
                  "type": "string"
                },
                "count": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    }
  }
}