{
  "openapi": "3.0.3",
  "info": {
    "title": "BugBeacon Ingestion API",
    "description": "Error and crash reporting for AI agents, apps and scripts. One endpoint takes a JSON report, groups it into an issue by fingerprint, and answers with the issue id and whether the issue is new. Guides: https://bug-beacon.net/guides/",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://bug-beacon.net/api/v1",
      "description": "BugBeacon hosted ingest API"
    }
  ],
  "paths": {
    "/notify": {
      "post": {
        "summary": "Report an error or crash event",
        "description": "Accepts crash and error reports from any client application. Deduplicates using intelligent fingerprinting and aggregates into actionable issues.",
        "parameters": [
          {
            "name": "X-Api-Key",
            "in": "header",
            "required": false,
            "description": "Project API key (can alternatively be sent in the request body)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CrashReport"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Report accepted for processing",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "issueId": {
                      "type": "string",
                      "example": "a1b2c3d4e5f67890"
                    },
                    "eventId": {
                      "type": "string",
                      "example": "ev_01HKR5S9..."
                    },
                    "isNewIssue": {
                      "type": "boolean",
                      "example": false
                    },
                    "message": {
                      "type": "string",
                      "example": "Crash report accepted for processing"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key"
          },
          "400": {
            "description": "Invalid payload format"
          }
        }
      }
    },
    "/health": {
      "get": {
        "summary": "Ingest service health check",
        "responses": {
          "200": {
            "description": "Service is healthy"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CrashReport": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "apiKey": {
            "type": "string",
            "description": "Project API key. Optional when the X-Api-Key header is sent.",
            "example": "bb_live_948f219e2"
          },
          "error": {
            "type": "object",
            "required": [
              "name"
            ],
            "properties": {
              "name": {
                "type": "string",
                "example": "TypeError"
              },
              "message": {
                "type": "string",
                "example": "Cannot read properties of undefined"
              },
              "stacktrace": {
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "file": {
                          "type": "string",
                          "example": "src/App.tsx"
                        },
                        "method": {
                          "type": "string",
                          "example": "onCheckout"
                        },
                        "lineNumber": {
                          "type": "integer",
                          "example": 142
                        },
                        "columnNumber": {
                          "type": "integer",
                          "example": 8
                        },
                        "inProject": {
                          "type": "boolean",
                          "example": true
                        }
                      }
                    }
                  }
                ]
              },
              "severity": {
                "type": "string",
                "enum": [
                  "error",
                  "warning",
                  "info"
                ],
                "default": "error"
              },
              "unhandled": {
                "type": "boolean",
                "default": true
              }
            }
          },
          "app": {
            "type": "object",
            "properties": {
              "platform": {
                "type": "string",
                "enum": [
                  "web",
                  "android",
                  "ios",
                  "react-native",
                  "flutter",
                  "node",
                  "other"
                ],
                "example": "web"
              },
              "version": {
                "type": "string",
                "example": "1.4.2"
              },
              "build": {
                "type": "string",
                "example": "208"
              },
              "releaseStage": {
                "type": "string",
                "example": "production"
              }
            }
          },
          "device": {
            "type": "object",
            "properties": {
              "os": {
                "type": "string",
                "example": "Android"
              },
              "osVersion": {
                "type": "string",
                "example": "14"
              },
              "model": {
                "type": "string",
                "example": "Pixel 8"
              },
              "manufacturer": {
                "type": "string",
                "example": "Google"
              },
              "browser": {
                "type": "string",
                "example": "Chrome"
              },
              "screenResolution": {
                "type": "string",
                "example": "1080x2400"
              },
              "locale": {
                "type": "string",
                "example": "en-US"
              }
            }
          },
          "user": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "example": "usr_991"
              },
              "email": {
                "type": "string",
                "example": "alex@example.com"
              },
              "name": {
                "type": "string",
                "example": "Alex Doe"
              }
            }
          },
          "breadcrumbs": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "timestamp": {
                  "type": "string",
                  "example": "2026-11-23T21:15:00Z"
                },
                "category": {
                  "type": "string",
                  "example": "navigation"
                },
                "message": {
                  "type": "string",
                  "example": "User navigated to /checkout"
                },
                "level": {
                  "type": "string",
                  "example": "info"
                }
              }
            }
          },
          "metadata": {
            "type": "object",
            "description": "Arbitrary key-value diagnostic metadata",
            "example": {
              "cartTotal": 89.99,
              "itemsCount": 3
            }
          },
          "fingerprint": {
            "type": "string",
            "description": "Optional custom grouping fingerprint to override automatic deduplication"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          }
        }
      }
    }
  }
}