{
  "openapi": "3.1.0",
  "info": {
    "title": "Redactron API",
    "version": "2026-12-05",
    "description": "Find and remove personal data in text, images and audio on private GPUs. Docs: https://api.redactron.ai/",
    "contact": {
      "email": "support@redactron.ai"
    }
  },
  "servers": [
    {
      "url": "https://api.redactron.ai"
    }
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "tags": [
    {
      "name": "Redaction"
    },
    {
      "name": "Account"
    },
    {
      "name": "Inference",
      "description": "Coming soon"
    }
  ],
  "paths": {
    "/v1/redact/text": {
      "post": {
        "tags": [
          "Redaction"
        ],
        "operationId": "redactText",
        "summary": "Redact text",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TextRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Redacted",
            "headers": {
              "$ref": "#/components/headers/RateLimit"
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TextResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "415": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "502": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/redact/image": {
      "post": {
        "tags": [
          "Redaction"
        ],
        "operationId": "redactImage",
        "summary": "Redact an image (one page)",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "image"
                ],
                "properties": {
                  "image": {
                    "type": "string",
                    "format": "binary",
                    "description": "PNG, JPEG, WebP, BMP or TIFF; ≤ 20 MB"
                  },
                  "infotypes": {
                    "type": "string",
                    "description": "JSON array or comma list of categories"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Redacted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImageResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "415": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "502": {
            "$ref": "#/components/responses/Error"
          },
          "504": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/redact/audio": {
      "post": {
        "tags": [
          "Redaction"
        ],
        "operationId": "createAudioJob",
        "summary": "Start an audio redaction job",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "WAV, MP3, M4A, AAC, FLAC, OGG or WMA; ≤ 50 MB"
                  },
                  "language": {
                    "type": "string",
                    "default": "en",
                    "description": "ISO-639 code or auto"
                  },
                  "infotypes": {
                    "type": "string",
                    "description": "JSON array or comma list of categories"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Job queued",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AudioQueued"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "415": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "502": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/redact/audio/{id}": {
      "get": {
        "tags": [
          "Redaction"
        ],
        "operationId": "getAudioJob",
        "summary": "Get an audio job",
        "parameters": [
          {
            "$ref": "#/components/parameters/JobId"
          }
        ],
        "responses": {
          "200": {
            "description": "Job state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AudioJob"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/v1/redact/audio/{id}/file": {
      "get": {
        "tags": [
          "Redaction"
        ],
        "operationId": "getAudioFile",
        "summary": "Download the redacted audio",
        "parameters": [
          {
            "$ref": "#/components/parameters/JobId"
          }
        ],
        "responses": {
          "200": {
            "description": "WAV audio",
            "content": {
              "audio/wav": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/usage": {
      "get": {
        "tags": [
          "Account"
        ],
        "operationId": "getUsage",
        "summary": "Daily usage for this key",
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 90,
              "default": 30
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Usage",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Usage"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/infotypes": {
      "get": {
        "tags": [
          "Account"
        ],
        "operationId": "listInfotypes",
        "summary": "List categories",
        "security": [],
        "responses": {
          "200": {
            "description": "Categories",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "default": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "region": {
                            "type": "string"
                          },
                          "category": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/health": {
      "get": {
        "tags": [
          "Account"
        ],
        "operationId": "health",
        "summary": "Health",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "version": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/chat/completions": {
      "post": {
        "tags": [
          "Inference"
        ],
        "operationId": "createChatCompletion",
        "summary": "Chat completions (coming soon)",
        "description": "OpenAI-compatible inference. Answers 404 coming_soon until it opens.",
        "responses": {
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "Secret key starting with rk_"
      }
    },
    "parameters": {
      "JobId": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^[A-Za-z0-9-]{8,64}$"
        }
      }
    },
    "headers": {
      "RateLimit": {
        "description": "x-ratelimit-limit / x-ratelimit-remaining / x-ratelimit-reset (seconds) and x-request-id are on every authenticated response",
        "schema": {
          "type": "integer"
        }
      }
    },
    "responses": {
      "Error": {
        "description": "Error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "RateLimited": {
        "description": "Rate limited",
        "headers": {
          "retry-after": {
            "schema": {
              "type": "integer"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "Infotypes": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "maxItems": 300,
        "description": "Category names from GET /v1/infotypes, or CUSTOM:<label>. Default: 18 common ones."
      },
      "TextRequest": {
        "type": "object",
        "required": [
          "text"
        ],
        "properties": {
          "text": {
            "type": "string",
            "maxLength": 200000
          },
          "infotypes": {
            "$ref": "#/components/schemas/Infotypes"
          }
        }
      },
      "TextEntity": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "start": {
            "type": "integer"
          },
          "end": {
            "type": "integer"
          }
        }
      },
      "TextResult": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "const": "redaction.text"
          },
          "redacted_text": {
            "type": "string"
          },
          "entities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TextEntity"
            }
          },
          "type_counts": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            }
          },
          "timing_s": {
            "type": [
              "number",
              "null"
            ]
          }
        }
      },
      "ImageResult": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "const": "redaction.image"
          },
          "entities": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string"
                },
                "text": {
                  "type": "string"
                },
                "bbox": {
                  "type": "array",
                  "items": {
                    "type": "integer"
                  },
                  "minItems": 4,
                  "maxItems": 4,
                  "description": "[x0, y0, x1, y1] pixels"
                }
              }
            }
          },
          "count": {
            "type": "integer"
          },
          "redacted_image": {
            "type": "string",
            "description": "data:image/png;base64,…"
          },
          "timing_s": {
            "type": [
              "number",
              "null"
            ]
          }
        }
      },
      "AudioQueued": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "const": "redaction.audio"
          },
          "status": {
            "const": "queued"
          },
          "request_id": {
            "type": "string"
          },
          "poll": {
            "type": "string"
          }
        }
      },
      "AudioJob": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "const": "redaction.audio"
          },
          "status": {
            "enum": [
              "queued",
              "running",
              "done",
              "failed"
            ]
          },
          "stage": {
            "type": [
              "string",
              "null"
            ]
          },
          "language": {
            "type": [
              "string",
              "null"
            ]
          },
          "transcript": {
            "type": [
              "string",
              "null"
            ]
          },
          "redacted_transcript": {
            "type": [
              "string",
              "null"
            ]
          },
          "entities": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string"
                },
                "text": {
                  "type": "string"
                },
                "start_s": {
                  "type": "number"
                },
                "end_s": {
                  "type": "number"
                },
                "score": {
                  "type": "number"
                }
              }
            }
          },
          "verification": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "status": {
                "type": "string"
              },
              "pii_found": {
                "type": "boolean"
              }
            }
          },
          "redacted_audio": {
            "type": "string"
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "Usage": {
        "type": "object",
        "properties": {
          "object": {
            "const": "list"
          },
          "key_name": {
            "type": "string"
          },
          "days": {
            "type": "integer"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "date": {
                  "type": "string",
                  "format": "date"
                },
                "route": {
                  "enum": [
                    "text",
                    "image",
                    "audio"
                  ]
                },
                "calls": {
                  "type": "integer"
                },
                "ok": {
                  "type": "integer"
                },
                "units": {
                  "type": "integer",
                  "description": "characters (text), pages (image), files (audio)"
                }
              }
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "type",
              "code",
              "message",
              "request_id"
            ],
            "properties": {
              "type": {
                "enum": [
                  "invalid_request_error",
                  "authentication_error",
                  "not_found_error",
                  "rate_limit_error",
                  "api_error"
                ]
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "request_id": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}