{
  "openapi": "3.0.3",
  "info": {
    "title": "DocPatch API",
    "version": "1.0.0",
    "description": "DocPatch converts Markdown documentation into Docusaurus, MkDocs or GitBook output. Input is Markdown only. Links, bold/italic formatting, nested headings (H1 to H3) and tables are carried through as-is; frontmatter fields are translated between formats where a real equivalent exists and dropped where none exists. It does not accept HTML, PDF, Word, Confluence or Notion as input and does not produce PDF or HTML output.\n\nAuthentication: send your API key in the `x-api-key` header. Get a key by signing up on https://oculix.io/docs/docpatch/. Each successful call uses 1 credit from your quota; an identical repeat of a recent request can be answered from a short-lived cache without using a credit (the response then carries `cached: true`). When the quota is used up the API returns 402.",
    "contact": {
      "name": "Oculix LLC",
      "url": "https://oculix.io",
      "email": "info@oculix.net"
    },
    "license": {
      "name": "Proprietary",
      "url": "https://oculix.io/legal/terms/"
    }
  },
  "servers": [
    {
      "url": "https://api.docpatch.dev",
      "description": "Production"
    }
  ],
  "externalDocs": {
    "description": "Documentation and live widget",
    "url": "https://oculix.io/docs/docpatch/"
  },
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          },
          "supportedMethods": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "error"
        ]
      }
    }
  },
  "security": [
    {
      "ApiKey": []
    }
  ],
  "paths": {
    "/v1/docpatch/migrate": {
      "post": {
        "summary": "Convert Markdown to a target documentation framework",
        "operationId": "migrateMarkdown",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "markdownContent",
                  "targetFramework"
                ],
                "properties": {
                  "markdownContent": {
                    "type": "string",
                    "description": "The Markdown document to convert. Request bodies up to 10 MB are accepted."
                  },
                  "targetFramework": {
                    "type": "string",
                    "description": "Target framework. Supported values: `docusaurus`, `mkdocs`, `gitbook`. The API does not validate this field, so any other value is unsupported and its output is not guaranteed.",
                    "example": "docusaurus"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Converted document",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "status",
                    "migratedDocument"
                  ],
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "success"
                    },
                    "migratedDocument": {
                      "type": "string"
                    },
                    "cached": {
                      "type": "boolean",
                      "description": "Present and true when an identical earlier request was served from cache."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing x-api-key, markdownContent or targetFramework",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "Missing parameters"
                }
              }
            }
          },
          "401": {
            "description": "Unknown or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "Unauthorized"
                }
              }
            }
          },
          "402": {
            "description": "Quota depleted: the key has no credits left",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "Quota Depleted"
                }
              }
            }
          },
          "500": {
            "description": "Conversion failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "string"
                }
              }
            }
          }
        }
      }
    },
    "/v1/usage": {
      "get": {
        "summary": "Remaining quota and call counts",
        "description": "Served by the auth service, not the product API. Returns the remaining credit quota for the key and a call-count breakdown.",
        "operationId": "getUsage",
        "servers": [
          {
            "url": "https://auth.docpatch.dev"
          }
        ],
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Quota and usage",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "tenantId": {
                      "type": "string"
                    },
                    "product": {
                      "type": "string"
                    },
                    "remainingCreditQuota": {
                      "type": "integer"
                    },
                    "includedQuota": {
                      "type": "integer"
                    },
                    "usage": {
                      "type": "object",
                      "properties": {
                        "totalCalls": {
                          "type": "integer"
                        },
                        "callsLast30Days": {
                          "type": "integer"
                        },
                        "lastCallAt": {
                          "type": "string",
                          "nullable": true
                        },
                        "byEndpoint": {
                          "type": "array",
                          "items": {
                            "type": "object"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing x-api-key header",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "Missing x-api-key header"
                }
              }
            }
          },
          "401": {
            "description": "Unknown key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "Unauthorized"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "string"
                }
              }
            }
          }
        }
      }
    }
  }
}
