{
  "components": {
    "schemas": {
      "AddSeatsRequest": {
        "properties": {
          "additional_seats": {
            "title": "Additional Seats",
            "type": "integer"
          }
        },
        "required": [
          "additional_seats"
        ],
        "title": "AddSeatsRequest",
        "type": "object"
      },
      "AddSeatsResponse": {
        "properties": {
          "extra_seats": {
            "title": "Extra Seats",
            "type": "integer"
          },
          "seat_limit": {
            "title": "Seat Limit",
            "type": "integer"
          }
        },
        "required": [
          "extra_seats",
          "seat_limit"
        ],
        "title": "AddSeatsResponse",
        "type": "object"
      },
      "AffectedRepository": {
        "description": "A repository affected by a change to the source repository.",
        "properties": {
          "confidence": {
            "description": "Confidence of the weakest edge on the strongest dependency chain linking this repo to the source repo (a widest path). Always at or above `applied_min_confidence`, so filtering this field yields a stricter blast radius without another request. The chain that produced this value may be longer than `depth`.",
            "title": "Confidence",
            "type": "number"
          },
          "depth": {
            "description": "Fewest dependency hops from the source repository, counting only edges at or above the applied confidence floor.",
            "title": "Depth",
            "type": "integer"
          },
          "full_path": {
            "title": "Full Path",
            "type": "string"
          },
          "id": {
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "full_path",
          "depth",
          "confidence"
        ],
        "title": "AffectedRepository",
        "type": "object"
      },
      "ApiKeyResponse": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key"
          },
          "last_used_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Used At"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "prefix": {
            "title": "Prefix",
            "type": "string"
          },
          "revoked_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Revoked At"
          }
        },
        "required": [
          "id",
          "name",
          "prefix",
          "last_used_at",
          "created_at",
          "revoked_at"
        ],
        "title": "ApiKeyResponse",
        "type": "object"
      },
      "ArtifactConsumer": {
        "description": "A repository that consumes an artifact.",
        "properties": {
          "import_count": {
            "default": 1,
            "title": "Import Count",
            "type": "integer"
          },
          "is_latest": {
            "title": "Is Latest",
            "type": "boolean"
          },
          "repository": {
            "$ref": "#/components/schemas/ArtifactConsumerRepo"
          },
          "source_file": {
            "title": "Source File",
            "type": "string"
          },
          "source_line": {
            "title": "Source Line",
            "type": "integer"
          },
          "version_constraint": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Version Constraint"
          },
          "version_constraint_state": {
            "default": "absent",
            "title": "Version Constraint State",
            "type": "string"
          }
        },
        "required": [
          "repository",
          "version_constraint",
          "source_file",
          "source_line",
          "is_latest"
        ],
        "title": "ArtifactConsumer",
        "type": "object"
      },
      "ArtifactConsumerRepo": {
        "description": "Minimal repository reference embedded in a consumer row.",
        "properties": {
          "full_path": {
            "title": "Full Path",
            "type": "string"
          },
          "id": {
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "full_path"
        ],
        "title": "ArtifactConsumerRepo",
        "type": "object"
      },
      "ArtifactConsumersResponse": {
        "description": "All consumers of a specific artifact.",
        "properties": {
          "artifact": {
            "$ref": "#/components/schemas/ArtifactResponse"
          },
          "consumers": {
            "items": {
              "$ref": "#/components/schemas/ArtifactConsumer"
            },
            "title": "Consumers",
            "type": "array"
          },
          "consumers_lagging": {
            "title": "Consumers Lagging",
            "type": "integer"
          },
          "consumers_on_latest": {
            "title": "Consumers On Latest",
            "type": "integer"
          },
          "latest_version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Latest Version"
          },
          "state_breakdown": {
            "additionalProperties": {
              "type": "integer"
            },
            "default": {},
            "title": "State Breakdown",
            "type": "object"
          },
          "total_consumers": {
            "title": "Total Consumers",
            "type": "integer"
          }
        },
        "required": [
          "artifact",
          "consumers",
          "total_consumers",
          "consumers_on_latest",
          "consumers_lagging",
          "latest_version"
        ],
        "title": "ArtifactConsumersResponse",
        "type": "object"
      },
      "ArtifactResponse": {
        "description": "An artifact (Docker image, Python package, Terraform module, etc.).",
        "properties": {
          "artifact_type": {
            "title": "Artifact Type",
            "type": "string"
          },
          "connected_org_id": {
            "format": "uuid",
            "title": "Connected Org Id",
            "type": "string"
          },
          "consumer_count": {
            "default": 0,
            "title": "Consumer Count",
            "type": "integer"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "is_first_party": {
            "default": true,
            "title": "Is First Party",
            "type": "boolean"
          },
          "is_orphan": {
            "default": false,
            "title": "Is Orphan",
            "type": "boolean"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "registry_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Registry Url"
          },
          "source_repository": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ArtifactSourceRepo"
              },
              {
                "type": "null"
              }
            ]
          },
          "source_repository_id": {
            "anyOf": [
              {
                "format": "uuid",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Repository Id"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Version"
          }
        },
        "required": [
          "id",
          "connected_org_id",
          "artifact_type",
          "name",
          "source_repository_id",
          "registry_url",
          "version",
          "created_at",
          "updated_at"
        ],
        "title": "ArtifactResponse",
        "type": "object"
      },
      "ArtifactSourceRepo": {
        "description": "Minimal representation of the repository that produces an artifact.",
        "properties": {
          "full_path": {
            "title": "Full Path",
            "type": "string"
          },
          "id": {
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "full_path"
        ],
        "title": "ArtifactSourceRepo",
        "type": "object"
      },
      "ArtifactVersionEntry": {
        "description": "A specific version of an artifact seen across the org.",
        "properties": {
          "consumer_count": {
            "title": "Consumer Count",
            "type": "integer"
          },
          "version_constraint": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Version Constraint"
          },
          "version_constraint_state": {
            "default": "absent",
            "title": "Version Constraint State",
            "type": "string"
          }
        },
        "required": [
          "version_constraint",
          "consumer_count"
        ],
        "title": "ArtifactVersionEntry",
        "type": "object"
      },
      "AttachPaymentMethodRequest": {
        "properties": {
          "payment_method_id": {
            "title": "Payment Method Id",
            "type": "string"
          },
          "set_as_default": {
            "default": true,
            "title": "Set As Default",
            "type": "boolean"
          }
        },
        "required": [
          "payment_method_id"
        ],
        "title": "AttachPaymentMethodRequest",
        "type": "object"
      },
      "AttachPaymentMethodResponse": {
        "properties": {
          "is_default": {
            "title": "Is Default",
            "type": "boolean"
          },
          "payment_method": {
            "$ref": "#/components/schemas/PaymentMethodInfo"
          }
        },
        "required": [
          "payment_method",
          "is_default"
        ],
        "title": "AttachPaymentMethodResponse",
        "type": "object"
      },
      "BillingHistoryEvent": {
        "properties": {
          "amount": {
            "title": "Amount",
            "type": "integer"
          },
          "created": {
            "format": "date-time",
            "title": "Created",
            "type": "string"
          },
          "currency": {
            "title": "Currency",
            "type": "string"
          },
          "description": {
            "title": "Description",
            "type": "string"
          },
          "hosted_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hosted Url"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "pdf_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pdf Url"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "type": {
            "enum": [
              "invoice",
              "credit_note"
            ],
            "title": "Type",
            "type": "string"
          }
        },
        "required": [
          "id",
          "type",
          "created",
          "amount",
          "currency",
          "status",
          "description",
          "hosted_url",
          "pdf_url"
        ],
        "title": "BillingHistoryEvent",
        "type": "object"
      },
      "BillingHistoryResponse": {
        "properties": {
          "events": {
            "items": {
              "$ref": "#/components/schemas/BillingHistoryEvent"
            },
            "title": "Events",
            "type": "array"
          },
          "has_more": {
            "title": "Has More",
            "type": "boolean"
          },
          "next_credit_note_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Credit Note Cursor"
          },
          "next_invoice_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Invoice Cursor"
          }
        },
        "required": [
          "events",
          "has_more"
        ],
        "title": "BillingHistoryResponse",
        "type": "object"
      },
      "BillingStatusResponse": {
        "properties": {
          "billing_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Billing Email"
          },
          "billing_period_end": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Billing Period End"
          },
          "can_manage_subscription": {
            "title": "Can Manage Subscription",
            "type": "boolean"
          },
          "cancel_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cancel At"
          },
          "extra_seats": {
            "title": "Extra Seats",
            "type": "integer"
          },
          "over_org_limit": {
            "title": "Over Org Limit",
            "type": "boolean"
          },
          "over_repo_limit": {
            "title": "Over Repo Limit",
            "type": "boolean"
          },
          "over_seat_limit": {
            "title": "Over Seat Limit",
            "type": "boolean"
          },
          "plan": {
            "title": "Plan",
            "type": "string"
          },
          "seat_count": {
            "title": "Seat Count",
            "type": "integer"
          },
          "seat_limit": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Seat Limit"
          },
          "stripe_enabled": {
            "title": "Stripe Enabled",
            "type": "boolean"
          },
          "subscription_status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Subscription Status"
          },
          "trial_ends_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Trial Ends At"
          }
        },
        "required": [
          "plan",
          "subscription_status",
          "seat_count",
          "seat_limit",
          "extra_seats",
          "trial_ends_at",
          "billing_email",
          "billing_period_end",
          "stripe_enabled",
          "over_seat_limit",
          "over_org_limit",
          "over_repo_limit",
          "can_manage_subscription",
          "cancel_at"
        ],
        "title": "BillingStatusResponse",
        "type": "object"
      },
      "BillingUsageResponse": {
        "properties": {
          "billing_period_end": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Billing Period End"
          },
          "extra_seats": {
            "title": "Extra Seats",
            "type": "integer"
          },
          "features": {
            "additionalProperties": {
              "type": "boolean"
            },
            "title": "Features",
            "type": "object"
          },
          "org_connections": {
            "$ref": "#/components/schemas/UsageResource"
          },
          "plan": {
            "title": "Plan",
            "type": "string"
          },
          "repos": {
            "$ref": "#/components/schemas/UsageResource"
          },
          "seats": {
            "$ref": "#/components/schemas/UsageResource"
          },
          "subscription_status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Subscription Status"
          }
        },
        "required": [
          "plan",
          "repos",
          "seats",
          "extra_seats",
          "org_connections",
          "features",
          "subscription_status",
          "billing_period_end"
        ],
        "title": "BillingUsageResponse",
        "type": "object"
      },
      "CancelPreviewResponse": {
        "description": "Pending charges that will be billed on the final cycle invoice if not waived.\n\n``pending_total`` includes credits (negative items); ``pending_items`` shows\nonly positive lines so the UI surfaces what the user will actually pay.",
        "properties": {
          "currency": {
            "title": "Currency",
            "type": "string"
          },
          "next_invoice_date": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Invoice Date"
          },
          "pending_items": {
            "items": {
              "$ref": "#/components/schemas/PendingInvoiceItem"
            },
            "title": "Pending Items",
            "type": "array"
          },
          "pending_total": {
            "title": "Pending Total",
            "type": "integer"
          }
        },
        "required": [
          "pending_total",
          "pending_items",
          "next_invoice_date",
          "currency"
        ],
        "title": "CancelPreviewResponse",
        "type": "object"
      },
      "CancelSubscriptionRequest": {
        "properties": {
          "reason": {
            "anyOf": [
              {
                "enum": [
                  "too_expensive",
                  "missing_feature",
                  "switching_competitor",
                  "no_longer_needed",
                  "other"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason"
          },
          "reason_text": {
            "anyOf": [
              {
                "maxLength": 500,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason Text"
          },
          "waive_pending_charges": {
            "default": false,
            "title": "Waive Pending Charges",
            "type": "boolean"
          }
        },
        "title": "CancelSubscriptionRequest",
        "type": "object"
      },
      "CancelSubscriptionResponse": {
        "properties": {
          "cancel_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cancel At"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "waived_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Waived Count"
          },
          "waived_total": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Waived Total"
          }
        },
        "required": [
          "status",
          "cancel_at"
        ],
        "title": "CancelSubscriptionResponse",
        "type": "object"
      },
      "ChangePasswordBody": {
        "properties": {
          "new_password": {
            "title": "New Password",
            "type": "string"
          },
          "old_password": {
            "title": "Old Password",
            "type": "string"
          }
        },
        "required": [
          "old_password",
          "new_password"
        ],
        "title": "ChangePasswordBody",
        "type": "object"
      },
      "ChangePlanPreviewResponse": {
        "properties": {
          "coupon_applies_to_target": {
            "default": true,
            "title": "Coupon Applies To Target",
            "type": "boolean"
          },
          "coupon_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Coupon Id"
          },
          "coupon_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Coupon Name"
          },
          "currency": {
            "title": "Currency",
            "type": "string"
          },
          "next_invoice_amount": {
            "title": "Next Invoice Amount",
            "type": "integer"
          },
          "next_invoice_date": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Invoice Date"
          },
          "next_invoice_proration": {
            "title": "Next Invoice Proration",
            "type": "integer"
          },
          "next_invoice_recurring": {
            "title": "Next Invoice Recurring",
            "type": "integer"
          },
          "promotion_code_applied": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Promotion Code Applied"
          },
          "prorated_today": {
            "title": "Prorated Today",
            "type": "integer"
          },
          "target_plan": {
            "title": "Target Plan",
            "type": "string"
          },
          "warnings": {
            "items": {
              "$ref": "#/components/schemas/ChangePlanPreviewWarning"
            },
            "title": "Warnings",
            "type": "array"
          }
        },
        "required": [
          "target_plan",
          "prorated_today",
          "next_invoice_recurring",
          "next_invoice_proration",
          "next_invoice_amount",
          "next_invoice_date",
          "currency",
          "promotion_code_applied",
          "warnings"
        ],
        "title": "ChangePlanPreviewResponse",
        "type": "object"
      },
      "ChangePlanPreviewWarning": {
        "properties": {
          "current_count": {
            "title": "Current Count",
            "type": "integer"
          },
          "new_limit": {
            "title": "New Limit",
            "type": "integer"
          },
          "overflow": {
            "title": "Overflow",
            "type": "integer"
          },
          "type": {
            "enum": [
              "org_disconnect_required",
              "member_eviction_required",
              "revoke_invitations_required"
            ],
            "title": "Type",
            "type": "string"
          }
        },
        "required": [
          "type",
          "overflow",
          "new_limit",
          "current_count"
        ],
        "title": "ChangePlanPreviewWarning",
        "type": "object"
      },
      "ChangePlanRequest": {
        "properties": {
          "member_ids_to_evict": {
            "anyOf": [
              {
                "items": {
                  "format": "uuid",
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Member Ids To Evict"
          },
          "plan": {
            "enum": [
              "pro",
              "business"
            ],
            "title": "Plan",
            "type": "string"
          },
          "promotion_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Promotion Code"
          }
        },
        "required": [
          "plan"
        ],
        "title": "ChangePlanRequest",
        "type": "object"
      },
      "ChangePlanResponse": {
        "properties": {
          "plan": {
            "title": "Plan",
            "type": "string"
          }
        },
        "required": [
          "plan"
        ],
        "title": "ChangePlanResponse",
        "type": "object"
      },
      "CheckoutResponse": {
        "properties": {
          "checkout_url": {
            "title": "Checkout Url",
            "type": "string"
          }
        },
        "required": [
          "checkout_url"
        ],
        "title": "CheckoutResponse",
        "type": "object"
      },
      "ConnectedOrgCreate": {
        "description": "Request body for registering a new connected org.\n\nTwo mutually exclusive auth modes:\n  PAT mode   \u2014 provide url + access_token (power users, self-hosted)\n  OAuth mode \u2014 provide oauth_org_login (uses the user's linked identity token)",
        "properties": {
          "access_token": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Access Token"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "oauth_org_login": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Oauth Org Login"
          },
          "platform": {
            "default": "gitlab",
            "title": "Platform",
            "type": "string"
          },
          "url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Url"
          }
        },
        "required": [
          "name"
        ],
        "title": "ConnectedOrgCreate",
        "type": "object"
      },
      "ConnectedOrgResponse": {
        "description": "Response schema for a connected org (list/get endpoints).",
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "heuristic_patterns": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Heuristic Patterns"
          },
          "id": {
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "initial_scan_id": {
            "anyOf": [
              {
                "format": "uuid",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Initial Scan Id"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "platform": {
            "title": "Platform",
            "type": "string"
          },
          "platform_id": {
            "title": "Platform Id",
            "type": "string"
          },
          "scheduled_rescans_paused_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Scheduled Rescans Paused At"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "url": {
            "title": "Url",
            "type": "string"
          },
          "workspace_id": {
            "format": "uuid",
            "title": "Workspace Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "workspace_id",
          "platform",
          "platform_id",
          "name",
          "url",
          "created_at",
          "updated_at"
        ],
        "title": "ConnectedOrgResponse",
        "type": "object"
      },
      "ConnectedOrgUpdate": {
        "description": "Request body for PUT /connected-orgs/{id}.\n\nAll fields are optional \u2014 only fields explicitly set are applied.\n`platform`, `platform_id`, and `url` are immutable (data-lineage identity);\nto change them, disconnect and register a new org.\n\n`access_token` rotates the stored PAT. It is rejected for OAuth-registered\norgs (see handler) to keep the org\u2194identity invariant intact. Validated\nagainst the org's existing platform via `_validate_pat_format`.",
        "properties": {
          "access_token": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Access Token"
          },
          "heuristic_patterns": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Heuristic Patterns"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          }
        },
        "title": "ConnectedOrgUpdate",
        "type": "object"
      },
      "ContributorEntry": {
        "description": "One human contributor's commit rollup for a repo+scan.\n\nBots are filtered out upstream; ``is_bot`` is always ``False`` here and\nis retained for shape stability so a future iteration can expose bot\ncontributors without a breaking response shape.",
        "properties": {
          "commit_count": {
            "title": "Commit Count",
            "type": "integer"
          },
          "is_bot": {
            "default": false,
            "title": "Is Bot",
            "type": "boolean"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "share": {
            "title": "Share",
            "type": "number"
          }
        },
        "required": [
          "name",
          "commit_count",
          "share"
        ],
        "title": "ContributorEntry",
        "type": "object"
      },
      "CreateApiKeyBody": {
        "properties": {
          "name": {
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "name"
        ],
        "title": "CreateApiKeyBody",
        "type": "object"
      },
      "CreateInvitationBody": {
        "properties": {
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Email"
          },
          "expires_in_days": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expires In Days"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "max_uses": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Uses"
          },
          "role": {
            "default": "member",
            "title": "Role",
            "type": "string"
          }
        },
        "required": [
          "kind"
        ],
        "title": "CreateInvitationBody",
        "type": "object"
      },
      "CreateWorkspaceBody": {
        "properties": {
          "name": {
            "title": "Name",
            "type": "string"
          },
          "slug": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Slug"
          }
        },
        "required": [
          "name"
        ],
        "title": "CreateWorkspaceBody",
        "type": "object"
      },
      "CreateWorkspaceWithCheckoutBody": {
        "properties": {
          "name": {
            "title": "Name",
            "type": "string"
          },
          "plan": {
            "title": "Plan",
            "type": "string"
          },
          "slug": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Slug"
          }
        },
        "required": [
          "name",
          "plan"
        ],
        "title": "CreateWorkspaceWithCheckoutBody",
        "type": "object"
      },
      "CreateWorkspaceWithCheckoutResponse": {
        "properties": {
          "checkout_url": {
            "title": "Checkout Url",
            "type": "string"
          },
          "workspace_id": {
            "title": "Workspace Id",
            "type": "string"
          }
        },
        "required": [
          "workspace_id",
          "checkout_url"
        ],
        "title": "CreateWorkspaceWithCheckoutResponse",
        "type": "object"
      },
      "DeclarationOutcomes": {
        "description": "What became of every dependency declaration parsed from the org (issue #264).\n\nFive mutually exclusive buckets over the same population as\n``total_declarations`` \u2014 manifest-context declarations, scoped per repo to its\n``current_scan_id``. **They sum to ``total_declarations``.**\n\nReplaces ``health.unresolved_declarations``, which counted every unresolved\ndeclaration regardless of why, named the result as if it were a failure count,\nand \u2014 because it was computed over all reference contexts while\n``total_declarations`` is manifest-only \u2014 could exceed the total it was shown\nagainst (cloudposse: 13,225 unresolved against 6,374 total).\n\nOnly ``unresolved_in_org`` means \"Riftmap may have missed something\". The other\nthree non-resolved buckets are correct rejections: a third-party package is\nsupposed to stay unresolved, a ``workspace:`` dependency lives in the same repo\nby definition, and a repo importing its own subpackage is not a cross-repo edge.\nMeasured across all 321,445 production declarations on 2026-09-12: 86.13%\n``external``, 4.73% ``resolved_in_org``, 4.46% ``local_reference``, 3.86%\n``self_reference``, **0.81% ``unresolved_in_org``**. Those are *platform*\nshares \u2014 a single org can sit far from them, so do not read the platform\nfigure as a per-org expectation. They predate v1.25.0, which counts every\nrepeated declaration of a reference (a second ``uses:`` of one action in a\nworkflow, a package listed as both a dev and a peer dependency), so every\nbucket rises for an org once it is rescanned.\n\n``resolved_in_org`` is normally **larger** than ``total_dependencies``, and that\nis not a bug: it counts declarations, while ``total_dependencies`` counts deduped\ngraph edges. A declaration is not an edge \u2014 read-time ``DISTINCT ON`` collapses\ndeclarations that share a ``(source, target, dependency_type)`` key, self-edges\nare excluded from the graph, and an artifact target with no producing repo\nrenders no edge.\n\nClassification is owned by ``src/graph/declaration_outcomes.py`` \u2014 the single\nsource of truth, which also documents what these buckets structurally cannot\nsee (a fork-alias rejection lands in ``external``).",
        "properties": {
          "external": {
            "description": "Unresolved and the reference does not name anything in this org \u2014 third-party packages, base images and actions. Correctly not in your graph. Note this means 'does not name your namespace', not 'you do not depend on it'.",
            "title": "External",
            "type": "integer"
          },
          "local_reference": {
            "description": "Unresolved because the version constraint denotes a local/intra-repo protocol (pnpm/yarn 'workspace:', 'catalog:', 'link:', 'file:', 'portal:'). Intra-repo by definition and must never mint a cross-repo edge. A correct rejection.",
            "title": "Local Reference",
            "type": "integer"
          },
          "resolved_in_org": {
            "description": "Resolved to a target inside this org \u2014 these are what the graph is built from.",
            "title": "Resolved In Org",
            "type": "integer"
          },
          "self_reference": {
            "description": "Unresolved and the reference names the declaring repository itself \u2014 a monorepo importing its own subpackage, or an image tagged from its own repo. A correct rejection.",
            "title": "Self Reference",
            "type": "integer"
          },
          "unresolved_in_org": {
            "description": "Unresolved, and the reference names this org's own namespace. THE ONLY BUCKET THAT MEANS RIFTMAP MAY HAVE MISSED AN EDGE \u2014 everything else here is expected behaviour. 0.81% of all production declarations, but that is a platform-wide share and not a per-org expectation: a single org can be far higher, usually because one repeated reference shape does not parse.",
            "title": "Unresolved In Org",
            "type": "integer"
          }
        },
        "required": [
          "resolved_in_org",
          "local_reference",
          "self_reference",
          "unresolved_in_org",
          "external"
        ],
        "title": "DeclarationOutcomes",
        "type": "object"
      },
      "DeleteAccountBody": {
        "properties": {
          "password": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Password"
          }
        },
        "title": "DeleteAccountBody",
        "type": "object"
      },
      "DependencyInfo": {
        "description": "A single dependency declaration from a repo's latest scan.",
        "properties": {
          "confidence": {
            "title": "Confidence",
            "type": "number"
          },
          "dependency_relationship": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Dependency Relationship"
          },
          "dependency_type": {
            "title": "Dependency Type",
            "type": "string"
          },
          "id": {
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "raw_reference": {
            "title": "Raw Reference",
            "type": "string"
          },
          "resolved": {
            "title": "Resolved",
            "type": "boolean"
          },
          "source_file": {
            "title": "Source File",
            "type": "string"
          },
          "source_line": {
            "title": "Source Line",
            "type": "integer"
          },
          "target_artifact_id": {
            "anyOf": [
              {
                "format": "uuid",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Artifact Id"
          },
          "target_repository_id": {
            "anyOf": [
              {
                "format": "uuid",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Repository Id"
          },
          "target_repository_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Repository Name"
          },
          "version_constraint": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Version Constraint"
          },
          "version_constraint_state": {
            "default": "absent",
            "title": "Version Constraint State",
            "type": "string"
          }
        },
        "required": [
          "id",
          "dependency_type",
          "raw_reference",
          "version_constraint",
          "source_file",
          "source_line",
          "resolved",
          "confidence"
        ],
        "title": "DependencyInfo",
        "type": "object"
      },
      "EmailVerifyBody": {
        "properties": {
          "token": {
            "title": "Token",
            "type": "string"
          }
        },
        "required": [
          "token"
        ],
        "title": "EmailVerifyBody",
        "type": "object"
      },
      "GraphEdge": {
        "description": "A directed dependency edge between two repos.",
        "properties": {
          "confidence": {
            "title": "Confidence",
            "type": "number"
          },
          "dependency_type": {
            "title": "Dependency Type",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "source": {
            "title": "Source",
            "type": "string"
          },
          "target": {
            "title": "Target",
            "type": "string"
          },
          "version_constraint": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Version Constraint"
          }
        },
        "required": [
          "id",
          "source",
          "target",
          "dependency_type",
          "version_constraint",
          "confidence"
        ],
        "title": "GraphEdge",
        "type": "object"
      },
      "GraphNode": {
        "description": "A repository node in the dependency graph.",
        "properties": {
          "id": {
            "title": "Id",
            "type": "string"
          },
          "label": {
            "title": "Label",
            "type": "string"
          },
          "metadata": {
            "additionalProperties": true,
            "default": {},
            "title": "Metadata",
            "type": "object"
          },
          "type": {
            "default": "repository",
            "title": "Type",
            "type": "string"
          }
        },
        "required": [
          "id",
          "label"
        ],
        "title": "GraphNode",
        "type": "object"
      },
      "GraphResponse": {
        "description": "Full dependency graph for an organization (G6 compatible).",
        "properties": {
          "applied_min_confidence": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "The confidence floor used for the subgraph traversal, or `null` when `root` was omitted. `null` is the honest answer for the full-org graph, which applies no floor at all and returns every `manifest` edge for clients to filter themselves \u2014 so a number here would misreport it.",
            "title": "Applied Min Confidence"
          },
          "edges": {
            "items": {
              "$ref": "#/components/schemas/GraphEdge"
            },
            "title": "Edges",
            "type": "array"
          },
          "nodes": {
            "items": {
              "$ref": "#/components/schemas/GraphNode"
            },
            "title": "Nodes",
            "type": "array"
          }
        },
        "required": [
          "nodes",
          "edges"
        ],
        "title": "GraphResponse",
        "type": "object"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "title": "Detail",
            "type": "array"
          }
        },
        "title": "HTTPValidationError",
        "type": "object"
      },
      "ImpactResponse": {
        "description": "Full downstream impact of changing a repository.",
        "properties": {
          "affected_repositories": {
            "items": {
              "$ref": "#/components/schemas/AffectedRepository"
            },
            "title": "Affected Repositories",
            "type": "array"
          },
          "applied_min_confidence": {
            "description": "The confidence floor actually used for this traversal, whether it came from the `min_confidence` query parameter or the server default. Echoed so a caller can tell a filtered answer from a complete one.",
            "title": "Applied Min Confidence",
            "type": "number"
          },
          "excluded_by_confidence": {
            "description": "Repositories that depend on the source repo only through edges below `applied_min_confidence`, and so are absent from `affected_repositories`. Added to `total_affected` this is the unfiltered blast radius; pass a lower `min_confidence` to see them.",
            "title": "Excluded By Confidence",
            "type": "integer"
          },
          "max_depth_reached": {
            "title": "Max Depth Reached",
            "type": "integer"
          },
          "source_repository": {
            "additionalProperties": true,
            "title": "Source Repository",
            "type": "object"
          },
          "total_affected": {
            "title": "Total Affected",
            "type": "integer"
          }
        },
        "required": [
          "source_repository",
          "affected_repositories",
          "total_affected",
          "max_depth_reached",
          "applied_min_confidence",
          "excluded_by_confidence"
        ],
        "title": "ImpactResponse",
        "type": "object"
      },
      "InvitationPreviewResponse": {
        "properties": {
          "email_hint": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Email Hint"
          },
          "inviter_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Inviter Name"
          },
          "role": {
            "title": "Role",
            "type": "string"
          },
          "workspace_name": {
            "title": "Workspace Name",
            "type": "string"
          }
        },
        "required": [
          "workspace_name",
          "inviter_name",
          "role"
        ],
        "title": "InvitationPreviewResponse",
        "type": "object"
      },
      "InvitationResponse": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Email"
          },
          "expires_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expires At"
          },
          "id": {
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "max_uses": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Uses"
          },
          "role": {
            "title": "Role",
            "type": "string"
          },
          "token": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Token"
          },
          "use_count": {
            "title": "Use Count",
            "type": "integer"
          },
          "workspace_id": {
            "format": "uuid",
            "title": "Workspace Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "workspace_id",
          "email",
          "role",
          "kind",
          "use_count",
          "max_uses",
          "expires_at",
          "created_at"
        ],
        "title": "InvitationResponse",
        "type": "object"
      },
      "InvoiceInfo": {
        "properties": {
          "amount_paid": {
            "title": "Amount Paid",
            "type": "integer"
          },
          "currency": {
            "title": "Currency",
            "type": "string"
          },
          "date": {
            "format": "date-time",
            "title": "Date",
            "type": "string"
          },
          "hosted_invoice_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hosted Invoice Url"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "invoice_pdf": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Invoice Pdf"
          },
          "status": {
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "id",
          "date",
          "amount_paid",
          "currency",
          "status",
          "hosted_invoice_url",
          "invoice_pdf"
        ],
        "title": "InvoiceInfo",
        "type": "object"
      },
      "LastScanSummary": {
        "description": "Summary of the most recent scan.",
        "properties": {
          "completed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Completed At"
          },
          "errors": {
            "title": "Errors",
            "type": "integer"
          },
          "id": {
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "repos_scanned": {
            "title": "Repos Scanned",
            "type": "integer"
          },
          "status": {
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "id",
          "status",
          "completed_at",
          "repos_scanned",
          "errors"
        ],
        "title": "LastScanSummary",
        "type": "object"
      },
      "LoginBody": {
        "properties": {
          "email": {
            "format": "email",
            "title": "Email",
            "type": "string"
          },
          "password": {
            "title": "Password",
            "type": "string"
          }
        },
        "required": [
          "email",
          "password"
        ],
        "title": "LoginBody",
        "type": "object"
      },
      "MeResponse": {
        "properties": {
          "avatar_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Avatar Url"
          },
          "current_tos_version": {
            "default": "2026-06-01",
            "title": "Current Tos Version",
            "type": "string"
          },
          "current_workspace_id": {
            "anyOf": [
              {
                "format": "uuid",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Current Workspace Id"
          },
          "deletion_scheduled_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Deletion Scheduled At"
          },
          "email": {
            "title": "Email",
            "type": "string"
          },
          "email_verified": {
            "default": false,
            "title": "Email Verified",
            "type": "boolean"
          },
          "full_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Full Name"
          },
          "has_password": {
            "default": false,
            "title": "Has Password",
            "type": "boolean"
          },
          "id": {
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "last_login_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Login At"
          },
          "linked_providers": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Linked Providers",
            "type": "array"
          },
          "onboarding_completed": {
            "default": false,
            "title": "Onboarding Completed",
            "type": "boolean"
          },
          "role": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Role"
          },
          "tos_accepted_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tos Accepted At"
          },
          "tos_enforcement_date": {
            "default": "2026-06-15",
            "title": "Tos Enforcement Date",
            "type": "string"
          },
          "tos_version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tos Version"
          },
          "workspaces": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Workspaces",
            "type": "array"
          }
        },
        "required": [
          "id",
          "email",
          "full_name",
          "avatar_url",
          "last_login_at",
          "workspaces",
          "current_workspace_id",
          "role"
        ],
        "title": "MeResponse",
        "type": "object"
      },
      "MemberResponse": {
        "properties": {
          "avatar_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Avatar Url"
          },
          "email": {
            "title": "Email",
            "type": "string"
          },
          "full_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Full Name"
          },
          "joined_at": {
            "format": "date-time",
            "title": "Joined At",
            "type": "string"
          },
          "role": {
            "title": "Role",
            "type": "string"
          },
          "user_id": {
            "format": "uuid",
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "user_id",
          "email",
          "full_name",
          "avatar_url",
          "role",
          "joined_at"
        ],
        "title": "MemberResponse",
        "type": "object"
      },
      "OAuthOrgInfo": {
        "description": "A GitHub org or GitLab group accessible via the user's linked OAuth identity.",
        "properties": {
          "avatar_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Avatar Url"
          },
          "kind": {
            "default": "org",
            "enum": [
              "personal",
              "org",
              "group"
            ],
            "title": "Kind",
            "type": "string"
          },
          "login": {
            "title": "Login",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "scannable": {
            "default": false,
            "title": "Scannable",
            "type": "boolean"
          },
          "url": {
            "title": "Url",
            "type": "string"
          }
        },
        "required": [
          "login",
          "name",
          "url"
        ],
        "title": "OAuthOrgInfo",
        "type": "object"
      },
      "OrgStats": {
        "description": "Per-connected-org stats payload (scoped to one connected org).\n\nArtifact-count semantics. Every count is a raw artifact-row count \u2014 no\ncanonical-name dedup \u2014 **restricted to first-party artifacts**: rows a forked\nrepo produces only because it kept the upstream project's package identity are\nexcluded and counted separately (issue #258; ``is_first_party_artifact`` in\n``src/resolver/fork_alias.py`` is the single source of truth, cached on\n``artifacts.is_first_party``). Consumption is computed by the single source of\ntruth ``src/graph/artifact_stats.py`` (the type-matched union), so an\nartifact's orphan status here always matches its ``is_orphan`` on\n``GET /connected-orgs/{id}/artifacts``:\n\n  - ``total_artifact_rows`` \u2014 first-party artifact rows. Equals the\n    ``X-Total-Count`` header of ``GET /connected-orgs/{id}/artifacts`` with its\n    default ``include_upstream_aliases=false``.\n  - ``upstream_alias_artifact_count`` \u2014 the rows that filter excludes. Add it\n    to ``total_artifact_rows`` for every row the org has, which is what\n    ``?include_upstream_aliases=true`` returns and what a disconnect deletes.\n  - ``orphan_artifact_count`` \u2014 first-party rows with **zero** consumers\n    (``consumer_count == 0``). Equals the count of ``is_orphan==true`` rows on\n    the artifacts endpoint and the Artifacts page \"Hide orphans (N)\" toggle.\n  - ``consumed_artifact_count`` \u2014 first-party rows with **at least one**\n    consumer (``== total_artifact_rows - orphan_artifact_count``).\n  - ``artifact_type_breakdown`` \u2014 **first-party** artifact rows grouped by\n    ``artifact_type`` (includes every type present; never drops one).\n    Invariant: ``sum(artifact_type_breakdown.values()) == total_artifact_rows``.\n\n``total_declarations`` vs ``total_dependencies``: the former counts every\nmanifest-context dependency *declaration* parsed out of the org's repos, the\nlatter counts the deduped cross-repo *edges* those declarations resolved to.\nThe gap between them is the org's coverage story \u2014 Patrimore parsed 4,390 and\ngot 9 edges \u2014 and naming both numbers is what lets a near-empty graph explain\nitself instead of reading as a broken product (issue #225).\n\n``declaration_outcomes`` breaks that gap down: it partitions the same\n``total_declarations`` population into why each declaration did or did not\nbecome an edge, so a large gap can be read as the ~99% correct rejections it\nusually is rather than as a failure count (issue #264). It replaced\n``health``, whose ``unresolved_declarations`` was that misreadable number and\nwhose other two fields were hardcoded zeros; the real on-latest / lagging\nfigures live on ``GET /artifacts/{id}/consumers``.",
        "properties": {
          "artifact_type_breakdown": {
            "additionalProperties": {
              "type": "integer"
            },
            "title": "Artifact Type Breakdown",
            "type": "object"
          },
          "consumed_artifact_count": {
            "title": "Consumed Artifact Count",
            "type": "integer"
          },
          "declaration_outcomes": {
            "$ref": "#/components/schemas/DeclarationOutcomes"
          },
          "dependency_type_breakdown": {
            "additionalProperties": {
              "type": "integer"
            },
            "title": "Dependency Type Breakdown",
            "type": "object"
          },
          "last_scan": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LastScanSummary"
              },
              {
                "type": "null"
              }
            ]
          },
          "orphan_artifact_count": {
            "title": "Orphan Artifact Count",
            "type": "integer"
          },
          "total_artifact_rows": {
            "title": "Total Artifact Rows",
            "type": "integer"
          },
          "total_declarations": {
            "title": "Total Declarations",
            "type": "integer"
          },
          "total_dependencies": {
            "title": "Total Dependencies",
            "type": "integer"
          },
          "total_repositories": {
            "title": "Total Repositories",
            "type": "integer"
          },
          "upstream_alias_artifact_count": {
            "default": 0,
            "title": "Upstream Alias Artifact Count",
            "type": "integer"
          }
        },
        "required": [
          "total_repositories",
          "total_declarations",
          "total_dependencies",
          "consumed_artifact_count",
          "orphan_artifact_count",
          "total_artifact_rows",
          "dependency_type_breakdown",
          "artifact_type_breakdown",
          "last_scan",
          "declaration_outcomes"
        ],
        "title": "OrgStats",
        "type": "object"
      },
      "OwnershipContextBlock": {
        "description": "Slim ownership summary embedded in ``/repositories/{id}/context``.\n\nTiny by design (spec \u00a78) \u2014 the context bundle is capped. Agents call\n``/repositories/{id}/ownership`` for the full contributor list.",
        "properties": {
          "bus_factor": {
            "title": "Bus Factor",
            "type": "integer"
          },
          "human_author_count": {
            "title": "Human Author Count",
            "type": "integer"
          },
          "top_author_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Top Author Name"
          }
        },
        "required": [
          "bus_factor",
          "top_author_name",
          "human_author_count"
        ],
        "title": "OwnershipContextBlock",
        "type": "object"
      },
      "OwnershipRiskItem": {
        "description": "One row of the findings feed (spec \u00a78).\n\n``is_concentration_risk`` is the stored flag from scan finalisation (fan-in\n>= org P75 with min floor 5 AND ``0 < bus_factor <= bus_factor_ceiling``).\nDefault-mode rows always have it ``True``; override-mode rows surface the\nlive value so callers can show every signal row with the flag inline (the\nfrontend overlay reads this to colour and emphasise nodes from one fetch).",
        "properties": {
          "bus_factor": {
            "title": "Bus Factor",
            "type": "integer"
          },
          "computed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Computed At"
          },
          "dependents_count": {
            "title": "Dependents Count",
            "type": "integer"
          },
          "human_author_count": {
            "title": "Human Author Count",
            "type": "integer"
          },
          "is_concentration_risk": {
            "title": "Is Concentration Risk",
            "type": "boolean"
          },
          "repository_full_path": {
            "title": "Repository Full Path",
            "type": "string"
          },
          "repository_id": {
            "format": "uuid",
            "title": "Repository Id",
            "type": "string"
          },
          "repository_name": {
            "title": "Repository Name",
            "type": "string"
          },
          "risk_score": {
            "title": "Risk Score",
            "type": "number"
          },
          "top_author": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TopAuthor"
              },
              {
                "type": "null"
              }
            ]
          },
          "top_author_share": {
            "title": "Top Author Share",
            "type": "number"
          },
          "window": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/OwnershipWindow"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "repository_id",
          "repository_name",
          "repository_full_path",
          "bus_factor",
          "top_author_share",
          "human_author_count",
          "dependents_count",
          "risk_score",
          "is_concentration_risk"
        ],
        "title": "OwnershipRiskItem",
        "type": "object"
      },
      "OwnershipWindow": {
        "description": "The trailing window the signal was computed over.",
        "properties": {
          "end": {
            "format": "date-time",
            "title": "End",
            "type": "string"
          },
          "start": {
            "format": "date-time",
            "title": "Start",
            "type": "string"
          }
        },
        "required": [
          "start",
          "end"
        ],
        "title": "OwnershipWindow",
        "type": "object"
      },
      "PasswordResetConfirmBody": {
        "properties": {
          "new_password": {
            "title": "New Password",
            "type": "string"
          },
          "token": {
            "title": "Token",
            "type": "string"
          }
        },
        "required": [
          "token",
          "new_password"
        ],
        "title": "PasswordResetConfirmBody",
        "type": "object"
      },
      "PasswordResetRequestBody": {
        "properties": {
          "email": {
            "format": "email",
            "title": "Email",
            "type": "string"
          }
        },
        "required": [
          "email"
        ],
        "title": "PasswordResetRequestBody",
        "type": "object"
      },
      "PaymentInfoResponse": {
        "properties": {
          "invoices": {
            "items": {
              "$ref": "#/components/schemas/InvoiceInfo"
            },
            "title": "Invoices",
            "type": "array"
          },
          "payment_method": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PaymentMethodInfo"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "payment_method",
          "invoices"
        ],
        "title": "PaymentInfoResponse",
        "type": "object"
      },
      "PaymentMethodInfo": {
        "properties": {
          "brand": {
            "title": "Brand",
            "type": "string"
          },
          "exp_month": {
            "title": "Exp Month",
            "type": "integer"
          },
          "exp_year": {
            "title": "Exp Year",
            "type": "integer"
          },
          "last4": {
            "title": "Last4",
            "type": "string"
          }
        },
        "required": [
          "brand",
          "last4",
          "exp_month",
          "exp_year"
        ],
        "title": "PaymentMethodInfo",
        "type": "object"
      },
      "PendingInvoiceItem": {
        "description": "A queued (uninvoiced) Stripe invoice item \u2014 typically a proration.",
        "properties": {
          "amount": {
            "title": "Amount",
            "type": "integer"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "period_end": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Period End"
          },
          "period_start": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Period Start"
          }
        },
        "required": [
          "id",
          "description",
          "amount",
          "period_start",
          "period_end"
        ],
        "title": "PendingInvoiceItem",
        "type": "object"
      },
      "PlanCatalogResponse": {
        "properties": {
          "plans": {
            "items": {
              "$ref": "#/components/schemas/PlanPriceInfo"
            },
            "title": "Plans",
            "type": "array"
          },
          "stripe_enabled": {
            "title": "Stripe Enabled",
            "type": "boolean"
          }
        },
        "required": [
          "stripe_enabled",
          "plans"
        ],
        "title": "PlanCatalogResponse",
        "type": "object"
      },
      "PlanFeatureFlags": {
        "description": "The canonical paid-feature flags, named explicitly.\n\nSpelled out rather than typed ``dict[str, bool]`` because the published schema\nis the contract AI agents and CI pipelines read (see CLAUDE.md); an open\n``additionalProperties: boolean`` map tells a reader nothing about which keys\nexist. Kept in lockstep with ``CANONICAL_FEATURE_KEYS`` by a test \u2014 a key added\non one side and not the other would otherwise read as a silent ``false``.",
        "properties": {
          "api_production": {
            "title": "Api Production",
            "type": "boolean"
          },
          "artifact_dashboard": {
            "title": "Artifact Dashboard",
            "type": "boolean"
          },
          "continuous_scans": {
            "title": "Continuous Scans",
            "type": "boolean"
          },
          "multi_org": {
            "title": "Multi Org",
            "type": "boolean"
          },
          "scheduled_scans": {
            "title": "Scheduled Scans",
            "type": "boolean"
          }
        },
        "required": [
          "scheduled_scans",
          "continuous_scans",
          "api_production",
          "artifact_dashboard",
          "multi_org"
        ],
        "title": "PlanFeatureFlags",
        "type": "object"
      },
      "PlanPriceInfo": {
        "properties": {
          "base_price_amount": {
            "default": 0,
            "title": "Base Price Amount",
            "type": "integer"
          },
          "base_price_currency": {
            "default": "usd",
            "title": "Base Price Currency",
            "type": "string"
          },
          "base_price_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Base Price Id"
          },
          "features": {
            "default": "",
            "title": "Features",
            "type": "string"
          },
          "included_seats": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Included Seats"
          },
          "max_org_connections": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Org Connections"
          },
          "max_repos": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Repos"
          },
          "plan_key": {
            "title": "Plan Key",
            "type": "string"
          },
          "seat_addon_amount": {
            "default": 0,
            "title": "Seat Addon Amount",
            "type": "integer"
          },
          "seat_addon_currency": {
            "default": "usd",
            "title": "Seat Addon Currency",
            "type": "string"
          },
          "seat_addon_price_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Seat Addon Price Id"
          }
        },
        "required": [
          "plan_key"
        ],
        "title": "PlanPriceInfo",
        "type": "object"
      },
      "PortalResponse": {
        "properties": {
          "portal_url": {
            "title": "Portal Url",
            "type": "string"
          }
        },
        "required": [
          "portal_url"
        ],
        "title": "PortalResponse",
        "type": "object"
      },
      "ProvidersResponse": {
        "properties": {
          "providers": {
            "items": {
              "type": "string"
            },
            "title": "Providers",
            "type": "array"
          }
        },
        "required": [
          "providers"
        ],
        "title": "ProvidersResponse",
        "type": "object"
      },
      "RegisterBody": {
        "properties": {
          "attribution": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SignupAttribution"
              },
              {
                "type": "null"
              }
            ]
          },
          "email": {
            "format": "email",
            "title": "Email",
            "type": "string"
          },
          "full_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Full Name"
          },
          "invitation_token": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Invitation Token"
          },
          "password": {
            "title": "Password",
            "type": "string"
          },
          "tos_accepted": {
            "title": "Tos Accepted",
            "type": "boolean"
          },
          "workspace_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Workspace Name"
          }
        },
        "required": [
          "email",
          "password",
          "tos_accepted"
        ],
        "title": "RegisterBody",
        "type": "object"
      },
      "RemoveSeatsRequest": {
        "properties": {
          "member_ids_to_evict": {
            "anyOf": [
              {
                "items": {
                  "format": "uuid",
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Member Ids To Evict"
          },
          "seats_to_remove": {
            "title": "Seats To Remove",
            "type": "integer"
          }
        },
        "required": [
          "seats_to_remove"
        ],
        "title": "RemoveSeatsRequest",
        "type": "object"
      },
      "RemoveSeatsResponse": {
        "properties": {
          "extra_seats": {
            "title": "Extra Seats",
            "type": "integer"
          },
          "seat_limit": {
            "title": "Seat Limit",
            "type": "integer"
          }
        },
        "required": [
          "extra_seats",
          "seat_limit"
        ],
        "title": "RemoveSeatsResponse",
        "type": "object"
      },
      "RepositoryContextArtifact": {
        "description": "Slim artifact summary embedded in the repo context bundle.",
        "properties": {
          "artifact_type": {
            "title": "Artifact Type",
            "type": "string"
          },
          "id": {
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "is_first_party": {
            "default": true,
            "title": "Is First Party",
            "type": "boolean"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Version"
          }
        },
        "required": [
          "id",
          "artifact_type",
          "name",
          "version"
        ],
        "title": "RepositoryContextArtifact",
        "type": "object"
      },
      "RepositoryContextResponse": {
        "description": "Single-call context bundle for AI coding agents.\n\nCombines the repo row (with freshness fields), capped lists of direct\ndependents + dependencies, and the artifacts this repo produces. Both lists\nhold declaration rows: on ``dependents`` the consuming repository is\n``target_repository_id``. For full pagination of dependents/dependencies use\nthe dedicated endpoints; for transitive blast radius use\n``/repositories/{id}/impact``.",
        "properties": {
          "artifacts": {
            "items": {
              "$ref": "#/components/schemas/RepositoryContextArtifact"
            },
            "title": "Artifacts",
            "type": "array"
          },
          "dependencies": {
            "items": {
              "$ref": "#/components/schemas/DependencyInfo"
            },
            "title": "Dependencies",
            "type": "array"
          },
          "dependencies_total": {
            "title": "Dependencies Total",
            "type": "integer"
          },
          "dependent_repositories_total": {
            "default": 0,
            "title": "Dependent Repositories Total",
            "type": "integer"
          },
          "dependents": {
            "items": {
              "$ref": "#/components/schemas/DependencyInfo"
            },
            "title": "Dependents",
            "type": "array"
          },
          "dependents_total": {
            "title": "Dependents Total",
            "type": "integer"
          },
          "ownership": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/OwnershipContextBlock"
              },
              {
                "type": "null"
              }
            ]
          },
          "repository": {
            "$ref": "#/components/schemas/RepositoryResponse"
          }
        },
        "required": [
          "repository",
          "dependencies",
          "dependencies_total",
          "dependents",
          "dependents_total",
          "artifacts"
        ],
        "title": "RepositoryContextResponse",
        "type": "object"
      },
      "RepositoryOwnershipResponse": {
        "description": "Per-repo ownership signal + capped human contributors (spec \u00a78).\n\nReturns the signal computed at the latest completed scan of the repo's\nconnected org. When no signal row exists yet (``OWNERSHIP_SIGNAL_ENABLED``\nis off, or the scan ran before backfill), all numeric fields are 0,\n``top_author``/``window``/``computed_at`` are null, and ``contributors``\nis empty \u2014 endpoints stay callable so agents do not need to special-case\n\"ownership not enabled yet\".",
        "properties": {
          "bus_factor": {
            "title": "Bus Factor",
            "type": "integer"
          },
          "computed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Computed At"
          },
          "contributors": {
            "items": {
              "$ref": "#/components/schemas/ContributorEntry"
            },
            "title": "Contributors",
            "type": "array"
          },
          "contributors_total": {
            "title": "Contributors Total",
            "type": "integer"
          },
          "human_author_count": {
            "title": "Human Author Count",
            "type": "integer"
          },
          "top_author": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TopAuthor"
              },
              {
                "type": "null"
              }
            ]
          },
          "top_author_share": {
            "title": "Top Author Share",
            "type": "number"
          },
          "window": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/OwnershipWindow"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "bus_factor",
          "top_author_share",
          "human_author_count",
          "contributors",
          "contributors_total"
        ],
        "title": "RepositoryOwnershipResponse",
        "type": "object"
      },
      "RepositoryResponse": {
        "description": "Basic repository record.",
        "properties": {
          "archived": {
            "title": "Archived",
            "type": "boolean"
          },
          "clone_url": {
            "title": "Clone Url",
            "type": "string"
          },
          "connected_org_id": {
            "format": "uuid",
            "title": "Connected Org Id",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "default_branch": {
            "title": "Default Branch",
            "type": "string"
          },
          "full_path": {
            "title": "Full Path",
            "type": "string"
          },
          "id": {
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "is_fork": {
            "title": "Is Fork",
            "type": "boolean"
          },
          "last_activity_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Activity At"
          },
          "last_commit_sha": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Commit Sha"
          },
          "last_scanned_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Scanned At"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "platform_id": {
            "title": "Platform Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "connected_org_id",
          "platform_id",
          "name",
          "full_path",
          "clone_url",
          "default_branch",
          "last_scanned_at",
          "last_commit_sha",
          "last_activity_at",
          "archived",
          "is_fork",
          "created_at"
        ],
        "title": "RepositoryResponse",
        "type": "object"
      },
      "ResumeSubscriptionResponse": {
        "properties": {
          "status": {
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "status"
        ],
        "title": "ResumeSubscriptionResponse",
        "type": "object"
      },
      "ScanResponse": {
        "description": "Full scan record.",
        "properties": {
          "completed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Completed At"
          },
          "connected_org_id": {
            "format": "uuid",
            "title": "Connected Org Id",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "errors": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Errors"
          },
          "failed_repos": {
            "description": "Repositories this scan could not process. Non-zero means the dependency\ngraph may be missing edges; the affected repos keep their previous data and\nare retried on the next scan. It is what makes a scan report status\n\"partial\", derived from the same errors dict, so the two cannot disagree \u2014\nbut scans stored before v1.24.4 report \"completed\" with the same\nrepo_errors, so a client should test status == \"partial\" or\nfailed_repos > 0. Excludes the __enrichment__ / __ownership__ org-level\nentries in errors.repo_errors, which are post-scan passes, not repositories.",
            "readOnly": true,
            "title": "Failed Repos",
            "type": "integer"
          },
          "id": {
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "interruption_count": {
            "default": 0,
            "title": "Interruption Count",
            "type": "integer"
          },
          "scan_type": {
            "title": "Scan Type",
            "type": "string"
          },
          "scanned_repos": {
            "title": "Scanned Repos",
            "type": "integer"
          },
          "skipped_repos": {
            "title": "Skipped Repos",
            "type": "integer"
          },
          "started_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Started At"
          },
          "status": {
            "description": "One of pending | running | completed | partial | failed | cancelled. 'partial' is a refinement of 'completed', not a kind of failure: the scan ran the whole loop and its rows are the org's current ones, it just could not process every repository. Only 'pending' and 'running' are in flight, so a poll loop should test those two rather than enumerate the terminal values. Scans stored before v1.24.4 report 'completed' with a non-empty errors.repo_errors and were not backfilled, so the honest test for an incomplete graph is status == 'partial' or failed_repos > 0.",
            "title": "Status",
            "type": "string"
          },
          "total_repos": {
            "title": "Total Repos",
            "type": "integer"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "connected_org_id",
          "status",
          "scan_type",
          "total_repos",
          "scanned_repos",
          "skipped_repos",
          "errors",
          "started_at",
          "completed_at",
          "created_at",
          "updated_at",
          "failed_repos"
        ],
        "title": "ScanResponse",
        "type": "object"
      },
      "ScanTriggerRequest": {
        "description": "Optional request body for POST /organizations/{org_id}/scans.",
        "properties": {
          "scan_type": {
            "default": "incremental",
            "title": "Scan Type",
            "type": "string"
          }
        },
        "title": "ScanTriggerRequest",
        "type": "object"
      },
      "ScanTriggerResponse": {
        "description": "Returned immediately after a scan is queued.",
        "properties": {
          "message": {
            "title": "Message",
            "type": "string"
          },
          "scan_id": {
            "format": "uuid",
            "title": "Scan Id",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "scan_id",
          "status",
          "message"
        ],
        "title": "ScanTriggerResponse",
        "type": "object"
      },
      "SeatChangePreviewResponse": {
        "properties": {
          "currency": {
            "title": "Currency",
            "type": "string"
          },
          "next_invoice_amount": {
            "title": "Next Invoice Amount",
            "type": "integer"
          },
          "next_invoice_date": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Invoice Date"
          },
          "next_invoice_proration": {
            "title": "Next Invoice Proration",
            "type": "integer"
          },
          "next_invoice_recurring": {
            "title": "Next Invoice Recurring",
            "type": "integer"
          },
          "prorated_today": {
            "title": "Prorated Today",
            "type": "integer"
          },
          "seat_delta": {
            "title": "Seat Delta",
            "type": "integer"
          }
        },
        "required": [
          "seat_delta",
          "prorated_today",
          "next_invoice_recurring",
          "next_invoice_proration",
          "next_invoice_amount",
          "next_invoice_date",
          "currency"
        ],
        "title": "SeatChangePreviewResponse",
        "type": "object"
      },
      "SetPasswordBody": {
        "properties": {
          "new_password": {
            "title": "New Password",
            "type": "string"
          }
        },
        "required": [
          "new_password"
        ],
        "title": "SetPasswordBody",
        "type": "object"
      },
      "SetupIntentResponse": {
        "properties": {
          "client_secret": {
            "title": "Client Secret",
            "type": "string"
          },
          "publishable_key": {
            "title": "Publishable Key",
            "type": "string"
          }
        },
        "required": [
          "client_secret",
          "publishable_key"
        ],
        "title": "SetupIntentResponse",
        "type": "object"
      },
      "SignupAttribution": {
        "description": "First-touch acquisition, forwarded by the client from the landing URL.\n\nA strict whitelist \u2014 Pydantic ignores unknown keys by default, so the client\ncan't inject arbitrary person properties via the $set_once below.",
        "properties": {
          "referrer": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Referrer"
          },
          "utm_campaign": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Utm Campaign"
          },
          "utm_content": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Utm Content"
          },
          "utm_medium": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Utm Medium"
          },
          "utm_source": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Utm Source"
          },
          "utm_term": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Utm Term"
          }
        },
        "title": "SignupAttribution",
        "type": "object"
      },
      "TopAuthor": {
        "description": "Name + share of the single top contributor (humans only).",
        "properties": {
          "name": {
            "title": "Name",
            "type": "string"
          },
          "share": {
            "title": "Share",
            "type": "number"
          }
        },
        "required": [
          "name",
          "share"
        ],
        "title": "TopAuthor",
        "type": "object"
      },
      "TransferOwnershipBody": {
        "properties": {
          "new_owner_user_id": {
            "format": "uuid",
            "title": "New Owner User Id",
            "type": "string"
          }
        },
        "required": [
          "new_owner_user_id"
        ],
        "title": "TransferOwnershipBody",
        "type": "object"
      },
      "UpdateMeBody": {
        "properties": {
          "current_password": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Current Password"
          },
          "email": {
            "anyOf": [
              {
                "format": "email",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Email"
          },
          "full_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Full Name"
          },
          "onboarding_completed": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Onboarding Completed"
          }
        },
        "title": "UpdateMeBody",
        "type": "object"
      },
      "UpdateRoleBody": {
        "properties": {
          "role": {
            "title": "Role",
            "type": "string"
          }
        },
        "required": [
          "role"
        ],
        "title": "UpdateRoleBody",
        "type": "object"
      },
      "UsageResource": {
        "description": "(used, limit) pair where limit=None means unlimited.",
        "properties": {
          "limit": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Limit"
          },
          "used": {
            "title": "Used",
            "type": "integer"
          }
        },
        "required": [
          "used",
          "limit"
        ],
        "title": "UsageResource",
        "type": "object"
      },
      "ValidationError": {
        "properties": {
          "ctx": {
            "title": "Context",
            "type": "object"
          },
          "input": {
            "title": "Input"
          },
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "title": "Location",
            "type": "array"
          },
          "msg": {
            "title": "Message",
            "type": "string"
          },
          "type": {
            "title": "Error Type",
            "type": "string"
          }
        },
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError",
        "type": "object"
      },
      "WorkspaceEntitlements": {
        "description": "What the caller's workspace plan allows \u2014 safe for any member to read.",
        "properties": {
          "billing_enforced": {
            "title": "Billing Enforced",
            "type": "boolean"
          },
          "features": {
            "$ref": "#/components/schemas/PlanFeatureFlags"
          },
          "plan": {
            "title": "Plan",
            "type": "string"
          },
          "seat_count": {
            "title": "Seat Count",
            "type": "integer"
          },
          "seat_limit": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Seat Limit"
          }
        },
        "required": [
          "plan",
          "billing_enforced",
          "features",
          "seat_count",
          "seat_limit"
        ],
        "title": "WorkspaceEntitlements",
        "type": "object"
      },
      "WorkspaceResponse": {
        "description": "Response schema for a workspace.",
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "plan": {
            "title": "Plan",
            "type": "string"
          },
          "slug": {
            "title": "Slug",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "slug",
          "plan",
          "created_at",
          "updated_at"
        ],
        "title": "WorkspaceResponse",
        "type": "object"
      },
      "WorkspaceUpdate": {
        "description": "Request body for PUT /workspaces/{id}.",
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "regenerate_slug": {
            "default": false,
            "title": "Regenerate Slug",
            "type": "boolean"
          }
        },
        "title": "WorkspaceUpdate",
        "type": "object"
      }
    },
    "securitySchemes": {
      "APIKeyHeader": {
        "in": "header",
        "name": "X-API-Key",
        "type": "apiKey"
      },
      "HTTPBearer": {
        "description": "API key as Bearer token (rfm_live_... prefix)",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "description": "Change Impact Engine for multi-repo systems",
    "title": "Riftmap",
    "version": "1.25.2"
  },
  "openapi": "3.1.0",
  "paths": {
    "/api/v1/artifacts/{artifact_id}": {
      "get": {
        "description": "Fetch an artifact by ID in the caller's workspace, with consumer_count and is_orphan from the latest scan. Requires the Pro artifact dashboard; 404 if not found.",
        "operationId": "get_artifact_api_v1_artifacts__artifact_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "artifact_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Artifact Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArtifactResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get a single artifact by ID, with consumer count and orphan flag.",
        "tags": [
          "artifacts"
        ]
      }
    },
    "/api/v1/artifacts/{artifact_id}/consumers": {
      "get": {
        "description": "List repositories consuming this artifact from the latest scan, with each pinned version, on-latest vs lagging counts, and a version-state breakdown. Pro feature.",
        "operationId": "get_artifact_consumers_api_v1_artifacts__artifact_id__consumers_get",
        "parameters": [
          {
            "in": "path",
            "name": "artifact_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Artifact Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArtifactConsumersResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List repositories consuming this artifact, with pinned versions.",
        "tags": [
          "artifacts"
        ]
      }
    },
    "/api/v1/artifacts/{artifact_id}/versions": {
      "get": {
        "description": "List every version constraint of this artifact seen across the org in the latest scan, each with its state and consumer count, ordered by popularity. Pro feature.",
        "operationId": "get_artifact_versions_api_v1_artifacts__artifact_id__versions_get",
        "parameters": [
          {
            "in": "path",
            "name": "artifact_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Artifact Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/ArtifactVersionEntry"
                  },
                  "title": "Response Get Artifact Versions Api V1 Artifacts  Artifact Id  Versions Get",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List all versions of this artifact seen across the org, with consumer counts.",
        "tags": [
          "artifacts"
        ]
      }
    },
    "/api/v1/auth/accept-tos": {
      "post": {
        "description": "Record that the current user accepts the current Terms of Service.\n\nCalled when a user accepts an updated ToS via the in-app banner or the /accept-terms\nblocking page. Updates tos_accepted_at and tos_version on the user record.\n\nReturns the accepted version and timestamp so the frontend can update state immediately\nwithout a full /auth/me refetch.",
        "operationId": "accept_tos_api_v1_auth_accept_tos_post",
        "parameters": [
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "title": "Response Accept Tos Api V1 Auth Accept Tos Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Accept Tos",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/auth/account/cancel-deletion": {
      "post": {
        "description": "Cancel a pending account deletion during the 30-day grace period.\n\nRequires re-authentication \u2014 all sessions are revoked when deletion is scheduled,\nso the user must log in again. A valid session JWT is proof of re-authentication.",
        "operationId": "cancel_account_deletion_api_v1_auth_account_cancel_deletion_post",
        "parameters": [
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "title": "Response Cancel Account Deletion Api V1 Auth Account Cancel Deletion Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Cancel Account Deletion",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/auth/account/delete": {
      "post": {
        "description": "Schedule account deletion with a 30-day GDPR grace period.\n\nInstead of immediately hard-deleting, this sets deletion_scheduled_at = now()+30 days,\nrevokes all active sessions (forces re-authentication), and returns 202.\nA Celery Beat task runs daily and performs the actual hard-delete once the grace period\nexpires. Users can cancel by re-authenticating and calling POST /auth/account/cancel-deletion.\n\nCascade behaviour (applied at hard-delete time):\n- Workspaces where user is the sole member are deleted entirely (including Stripe customer).\n- Workspaces where user is the sole owner but has other members \u2192 409 (transfer first).\n- Workspaces where there are other owners \u2192 user's membership removed; workspace survives.",
        "operationId": "delete_account_api_v1_auth_account_delete_post",
        "parameters": [
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeleteAccountBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Delete Account",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/auth/email/verify": {
      "post": {
        "description": "Consume a signed, time-limited email-verification token and mark the account's email as verified. Unauthenticated; returns 400 when the token is invalid or expired.",
        "operationId": "verify_email_api_v1_auth_email_verify_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmailVerifyBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "title": "Response Verify Email Api V1 Auth Email Verify Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Verify Email",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/auth/email/verify/resend": {
      "post": {
        "description": "Resend the email-verification link to the logged-in user's address. Requires session auth; no-ops if already verified, and returns 503 if the mail service is down.",
        "operationId": "resend_verification_email_api_v1_auth_email_verify_resend_post",
        "parameters": [
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "title": "Response Resend Verification Email Api V1 Auth Email Verify Resend Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Resend Verification Email",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/auth/login": {
      "post": {
        "description": "Authenticate a user by email and password, then set httponly access and refresh cookies. Rate-limited per email; returns the current user, workspaces, and role.",
        "operationId": "login_api_v1_auth_login_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LoginBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MeResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Login",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/auth/logout": {
      "post": {
        "description": "Log the current user out by revoking the session tied to the access cookie and clearing the auth cookies. Idempotent and safe to call even without a valid cookie.",
        "operationId": "logout_api_v1_auth_logout_post",
        "parameters": [
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "title": "Response Logout Api V1 Auth Logout Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Logout",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/auth/me": {
      "get": {
        "description": "Return the authenticated user with their workspaces, linked OAuth providers, and role in the active workspace. Requires session auth; rejects API-key auth with 403.",
        "operationId": "get_me_api_v1_auth_me_get",
        "parameters": [
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MeResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Me",
        "tags": [
          "auth"
        ]
      },
      "patch": {
        "description": "Update the current user's full name, email, or onboarding flag. Changing email needs the current password and forces re-verification. Session auth only, no API keys.",
        "operationId": "update_me_api_v1_auth_me_patch",
        "parameters": [
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateMeBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MeResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Update Me",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/auth/oauth/{provider}/callback": {
      "get": {
        "description": "Handle the OAuth provider callback: validate the state, exchange the code for tokens, require a verified email, find or create the user, then set session cookies.",
        "operationId": "oauth_callback_api_v1_auth_oauth__provider__callback_get",
        "parameters": [
          {
            "in": "path",
            "name": "provider",
            "required": true,
            "schema": {
              "title": "Provider",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "code",
            "required": true,
            "schema": {
              "title": "Code",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "state",
            "required": true,
            "schema": {
              "title": "State",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Oauth Callback",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/auth/oauth/{provider}/start": {
      "get": {
        "description": "Begin the OAuth login flow: generate a CSRF state, cache it in Redis with the sanitized redirect target, and redirect the browser to the provider authorize endpoint.",
        "operationId": "oauth_start_api_v1_auth_oauth__provider__start_get",
        "parameters": [
          {
            "in": "path",
            "name": "provider",
            "required": true,
            "schema": {
              "title": "Provider",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "redirect_to",
            "required": false,
            "schema": {
              "default": "/",
              "title": "Redirect To",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "invitation_token",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Invitation Token"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Oauth Start",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/auth/password/change": {
      "post": {
        "description": "Change the current user's password after verifying the old one, bump the token version to invalidate other JWTs, revoke all other sessions, and re-issue this cookie.",
        "operationId": "change_password_api_v1_auth_password_change_post",
        "parameters": [
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChangePasswordBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "title": "Response Change Password Api V1 Auth Password Change Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Change Password",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/auth/password/reset/confirm": {
      "post": {
        "description": "Verify a single-use password reset token, set the new password, bump the token version, auto-verify the email, and revoke all sessions. Returns 400 on a stale link.",
        "operationId": "confirm_password_reset_api_v1_auth_password_reset_confirm_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PasswordResetConfirmBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "title": "Response Confirm Password Reset Api V1 Auth Password Reset Confirm Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Confirm Password Reset",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/auth/password/reset/request": {
      "post": {
        "description": "Email a single-use password reset link to the given address when an account exists. Always returns 200 without revealing whether the email is registered. Capped.",
        "operationId": "request_password_reset_api_v1_auth_password_reset_request_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PasswordResetRequestBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "title": "Response Request Password Reset Api V1 Auth Password Reset Request Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Request Password Reset",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/auth/password/set": {
      "post": {
        "description": "Set an initial password for an OAuth-only account that has none yet. Requires session auth and fails with 400 if a password already exists; use change-password.",
        "operationId": "set_password_api_v1_auth_password_set_post",
        "parameters": [
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetPasswordBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "title": "Response Set Password Api V1 Auth Password Set Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Set Password",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/auth/providers": {
      "get": {
        "description": "Return the names of OAuth providers currently enabled on the server, such as GitHub and GitLab. Unauthenticated; the frontend uses it to render login buttons.",
        "operationId": "list_providers_api_v1_auth_providers_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProvidersResponse"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "List Providers",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/auth/refresh": {
      "post": {
        "description": "Refresh the access token using the refresh cookie. Rotates the refresh token.\n\nImplements refresh-token reuse detection (SEC-20260420-006). Each session row\ncarries ``used_at`` (set on rotation) and ``replaced_by_id`` (forward chain\nlink). If a client presents a token whose row has ``used_at`` set, the token\nis being replayed \u2014 either by an attacker who stole the cookie before the\nlegitimate client rotated it, or by a buggy client retrying the same token.\nEither way we burn the entire rotation family so a stolen cookie is worth\nat most one rotation cycle and the theft is loud.",
        "operationId": "refresh_token_api_v1_auth_refresh_post",
        "parameters": [
          {
            "in": "cookie",
            "name": "riftmap_refresh",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Refresh"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "title": "Response Refresh Token Api V1 Auth Refresh Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Refresh Token",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/auth/register": {
      "post": {
        "description": "Create a new user account with the given email and password, provision their first workspace, owner membership, and default API key, then send a verification email.",
        "operationId": "register_api_v1_auth_register_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegisterBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MeResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Register",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/v1/billing/plans": {
      "get": {
        "description": "Return available plan pricing and limits from Stripe (cached 1 hour).\n\nAccessible to any authenticated user so it works during workspace creation.\nFalls back to hardcoded defaults when Stripe is not configured or unreachable.",
        "operationId": "get_plan_catalog_api_v1_billing_plans_get",
        "parameters": [
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlanCatalogResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Plan Catalog",
        "tags": [
          "billing"
        ]
      }
    },
    "/api/v1/connected-orgs": {
      "get": {
        "description": "List every connected org registered in the authenticated workspace, ordered alphabetically by name; any workspace member may read it. Returns each org record.",
        "operationId": "list_connected_orgs_api_v1_connected_orgs_get",
        "parameters": [
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/ConnectedOrgResponse"
                  },
                  "title": "Response List Connected Orgs Api V1 Connected Orgs Get",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Connected Orgs",
        "tags": [
          "connected-orgs"
        ]
      },
      "post": {
        "description": "Add a new connected org and automatically trigger a full scan.\n\nOwner/Admin only (session auth): registering an org submits a platform\ncredential, expands scan scope, and consumes the plan repo cap \u2014 a mutation\nthe workspace role model reserves for Admin/Owner. API-key auth is\nowner-equivalent and bypasses the role check.\n\nAccepts two auth modes:\n  - PAT mode:   body contains url + access_token\n  - OAuth mode: body contains oauth_org_login (uses the user's linked identity token)\n\nA full scan is automatically queued after the org is created. The response\nincludes ``initial_scan_id`` which can be used to poll scan progress via\nGET /api/v1/scans/{scan_id}.",
        "operationId": "create_connected_org_api_v1_connected_orgs_post",
        "parameters": [
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectedOrgCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectedOrgResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create Connected Org",
        "tags": [
          "connected-orgs"
        ]
      }
    },
    "/api/v1/connected-orgs/{connected_org_id}": {
      "delete": {
        "description": "Delete a connected org.\n\nCascade-deletes all associated repositories, scans, and artifacts, and\nremoves the encrypted token from the database.\n\nNote: platform-side token revocation is NOT performed automatically.\nUsers should revoke the GitHub/GitLab PAT or OAuth token manually\nafter disconnecting (see GitHub token settings or GitLab token settings).",
        "operationId": "delete_connected_org_api_v1_connected_orgs__connected_org_id__delete",
        "parameters": [
          {
            "in": "path",
            "name": "connected_org_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Connected Org Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Delete Connected Org",
        "tags": [
          "connected-orgs"
        ]
      },
      "get": {
        "description": "Fetch a connected org by its ID, scoped to the authenticated workspace; any member may read it. Returns 404 when no org with that ID exists in the workspace.",
        "operationId": "get_connected_org_api_v1_connected_orgs__connected_org_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "connected_org_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Connected Org Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectedOrgResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Connected Org",
        "tags": [
          "connected-orgs"
        ]
      },
      "put": {
        "description": "Update mutable connected org settings.\n\nEditable fields: `name`, `heuristic_patterns`, and `access_token` (PAT rotation).\nImmutable: `platform`, `platform_id`, `url` \u2014 disconnect and re-register to change.\nRotating the token also clears the auth-failure auto-pause, resuming scheduled\nrescans immediately.\n\nToken rotation is rejected (409) for OAuth-registered orgs because the stored\ntoken is a copy of the user's linked identity. Rotating here would silently\ndesync the org from the identity.",
        "operationId": "update_connected_org_api_v1_connected_orgs__connected_org_id__put",
        "parameters": [
          {
            "in": "path",
            "name": "connected_org_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Connected Org Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectedOrgUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectedOrgResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Update Connected Org",
        "tags": [
          "connected-orgs"
        ]
      }
    },
    "/api/v1/connected-orgs/{connected_org_id}/artifacts": {
      "get": {
        "description": "List all known artifacts in a connected org, including orphans.\n\nEach response row carries ``consumer_count`` + ``is_orphan``. Orphans are\nartifacts the org produces but nothing in the org consumes \u2014 valuable\ndead-weight signal, not noise.\n\n**Upstream aliases are excluded by default** (issue #258). A repo that forks an\nupstream project and keeps its package identity registers as the producer of the\nupstream coordinate \u2014 a forked ``go.mod`` still says ``module\ngo.opentelemetry.io/otel`` \u2014 so listing every row meant listing other people's\npackages: 15,741 production rows against 4,477 the orgs actually publish. Every\nrow carries ``is_first_party``; pass ``include_upstream_aliases=true`` to get them\nall back. An upstream-alias artifact is exactly one with ``is_first_party: false``.\nA fork that rewrote its coordinate into its own namespace\n(``github.com/acme/go-i18n``) is first-party and is always listed.\n\nPaginated via ``limit`` / ``offset`` query params (default 100, max 500).\n``X-Total-Count`` counts the rows matching the same filter as the page, so it is\nthe first-party total by default and the all-rows total with\n``include_upstream_aliases=true``. ``X-Upstream-Alias-Count`` always carries the\nexcluded-row count, so a client can name what the default hides without a second\nrequest.",
        "operationId": "list_artifacts_api_v1_connected_orgs__connected_org_id__artifacts_get",
        "parameters": [
          {
            "in": "path",
            "name": "connected_org_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Connected Org Id",
              "type": "string"
            }
          },
          {
            "description": "Maximum items to return.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 100,
              "description": "Maximum items to return.",
              "maximum": 500,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "Items to skip.",
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "description": "Items to skip.",
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "description": "Include artifacts produced by forked repos that kept the upstream project's package identity. Off by default \u2014 an upstream-alias artifact is exactly one with `is_first_party: false`.",
            "in": "query",
            "name": "include_upstream_aliases",
            "required": false,
            "schema": {
              "default": false,
              "description": "Include artifacts produced by forked repos that kept the upstream project's package identity. Off by default \u2014 an upstream-alias artifact is exactly one with `is_first_party: false`.",
              "title": "Include Upstream Aliases",
              "type": "boolean"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/ArtifactResponse"
                  },
                  "title": "Response List Artifacts Api V1 Connected Orgs  Connected Org Id  Artifacts Get",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List artifacts (Docker images, packages, modules) produced in a connected org.",
        "tags": [
          "artifacts"
        ]
      }
    },
    "/api/v1/connected-orgs/{connected_org_id}/graph": {
      "get": {
        "description": "Return the dependency graph for a connected org.\n\nWithout ``root``: full graph for the org.\n\nWith ``root=<repo_id>``: subgraph anchored at that repo, including up to\n``depth`` hops in both directions (upstream + downstream). Designed for AI\ncoding agents that want a focused neighbourhood instead of the whole org.\n\nNodes are repositories; edges are resolved dependencies from the most\nrecent completed scan. Format is G6-compatible.\n\n**Confidence differs between the two modes, deliberately.** With ``root``,\n``min_confidence`` (default 0.4) governs both the traversal and the edges\nreturned, and the response echoes it as ``applied_min_confidence``. Without\n``root``, no floor is applied \u2014 the full-org graph returns every ``manifest``\nedge so clients can filter for themselves, and ``applied_min_confidence`` is\n``null``. That asymmetry is why the org and workspace dependency counters\nmatch this endpoint exactly: browsing is a different question from asking what\nbreaks.",
        "operationId": "get_graph_api_v1_connected_orgs__connected_org_id__graph_get",
        "parameters": [
          {
            "in": "path",
            "name": "connected_org_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Connected Org Id",
              "type": "string"
            }
          },
          {
            "description": "Optional repository ID to anchor a subgraph view. When set, the response is limited to the root plus its upstream and downstream neighbours within ``depth`` hops. Omit for the full org graph.",
            "in": "query",
            "name": "root",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "uuid",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional repository ID to anchor a subgraph view. When set, the response is limited to the root plus its upstream and downstream neighbours within ``depth`` hops. Omit for the full org graph.",
              "title": "Root"
            }
          },
          {
            "description": "BFS depth from ``root`` in each direction. Ignored when ``root`` is omitted.",
            "in": "query",
            "name": "depth",
            "required": false,
            "schema": {
              "default": 2,
              "description": "BFS depth from ``root`` in each direction. Ignored when ``root`` is omitted.",
              "maximum": 10,
              "minimum": 1,
              "title": "Depth",
              "type": "integer"
            }
          },
          {
            "description": "Minimum edge confidence to traverse, between 0.0 and 1.0. The default 0.4 admits every reference a machine could act on \u2014 deterministic parser edges (0.9\u20131.0), resolver matches (0.65\u20130.95), heuristic references in build and CI files, package manifests and fetch commands (0.85), and references in files the classifier does not recognise (0.6\u20130.7), which mean 'unclassified', not 'unlikely'. It excludes only references a human reads rather than a machine executes: prose, HTML templates, generated blobs and ignore files (0.3). Pass 0.8 to restrict the answer to deterministic and build-file evidence only, or 0.0 to include everything. The value actually applied is echoed in the response, and each affected repository carries the confidence of the weakest edge on the strongest path that reached it, so a stricter answer can be recovered by filtering the response without a second request. Ignored when ``root`` is omitted: the full-org graph applies no floor at all and returns every ``manifest`` edge, in which case ``applied_min_confidence`` in the response is ``null``.",
            "in": "query",
            "name": "min_confidence",
            "required": false,
            "schema": {
              "default": 0.4,
              "description": "Minimum edge confidence to traverse, between 0.0 and 1.0. The default 0.4 admits every reference a machine could act on \u2014 deterministic parser edges (0.9\u20131.0), resolver matches (0.65\u20130.95), heuristic references in build and CI files, package manifests and fetch commands (0.85), and references in files the classifier does not recognise (0.6\u20130.7), which mean 'unclassified', not 'unlikely'. It excludes only references a human reads rather than a machine executes: prose, HTML templates, generated blobs and ignore files (0.3). Pass 0.8 to restrict the answer to deterministic and build-file evidence only, or 0.0 to include everything. The value actually applied is echoed in the response, and each affected repository carries the confidence of the weakest edge on the strongest path that reached it, so a stricter answer can be recovered by filtering the response without a second request. Ignored when ``root`` is omitted: the full-org graph applies no floor at all and returns every ``manifest`` edge, in which case ``applied_min_confidence`` in the response is ``null``.",
              "maximum": 1.0,
              "minimum": 0.0,
              "title": "Min Confidence",
              "type": "number"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GraphResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get the dependency graph (full org or subgraph anchored at a repo).",
        "tags": [
          "graph"
        ]
      }
    },
    "/api/v1/connected-orgs/{connected_org_id}/ownership-risk": {
      "get": {
        "description": "Return the ranked concentration-risk feed for a connected org.\n\n**Default mode** (no overrides): returns repos where the stored\n``is_concentration_risk`` is true (fan-in >= org P75 with floor 5, AND\n``0 < bus_factor <= bus_factor_ceiling`` \u2014 defaults 5 and 2 per spec \u00a72).\n\n**Override mode** (either ``min_dependents`` or ``max_bus_factor`` given):\nignores the stored flag and uses the inline predicate\n``bus_factor > 0 AND bus_factor <= max_bus_factor AND dependents_count >= min_dependents``\n(each clause is no-op when its param is omitted). ``bus_factor = 0``\n(no human commits) is always excluded.\n\nOrdered ``risk_score DESC, top_author_share DESC, repository_id ASC``.\nPaginated via ``limit`` / ``offset``; ``X-Total-Count`` carries the full\nmatching set. Returns an empty list when no signal rows exist for the\norg's latest scan (``OWNERSHIP_SIGNAL_ENABLED=false`` or pre-backfill).\nRaw emails are never returned (PII).\n\nShares and counts are windowed: each item carries the ``window``\n(``start``/``end``, a trailing ``window_days`` period \u2014 default 365) and\n``computed_at`` (scan-finalisation time) the figures were computed over, so\na ``top_author_share`` of 0.82 reads as \"last 12 months\", not all-time. This\nmatches the per-repo ``/repositories/{id}/ownership`` window.",
        "operationId": "get_ownership_risk_feed_api_v1_connected_orgs__connected_org_id__ownership_risk_get",
        "parameters": [
          {
            "in": "path",
            "name": "connected_org_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Connected Org Id",
              "type": "string"
            }
          },
          {
            "description": "Maximum items to return.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 100,
              "description": "Maximum items to return.",
              "maximum": 500,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "Items to skip.",
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "description": "Items to skip.",
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "description": "Override: require dependents_count >= this. Activates override mode.",
            "in": "query",
            "name": "min_dependents",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 0,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Override: require dependents_count >= this. Activates override mode.",
              "title": "Min Dependents"
            }
          },
          {
            "description": "Override: require 1 <= bus_factor <= this. Activates override mode.",
            "in": "query",
            "name": "max_bus_factor",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Override: require 1 <= bus_factor <= this. Activates override mode.",
              "title": "Max Bus Factor"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/OwnershipRiskItem"
                  },
                  "title": "Response Get Ownership Risk Feed Api V1 Connected Orgs  Connected Org Id  Ownership Risk Get",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Ranked findings feed: high-fan-in repos with low bus factor (spec \u00a78). Shares and counts are computed over a trailing window (default 365 days), excluding merge commits, with bot identities stripped; each item carries the `window` (start/end) and `computed_at` it was computed for.",
        "tags": [
          "connected-orgs"
        ]
      }
    },
    "/api/v1/connected-orgs/{connected_org_id}/repositories": {
      "get": {
        "description": "List all repositories discovered in a connected org.\n\nPaginated via ``limit`` / ``offset`` query params (default 100, max 500).\n``X-Total-Count`` response header carries the unfiltered row count.",
        "operationId": "list_repositories_api_v1_connected_orgs__connected_org_id__repositories_get",
        "parameters": [
          {
            "in": "path",
            "name": "connected_org_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Connected Org Id",
              "type": "string"
            }
          },
          {
            "description": "Maximum items to return.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 100,
              "description": "Maximum items to return.",
              "maximum": 500,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "Items to skip.",
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "description": "Items to skip.",
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/RepositoryResponse"
                  },
                  "title": "Response List Repositories Api V1 Connected Orgs  Connected Org Id  Repositories Get",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List repositories discovered in a connected org.",
        "tags": [
          "repositories"
        ]
      }
    },
    "/api/v1/connected-orgs/{connected_org_id}/scans": {
      "get": {
        "description": "List all scans for a connected org, newest first.\n\nPaginated via ``limit`` / ``offset`` query params (default 100, max 500).\n``X-Total-Count`` response header carries the unfiltered row count.",
        "operationId": "list_scans_api_v1_connected_orgs__connected_org_id__scans_get",
        "parameters": [
          {
            "in": "path",
            "name": "connected_org_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Connected Org Id",
              "type": "string"
            }
          },
          {
            "description": "Maximum items to return.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 100,
              "description": "Maximum items to return.",
              "maximum": 500,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "Items to skip.",
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "description": "Items to skip.",
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/ScanResponse"
                  },
                  "title": "Response List Scans Api V1 Connected Orgs  Connected Org Id  Scans Get",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Scans",
        "tags": [
          "scans"
        ]
      },
      "post": {
        "description": "Trigger a new scan for a connected org.\n\nOwner/Admin only (session auth): triggering a scan exercises the stored\nplatform credential and consumes worker capacity \u2014 a mutation the workspace\nrole model reserves for Admin/Owner. API-key auth is owner-equivalent and\nbypasses the role check. (Cancelling an in-flight scan stays member-permitted\nas an operational action.)\n\nAccepts an optional JSON body with ``scan_type``: ``\"incremental\"`` (default)\nskips repos unchanged since the last scan; ``\"full\"`` re-scans every repo.\nCreates a Scan record immediately (status=pending) and dispatches\nthe scan to a Celery worker. Poll GET /scans/{scan_id} for progress.",
        "operationId": "trigger_scan_api_v1_connected_orgs__connected_org_id__scans_post",
        "parameters": [
          {
            "in": "path",
            "name": "connected_org_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Connected Org Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ScanTriggerRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScanTriggerResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Trigger Scan",
        "tags": [
          "scans"
        ]
      }
    },
    "/api/v1/connected-orgs/{connected_org_id}/stats": {
      "get": {
        "description": "Aggregate statistics for one connected org: repository, declaration and deduped dependency-edge counts, artifact orphan/consumption breakdowns, and the declaration-outcome breakdown naming why each parsed dependency did or did not become a graph edge. Dependency figures are scoped per repository to its own current scan, not to a single org-wide one.",
        "operationId": "get_connected_org_stats_api_v1_connected_orgs__connected_org_id__stats_get",
        "parameters": [
          {
            "in": "path",
            "name": "connected_org_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Connected Org Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgStats"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Connected Org Stats",
        "tags": [
          "connected-orgs"
        ]
      }
    },
    "/api/v1/invitations/{token}": {
      "get": {
        "description": "Preview an invitation by its raw token before accepting \u2014 returns the workspace name, inviter, role, and a masked hint of the invited address for email-kind invites. Public, no auth; 404 if the token is invalid or expired.",
        "operationId": "preview_invitation_api_v1_invitations__token__get",
        "parameters": [
          {
            "in": "path",
            "name": "token",
            "required": true,
            "schema": {
              "title": "Token",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvitationPreviewResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Preview Invitation",
        "tags": [
          "invitations"
        ]
      }
    },
    "/api/v1/invitations/{token}/accept": {
      "post": {
        "description": "Accept an invitation by token, joining the workspace with the invited role. Requires a logged-in user with a verified email address; an email-kind invitation must additionally be redeemed by the address it was sent to. Rate-limited, single-use, seat-capped.",
        "operationId": "accept_invitation_api_v1_invitations__token__accept_post",
        "parameters": [
          {
            "in": "path",
            "name": "token",
            "required": true,
            "schema": {
              "title": "Token",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Accept Invitation Api V1 Invitations  Token  Accept Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Accept Invitation",
        "tags": [
          "invitations"
        ]
      }
    },
    "/api/v1/repositories/lookup": {
      "get": {
        "description": "Resolve an agent-supplied identifier to a Riftmap repository row.\n\nDesigned for AI coding agents and CI integrations: an agent in\n``github.com/myorg/repo`` can ask Riftmap for the matching repository\nwithout enumerating the workspace. **Pass exactly one of ``url`` or\n``full_path``** \u2014 passing both, neither, or any other parameter\n(e.g. ``clone_url=``, ``name=``, ``repo=``) returns 400. The parameter\nis named ``url`` (not ``clone_url``) even though it accepts what most\nplatforms call a \"clone URL\".\n\nURL matching first attempts a normalised ``clone_url`` match, then falls\nback to the ``org/repo`` segment of the URL against ``full_path``. Returns\n409 if more than one repo matches; 404 if none.",
        "operationId": "lookup_repository_api_v1_repositories_lookup_get",
        "parameters": [
          {
            "description": "Git remote URL (https or ssh form, with or without `.git` suffix). Example: `https://github.com/myorg/repo`. **The parameter is named `url`, not `clone_url`** \u2014 a common agent guess that returns 400. Mutually exclusive with `full_path`.",
            "in": "query",
            "name": "url",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Git remote URL (https or ssh form, with or without `.git` suffix). Example: `https://github.com/myorg/repo`. **The parameter is named `url`, not `clone_url`** \u2014 a common agent guess that returns 400. Mutually exclusive with `full_path`.",
              "title": "Url"
            }
          },
          {
            "description": "Repository full path within its host. Example: `myorg/repo`. Case-insensitive. Mutually exclusive with `url`.",
            "in": "query",
            "name": "full_path",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Repository full path within its host. Example: `myorg/repo`. Case-insensitive. Mutually exclusive with `url`.",
              "title": "Full Path"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RepositoryResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Resolve a clone URL or org/repo slug to a repository (pass exactly one of `url` or `full_path`).",
        "tags": [
          "repositories"
        ]
      }
    },
    "/api/v1/repositories/{repo_id}": {
      "get": {
        "description": "Fetch one repository by ID, scoped to the authenticated workspace via its connected org. Returns the full row including freshness fields; raises 404 if no match.",
        "operationId": "get_repository_api_v1_repositories__repo_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "repo_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Repo Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RepositoryResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get a single repository by ID, including freshness fields.",
        "tags": [
          "repositories"
        ]
      }
    },
    "/api/v1/repositories/{repo_id}/context": {
      "get": {
        "description": "Return the repo, capped direct dependents/dependencies, and artifacts in one call.\n\n**This is the recommended second call** for AI coding agents auditing a\nrepo (after ``/repositories/lookup`` resolves the ID). One request\ncollapses what would otherwise be three or four. The freshness fields on\n``repository`` (``last_scanned_at``, ``last_activity_at``,\n``last_commit_sha``, ``archived``) let the agent decide whether to trust\nthe data or trigger a rescan.\n\nDirect dependents and dependencies are capped at 100 rows each; the\n``dependencies_total`` and ``dependents_total`` fields carry the post-dedup\ncount so the agent knows when to paginate via the dedicated\n``/dependencies`` and ``/dependents`` endpoints. Both lists are declaration\nrows, so a repository used through several actions or packages takes several\ndependent rows: ``dependent_repositories_total`` is the number of distinct\nrepositories behind ``dependents_total``. For transitive blast\nradius (multi-hop downstream), call ``/repositories/{id}/impact`` after\nthis \u2014 it is deliberately *not* bundled here because not every agent flow\nneeds it.",
        "operationId": "get_repository_context_api_v1_repositories__repo_id__context_get",
        "parameters": [
          {
            "in": "path",
            "name": "repo_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Repo Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RepositoryContextResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Recommended first hydration call after `/lookup`: repo + capped deps + capped dependents + artifacts in one round-trip.",
        "tags": [
          "repositories"
        ]
      }
    },
    "/api/v1/repositories/{repo_id}/dependencies": {
      "get": {
        "description": "Get all dependency declarations from this repo's latest scan.\n\nPaginated via ``limit`` / ``offset`` (default 100, max 500). ``X-Total-Count``\ncarries the post-dedup total so agents know whether to fetch additional pages.",
        "operationId": "get_dependencies_api_v1_repositories__repo_id__dependencies_get",
        "parameters": [
          {
            "in": "path",
            "name": "repo_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Repo Id",
              "type": "string"
            }
          },
          {
            "description": "Maximum items to return.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 100,
              "description": "Maximum items to return.",
              "maximum": 500,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "Items to skip.",
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "description": "Items to skip.",
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "description": "Drop declarations known to be transitive \u2014 Go `require` lines marked `// indirect`, i.e. modules pulled in by another dependency rather than imported by this repo's own code. Off by default, because a transitive dependency still propagates breakage and belongs in a blast radius. Rows whose ecosystem cannot express transitivity (`dependency_relationship: null`) are always kept. `X-Total-Count` follows the filter.",
            "in": "query",
            "name": "exclude_indirect",
            "required": false,
            "schema": {
              "default": false,
              "description": "Drop declarations known to be transitive \u2014 Go `require` lines marked `// indirect`, i.e. modules pulled in by another dependency rather than imported by this repo's own code. Off by default, because a transitive dependency still propagates breakage and belongs in a blast radius. Rows whose ecosystem cannot express transitivity (`dependency_relationship: null`) are always kept. `X-Total-Count` follows the filter.",
              "title": "Exclude Indirect",
              "type": "boolean"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/DependencyInfo"
                  },
                  "title": "Response Get Dependencies Api V1 Repositories  Repo Id  Dependencies Get",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List the dependency declarations this repository makes.",
        "tags": [
          "repositories"
        ]
      }
    },
    "/api/v1/repositories/{repo_id}/dependents": {
      "get": {
        "description": "Get the declarations in other repositories that resolve to this repository, one row per declaration.\n\nEach row is one use: the consuming repository is ``target_repository_id`` /\n``target_repository_name`` (count distinct values of it for the number of\ndependent repositories), and ``source_file`` / ``source_line`` locate the use in\nit. Rows are deduplicated at read time on declaration identity \u2014 consumer\nrepository, dependency type, version constraint, source file, raw reference and\nsource line \u2014 so a consumer that calls several GitHub Actions or reusable\nworkflows of this repository, or the same one on several lines, appears once per\nuse. Group by ``lower(raw_reference)`` to list consumers per action, workflow or\npackage: for GitHub Actions it is the full ``uses:`` path, such as\n``grafana/shared-workflows/actions/send-slack-message``. A row whose consumer was\nlast scanned before v1.25.0 carries only the bare ``owner/repo`` there.\n\nPaginated via ``limit`` / ``offset`` (default 100, max 500). ``X-Total-Count``\ncarries the post-dedup total of these declarations, not of repositories.",
        "operationId": "get_dependents_api_v1_repositories__repo_id__dependents_get",
        "parameters": [
          {
            "in": "path",
            "name": "repo_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Repo Id",
              "type": "string"
            }
          },
          {
            "description": "Maximum items to return.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 100,
              "description": "Maximum items to return.",
              "maximum": 500,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "Items to skip.",
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "description": "Items to skip.",
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "description": "Drop declarations known to be transitive \u2014 Go `require` lines marked `// indirect`, i.e. modules pulled in by another dependency rather than imported by this repo's own code. Off by default, because a transitive dependency still propagates breakage and belongs in a blast radius. Rows whose ecosystem cannot express transitivity (`dependency_relationship: null`) are always kept. `X-Total-Count` follows the filter.",
            "in": "query",
            "name": "exclude_indirect",
            "required": false,
            "schema": {
              "default": false,
              "description": "Drop declarations known to be transitive \u2014 Go `require` lines marked `// indirect`, i.e. modules pulled in by another dependency rather than imported by this repo's own code. Off by default, because a transitive dependency still propagates breakage and belongs in a blast radius. Rows whose ecosystem cannot express transitivity (`dependency_relationship: null`) are always kept. `X-Total-Count` follows the filter.",
              "title": "Exclude Indirect",
              "type": "boolean"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/DependencyInfo"
                  },
                  "title": "Response Get Dependents Api V1 Repositories  Repo Id  Dependents Get",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List the repositories that directly depend on this repository.",
        "tags": [
          "repositories"
        ]
      }
    },
    "/api/v1/repositories/{repo_id}/impact": {
      "get": {
        "description": "Get the full downstream impact of changing this repository.\n\nReturns all repositories that depend on this one, directly or transitively,\nup to ``max_depth`` hops away. Use this before publishing a breaking change.\n\n**Repo-level scope, not file-scoped.** This endpoint computes a BFS over\nrepo-to-repo dependency edges; it does **not** trace specific files, jobs,\nor symbols within the source repo. There is no ``path``, ``paths``,\n``file``, or ``job`` query parameter \u2014 agents asking \"who consumes file X\nin repo Y\" should call ``/repositories/{id}/dependents`` and then grep the\nconsumer repos directly, since per-file edges aren't stored in the graph.\nGitHub Actions are the exception: every ``/dependents`` row carries the full\n``uses:`` path in ``raw_reference`` (e.g.\n``grafana/shared-workflows/actions/send-slack-message``), so \"who uses action\nor reusable workflow X\" is answered by filtering those rows, no grep needed.\nUnknown query parameters are silently ignored by FastAPI, which can mask\nhallucinated filter names \u2014 if a filter doesn't appear in this signature,\nit's not honoured.\n\nFor artifact-level consumers (who pulls Docker image / Helm chart /\nTerraform module X and at what version), use ``/artifacts/{id}/consumers``\ninstead \u2014 that endpoint *is* version-aware.\n\n**Confidence.** Traversal follows only edges at or above ``min_confidence``,\nwhich defaults to 0.4: every reference a machine could act on, excluding only\nthe tier that means a human reads it (prose, templates, generated blobs). The\nfloor that was applied is echoed as ``applied_min_confidence``, the repos it\nremoved are counted in ``excluded_by_confidence`` so a truncated answer is\nnever silent, and each affected repo carries the confidence of the weakest\nedge on the strongest chain that reached it \u2014 so a stricter blast radius is a\nfilter over this response, not a second request.",
        "operationId": "repository_impact_api_v1_repositories__repo_id__impact_get",
        "parameters": [
          {
            "in": "path",
            "name": "repo_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Repo Id",
              "type": "string"
            }
          },
          {
            "description": "Maximum BFS depth (hops from the source repo). Range 1\u201320, default 10.",
            "in": "query",
            "name": "max_depth",
            "required": false,
            "schema": {
              "default": 10,
              "description": "Maximum BFS depth (hops from the source repo). Range 1\u201320, default 10.",
              "maximum": 20,
              "minimum": 1,
              "title": "Max Depth",
              "type": "integer"
            }
          },
          {
            "description": "Minimum edge confidence to traverse, between 0.0 and 1.0. The default 0.4 admits every reference a machine could act on \u2014 deterministic parser edges (0.9\u20131.0), resolver matches (0.65\u20130.95), heuristic references in build and CI files, package manifests and fetch commands (0.85), and references in files the classifier does not recognise (0.6\u20130.7), which mean 'unclassified', not 'unlikely'. It excludes only references a human reads rather than a machine executes: prose, HTML templates, generated blobs and ignore files (0.3). Pass 0.8 to restrict the answer to deterministic and build-file evidence only, or 0.0 to include everything. The value actually applied is echoed in the response, and each affected repository carries the confidence of the weakest edge on the strongest path that reached it, so a stricter answer can be recovered by filtering the response without a second request.",
            "in": "query",
            "name": "min_confidence",
            "required": false,
            "schema": {
              "default": 0.4,
              "description": "Minimum edge confidence to traverse, between 0.0 and 1.0. The default 0.4 admits every reference a machine could act on \u2014 deterministic parser edges (0.9\u20131.0), resolver matches (0.65\u20130.95), heuristic references in build and CI files, package manifests and fetch commands (0.85), and references in files the classifier does not recognise (0.6\u20130.7), which mean 'unclassified', not 'unlikely'. It excludes only references a human reads rather than a machine executes: prose, HTML templates, generated blobs and ignore files (0.3). Pass 0.8 to restrict the answer to deterministic and build-file evidence only, or 0.0 to include everything. The value actually applied is echoed in the response, and each affected repository carries the confidence of the weakest edge on the strongest path that reached it, so a stricter answer can be recovered by filtering the response without a second request.",
              "maximum": 1.0,
              "minimum": 0.0,
              "title": "Min Confidence",
              "type": "number"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImpactResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Transitive downstream blast radius (repo-level BFS). NOT file-path scoped \u2014 accepts only `max_depth` + `min_confidence`.",
        "tags": [
          "impact"
        ]
      }
    },
    "/api/v1/repositories/{repo_id}/ownership": {
      "get": {
        "description": "Return the ownership signal for one repo, scoped to the latest scan of its org.\n\nContributors are humans only, ordered by ``commit_count DESC``. Returns 200\nwith zeros / null / empty arrays when no signal exists yet (the feature flag\n``OWNERSHIP_SIGNAL_ENABLED`` is off, or the scan ran before backfill) \u2014 the\nendpoint stays callable without agents needing a \"flag-off\" branch.\n\nPaginated via ``limit`` / ``offset``; ``X-Total-Count`` carries the full\nhuman contributor count. Raw emails are never returned (PII contract).",
        "operationId": "get_repository_ownership_api_v1_repositories__repo_id__ownership_get",
        "parameters": [
          {
            "in": "path",
            "name": "repo_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Repo Id",
              "type": "string"
            }
          },
          {
            "description": "Maximum items to return.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 100,
              "description": "Maximum items to return.",
              "maximum": 500,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "Items to skip.",
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "description": "Items to skip.",
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RepositoryOwnershipResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Bus-factor signal + capped human contributors for one repo (spec \u00a78).",
        "tags": [
          "repositories"
        ]
      }
    },
    "/api/v1/scans/{scan_id}": {
      "get": {
        "description": "Retrieve the current status and progress of a single scan by ID, scoped to the caller's workspace by its connected org. Returns 404 if no matching scan exists.",
        "operationId": "get_scan_api_v1_scans__scan_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "scan_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Scan Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScanResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Scan",
        "tags": [
          "scans"
        ]
      }
    },
    "/api/v1/scans/{scan_id}/cancel": {
      "post": {
        "description": "Cancel a pending or running scan.\n\nSets the scan status to 'cancelled' immediately. The Celery worker checks\nthis flag at each repository boundary and stops gracefully.\n\nStays member-permitted as an operational action (mirrors ``trigger_scan``'s\nnote); only read-only viewers are excluded (repricing B3).",
        "operationId": "cancel_scan_api_v1_scans__scan_id__cancel_post",
        "parameters": [
          {
            "in": "path",
            "name": "scan_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Scan Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScanResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Cancel Scan",
        "tags": [
          "scans"
        ]
      }
    },
    "/api/v1/webhooks/stripe": {
      "post": {
        "description": "Verify the Stripe signature on an incoming webhook, then process the event idempotently: unknown types are skipped and duplicates deduped via stripe_events table.",
        "operationId": "stripe_webhook_api_v1_webhooks_stripe_post",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "title": "Response Stripe Webhook Api V1 Webhooks Stripe Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Stripe Webhook",
        "tags": [
          "billing"
        ]
      }
    },
    "/api/v1/workspaces": {
      "get": {
        "description": "Return all workspaces the authenticated user is a member of.\n\nFor API key auth: returns the single workspace the key belongs to (total always 1).\nPaginated via ``limit`` / ``offset`` query params (default 100, max 500).\n``X-Total-Count`` response header carries the unfiltered row count.",
        "operationId": "list_workspaces_api_v1_workspaces_get",
        "parameters": [
          {
            "description": "Maximum items to return.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 100,
              "description": "Maximum items to return.",
              "maximum": 500,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "Items to skip.",
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "description": "Items to skip.",
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/WorkspaceResponse"
                  },
                  "title": "Response List Workspaces Api V1 Workspaces Get",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Workspaces",
        "tags": [
          "workspaces"
        ]
      },
      "post": {
        "description": "Create a new workspace for the current user and make them Owner.\n\nEach user may own at most one free workspace. If they already own a free\nworkspace, they must subscribe to a paid plan before creating another.",
        "operationId": "create_workspace_api_v1_workspaces_post",
        "parameters": [
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWorkspaceBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create Workspace",
        "tags": [
          "workspaces"
        ]
      }
    },
    "/api/v1/workspaces/create-with-checkout": {
      "post": {
        "description": "Create a new workspace and immediately open a Stripe Checkout session for it.\n\nUsed when the caller already owns a free workspace and wants to create\nan additional paid workspace. The workspace is provisioned with plan=\"free\"\nfirst; the webhook handler upgrades it to the chosen plan once Stripe\nconfirms payment.\n\nRequires: session auth, Stripe enabled.",
        "operationId": "create_workspace_with_checkout_api_v1_workspaces_create_with_checkout_post",
        "parameters": [
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWorkspaceWithCheckoutBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateWorkspaceWithCheckoutResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create Workspace With Checkout",
        "tags": [
          "workspaces"
        ]
      }
    },
    "/api/v1/workspaces/{workspace_id}": {
      "delete": {
        "description": "Permanently delete a workspace and everything it owns \u2014 connected orgs, scans, memberships, API keys, and invitations all cascade. Owner-only; returns 204.",
        "operationId": "delete_workspace_api_v1_workspaces__workspace_id__delete",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Delete Workspace",
        "tags": [
          "workspaces"
        ]
      },
      "get": {
        "description": "Fetch a single workspace by ID, returning its name, slug, plan, and metadata. Scoped to the caller's own workspace \u2014 responds 404 if the ID is any other workspace.",
        "operationId": "get_workspace_api_v1_workspaces__workspace_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Workspace",
        "tags": [
          "workspaces"
        ]
      },
      "put": {
        "description": "Update a workspace's display name, optionally regenerating its slug from the new name when regenerate_slug is set. Owner or Admin only; returns the updated record.",
        "operationId": "update_workspace_api_v1_workspaces__workspace_id__put",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkspaceUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Update Workspace",
        "tags": [
          "workspaces"
        ]
      }
    },
    "/api/v1/workspaces/{workspace_id}/api-key/regenerate": {
      "post": {
        "description": "[Deprecated] Rotate API key. Use POST /workspaces/{id}/api-keys instead.\n\nOwner/Admin only: this mints an owner-equivalent credential (API keys bypass\nrole/email-verification checks), so a plain member must not be able to call it.",
        "operationId": "regenerate_api_key_api_v1_workspaces__workspace_id__api_key_regenerate_post",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Regenerate Api Key Api V1 Workspaces  Workspace Id  Api Key Regenerate Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Regenerate Api Key",
        "tags": [
          "workspaces"
        ]
      }
    },
    "/api/v1/workspaces/{workspace_id}/api-keys": {
      "get": {
        "description": "List all API keys for the workspace with their name, prefix, creation and last-used times, and revocation status. Owner or Admin only; the raw key is never shown.",
        "operationId": "list_api_keys_api_v1_workspaces__workspace_id__api_keys_get",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/ApiKeyResponse"
                  },
                  "title": "Response List Api Keys Api V1 Workspaces  Workspace Id  Api Keys Get",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Api Keys",
        "tags": [
          "api-keys"
        ]
      },
      "post": {
        "description": "Create a named API key for the workspace and return its plaintext value exactly once at creation \u2014 store it now, it is never shown again. Owner or Admin only.",
        "operationId": "create_api_key_api_v1_workspaces__workspace_id__api_keys_post",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApiKeyBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKeyResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create Api Key",
        "tags": [
          "api-keys"
        ]
      }
    },
    "/api/v1/workspaces/{workspace_id}/api-keys/{key_id}": {
      "delete": {
        "description": "Revoke a workspace API key by ID, setting its revoked timestamp so it can no longer authenticate. Owner or Admin only; returns 409 if the key was already revoked.",
        "operationId": "revoke_api_key_api_v1_workspaces__workspace_id__api_keys__key_id__delete",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "key_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Key Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Revoke Api Key",
        "tags": [
          "api-keys"
        ]
      }
    },
    "/api/v1/workspaces/{workspace_id}/billing": {
      "get": {
        "description": "Return the workspace's billing status \u2014 plan, subscription status, seat count and limit, trial and billing-period end, and over-seat/org/repo flags. Owner only.",
        "operationId": "get_billing_status_api_v1_workspaces__workspace_id__billing_get",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingStatusResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Billing Status",
        "tags": [
          "billing"
        ]
      }
    },
    "/api/v1/workspaces/{workspace_id}/billing/cancel": {
      "post": {
        "description": "Schedule subscription cancellation at period end and record exit-survey row.\n\nSets ``cancel_at_period_end=true`` on the Stripe subscription. Inserts a row\nin ``subscription_cancellations`` capturing the optional reason + free-text.\nThe row is immutable \u2014 resuming the subscription does NOT delete it; it's an\nevent log, not state.",
        "operationId": "cancel_subscription_api_v1_workspaces__workspace_id__billing_cancel_post",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelSubscriptionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancelSubscriptionResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Cancel Subscription",
        "tags": [
          "billing"
        ]
      }
    },
    "/api/v1/workspaces/{workspace_id}/billing/cancel/preview": {
      "get": {
        "description": "Return the queued (uninvoiced) Stripe invoice items for this workspace's customer.\n\nUsed by ``CancelPanel`` to surface orphan prorations BEFORE the user confirms\ncancellation \u2014 a queued $134 charge from a prior plan-switch will still flush\nonto the final cycle invoice unless explicitly waived via\n``cancel?waive_pending_charges=true``.\n\nImplementation note: uses ``InvoiceItem.list(pending=True)`` directly rather\nthan ``Invoice.create_preview`` because the latter conflates renewal recurring\nline items with prorations and requires brittle line-flag classification on\nStripe API ``2025-03-31.basil`` (see comment on ``preview_change_plan``).",
        "operationId": "preview_cancel_api_v1_workspaces__workspace_id__billing_cancel_preview_get",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancelPreviewResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Preview pending charges that will bill on the final invoice if not waived",
        "tags": [
          "billing"
        ]
      }
    },
    "/api/v1/workspaces/{workspace_id}/billing/change-plan": {
      "post": {
        "description": "Switch between Pro and Business plans on an existing subscription.\n\nReplaces the base plan subscription item in Stripe and removes any seat\nadd-ons (extra_seats resets to 0 \u2014 re-add after switching if needed).\n\nPre-flight checks (409 with structured body):\n- ``org_disconnect_required``: target plan allows fewer org connections than\n  are currently connected.  Disconnect excess orgs first, then retry.\n- ``member_eviction_required``: target plan's included seats are fewer than\n  the current member count.  Supply ``member_ids_to_evict`` (exactly the\n  overflow count) to proceed atomically.",
        "operationId": "change_plan_api_v1_workspaces__workspace_id__billing_change_plan_post",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChangePlanRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChangePlanResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Change Plan",
        "tags": [
          "billing"
        ]
      }
    },
    "/api/v1/workspaces/{workspace_id}/billing/change-plan/preview": {
      "get": {
        "description": "Preview the proration and recurring-amount impact of switching plans.\n\nRead-only: does not mutate Stripe state or workspace state. Warnings mirror\nthe 409 conflicts that ``change_plan`` would raise (org overflow, member\noverflow) so the frontend can surface them before the user commits.",
        "operationId": "preview_change_plan_api_v1_workspaces__workspace_id__billing_change_plan_preview_get",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "target_plan",
            "required": true,
            "schema": {
              "enum": [
                "pro",
                "business"
              ],
              "title": "Target Plan",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "promotion_code",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Promotion Code"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChangePlanPreviewResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Preview Change Plan",
        "tags": [
          "billing"
        ]
      }
    },
    "/api/v1/workspaces/{workspace_id}/billing/checkout": {
      "post": {
        "description": "Create a Stripe Checkout session to upgrade the workspace to the 'pro' or 'business' plan. Owner only; returns 409 if a live subscription already exists.",
        "operationId": "create_checkout_session_api_v1_workspaces__workspace_id__billing_checkout_post",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": true,
                "title": "Body",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create Checkout Session",
        "tags": [
          "billing"
        ]
      }
    },
    "/api/v1/workspaces/{workspace_id}/billing/history": {
      "get": {
        "description": "Return a unified, date-desc list of invoices and credit notes for the workspace.\n\nReturns up to 50 of each kind per page. Each source (invoices, credit notes)\npaginates independently via Stripe's native ``starting_after`` cursor; callers\nthread the returned ``next_invoice_cursor`` / ``next_credit_note_cursor`` back\nas query params to fetch the next page. ``has_more`` is true when either\ncursor is non-null. Proration line items are embedded in their parent invoice\ndescription \u2014 they are NOT emitted as standalone events.",
        "operationId": "get_billing_history_api_v1_workspaces__workspace_id__billing_history_get",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "invoice_cursor",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Invoice Cursor"
            }
          },
          {
            "in": "query",
            "name": "credit_note_cursor",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Credit Note Cursor"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingHistoryResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Billing History",
        "tags": [
          "billing"
        ]
      }
    },
    "/api/v1/workspaces/{workspace_id}/billing/payment-info": {
      "get": {
        "description": "Return the workspace's default card payment method and recent invoices from Stripe. Owner role only; responds 400 when the workspace has no Stripe customer yet.",
        "operationId": "get_payment_info_api_v1_workspaces__workspace_id__billing_payment_info_get",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentInfoResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Payment Info",
        "tags": [
          "billing"
        ]
      }
    },
    "/api/v1/workspaces/{workspace_id}/billing/payment-methods": {
      "post": {
        "description": "Attach a confirmed PaymentMethod to the customer and optionally set as default.\n\nCalled after Stripe Elements ``confirmSetup`` resolves on the frontend. We\nattach synchronously (rather than waiting for the ``payment_method.attached``\nwebhook) so the UI can render the new card immediately after the modal closes.",
        "operationId": "attach_payment_method_api_v1_workspaces__workspace_id__billing_payment_methods_post",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AttachPaymentMethodRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AttachPaymentMethodResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Attach Payment Method",
        "tags": [
          "billing"
        ]
      }
    },
    "/api/v1/workspaces/{workspace_id}/billing/payment-methods/setup-intent": {
      "post": {
        "description": "Create a Stripe SetupIntent for in-app card collection via Stripe Elements.\n\nReturns the SetupIntent ``client_secret`` plus the publishable key bound to\nthe backend's Stripe environment, so the frontend never needs a ``VITE_``\nenv var for the publishable key (and can't drift from the backend's mode).",
        "operationId": "create_setup_intent_api_v1_workspaces__workspace_id__billing_payment_methods_setup_intent_post",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SetupIntentResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create Setup Intent",
        "tags": [
          "billing"
        ]
      }
    },
    "/api/v1/workspaces/{workspace_id}/billing/portal": {
      "post": {
        "description": "Create a Stripe Customer Portal session for managing the workspace's subscription and payment methods. Owner only; returns 400 if no Stripe customer exists yet.",
        "operationId": "create_portal_session_api_v1_workspaces__workspace_id__billing_portal_post",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PortalResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create Portal Session",
        "tags": [
          "billing"
        ]
      }
    },
    "/api/v1/workspaces/{workspace_id}/billing/resume": {
      "post": {
        "description": "Clear ``cancel_at_period_end`` on a subscription pending cancellation.\n\nThe webhook handler for ``customer.subscription.updated`` will clear\n``workspace.cancel_at`` when Stripe echoes the change; we also clear it\noptimistically here so the UI banner disappears immediately.",
        "operationId": "resume_subscription_api_v1_workspaces__workspace_id__billing_resume_post",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumeSubscriptionResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Resume Subscription",
        "tags": [
          "billing"
        ]
      }
    },
    "/api/v1/workspaces/{workspace_id}/billing/seats": {
      "delete": {
        "description": "Remove extra seat add-ons from the existing subscription.\n\nReduces the seat add-on quantity by ``seats_to_remove``. Cannot go below\nzero extra seats. If the quantity reaches zero the add-on line item is\nremoved from the subscription entirely.\n\nWhen the reduction would put the workspace over the new seat limit, the\ncaller must supply ``member_ids_to_evict`` \u2014 exactly as many IDs as the\noverflow count.  If they are not supplied, the endpoint returns 409 with\n``type=\"member_eviction_required\"`` and the full list of evictable members\n(non-owners, sorted newest-first) so the frontend can render a picker.\n\nThe Stripe item modification and the member removals are committed together\nso the workspace is never left in a partially-updated state.",
        "operationId": "remove_seats_api_v1_workspaces__workspace_id__billing_seats_delete",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RemoveSeatsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoveSeatsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Remove Seats",
        "tags": [
          "billing"
        ]
      },
      "post": {
        "description": "Increase the seat add-on quantity on the workspace's Stripe subscription with prorated billing, updating extra_seats and logging an audit event. Owner-only.",
        "operationId": "add_seats_api_v1_workspaces__workspace_id__billing_seats_post",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddSeatsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddSeatsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Add Seats",
        "tags": [
          "billing"
        ]
      }
    },
    "/api/v1/workspaces/{workspace_id}/billing/seats/preview": {
      "get": {
        "description": "Preview the proration and recurring-amount impact of adding or removing seat add-ons.\n\n``seat_delta`` is signed \u2014 positive = adding, negative = removing. Mirrors\nthe ``change-plan/preview`` contract so ``AddSeatsPanel`` / ``RemoveSeatsPanel``\ncan render the same \"What you'll pay\" breakdown before the user confirms.\n\nRead-only: does not mutate Stripe or workspace state.",
        "operationId": "preview_seat_change_api_v1_workspaces__workspace_id__billing_seats_preview_get",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "seat_delta",
            "required": true,
            "schema": {
              "title": "Seat Delta",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SeatChangePreviewResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Preview Seat Change",
        "tags": [
          "billing"
        ]
      }
    },
    "/api/v1/workspaces/{workspace_id}/billing/usage": {
      "get": {
        "description": "Return detailed resource usage vs plan limits for the workspace: repo, seat, and org-connection counts, feature flags, and subscription status. Owner only.",
        "operationId": "get_billing_usage_api_v1_workspaces__workspace_id__billing_usage_get",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingUsageResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Billing Usage",
        "tags": [
          "billing"
        ]
      }
    },
    "/api/v1/workspaces/{workspace_id}/entitlements": {
      "get": {
        "description": "Return the plan entitlements for a workspace: its plan key, per-feature flags (`scheduled_scans`, `continuous_scans`, `api_production`, `artifact_dashboard`, `multi_org`), billable seat usage, the seat ceiling (`null` means unlimited), and whether plan limits are enforced on this deployment at all. Readable by every member including viewers, which is the point \u2014 the equivalent billing routes are owner-only, so non-owners had no way to learn what their plan allows and clients defaulted to allowing everything. Carries no billing identifiers, invoice data, or billing contact. Feature flags are *effective*: when `billing_enforced` is false every flag is true, matching what the API will actually serve.\n\nDeliberately cheap: one COUNT for seat usage, with plan and features read off\nthe workspace row the auth dependency has already loaded. Every member hits\nthis on page load, so resist adding live usage counts here.",
        "operationId": "get_workspace_entitlements_api_v1_workspaces__workspace_id__entitlements_get",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceEntitlements"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Read the workspace's plan entitlements (any member)",
        "tags": [
          "workspaces"
        ]
      }
    },
    "/api/v1/workspaces/{workspace_id}/export": {
      "get": {
        "description": "GDPR right-to-portability export for a workspace.\n\nReturns a JSON file containing all workspace data. Secrets are redacted:\naccess_token_encrypted is omitted from connected orgs, and key_hash is\nomitted from API keys (only the safe prefix is included).\n\nRate limited to 1 export per workspace per hour.\nRequires Owner or Admin role.",
        "operationId": "export_workspace_api_v1_workspaces__workspace_id__export_get",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Export Workspace",
        "tags": [
          "workspaces"
        ]
      }
    },
    "/api/v1/workspaces/{workspace_id}/invitations": {
      "get": {
        "description": "List a workspace's active invitations \u2014 pending, not revoked, not fully used \u2014 with their role, kind, use count, and expiry. Owner or Admin only; no tokens.",
        "operationId": "list_invitations_api_v1_workspaces__workspace_id__invitations_get",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/InvitationResponse"
                  },
                  "title": "Response List Invitations Api V1 Workspaces  Workspace Id  Invitations Get",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Invitations",
        "tags": [
          "invitations"
        ]
      },
      "post": {
        "description": "Create an email or copyable-link invitation to a workspace, returning its one-time token. Owner or Admin with a verified email only; email invites are mailed out. Editor-role invites are seat-checked here, so an invitation that could never be accepted is refused at send time rather than failing for the invitee.",
        "operationId": "create_invitation_api_v1_workspaces__workspace_id__invitations_post",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateInvitationBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvitationResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create Invitation",
        "tags": [
          "invitations"
        ]
      }
    },
    "/api/v1/workspaces/{workspace_id}/invitations/{invitation_id}": {
      "delete": {
        "description": "Revoke a workspace invitation by ID so its link or email can no longer be accepted. Owner or Admin only; returns 204, or 404 if the invitation is unknown. Revoking frees any editor seat the pending invitation was reserving.",
        "operationId": "revoke_invitation_api_v1_workspaces__workspace_id__invitations__invitation_id__delete",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "invitation_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Invitation Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Revoke Invitation",
        "tags": [
          "invitations"
        ]
      }
    },
    "/api/v1/workspaces/{workspace_id}/leave": {
      "post": {
        "description": "Remove your own membership from a workspace, given a browser session. Returns 204. The last Owner cannot leave until ownership is transferred to another member.",
        "operationId": "leave_workspace_api_v1_workspaces__workspace_id__leave_post",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Leave Workspace",
        "tags": [
          "memberships"
        ]
      }
    },
    "/api/v1/workspaces/{workspace_id}/members": {
      "get": {
        "description": "List all members of a workspace. Any member can access.\n\nPaginated via ``limit`` / ``offset`` query params (default 100, max 500).\n``X-Total-Count`` response header carries the unfiltered row count.",
        "operationId": "list_members_api_v1_workspaces__workspace_id__members_get",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "description": "Maximum items to return.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 100,
              "description": "Maximum items to return.",
              "maximum": 500,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "Items to skip.",
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "description": "Items to skip.",
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/MemberResponse"
                  },
                  "title": "Response List Members Api V1 Workspaces  Workspace Id  Members Get",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Members",
        "tags": [
          "memberships"
        ]
      }
    },
    "/api/v1/workspaces/{workspace_id}/members/{user_id}": {
      "delete": {
        "description": "Delete a member's workspace membership by user ID. Owner or Admin only. Cannot remove the last Owner, or yourself \u2014 use the leave endpoint instead. Returns 204.",
        "operationId": "remove_member_api_v1_workspaces__workspace_id__members__user_id__delete",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "User Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Remove Member",
        "tags": [
          "memberships"
        ]
      },
      "patch": {
        "description": "Change a workspace member's role. Owner or Admin only; the last Owner cannot be demoted, Admins cannot promote to Owner, and promoting a viewer checks seat limits.",
        "operationId": "update_member_role_api_v1_workspaces__workspace_id__members__user_id__patch",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "User Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateRoleBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MemberResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Update Member Role",
        "tags": [
          "memberships"
        ]
      }
    },
    "/api/v1/workspaces/{workspace_id}/oauth-orgs/{provider}": {
      "get": {
        "description": "List GitHub orgs or GitLab groups accessible via the user's linked OAuth identity.\n\nUsed by the frontend org-picker so users can connect an org without pasting a PAT.\nRequires session auth \u2014 the token lives on the user's identity row, not the workspace.",
        "operationId": "list_oauth_orgs_api_v1_workspaces__workspace_id__oauth_orgs__provider__get",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "provider",
            "required": true,
            "schema": {
              "title": "Provider",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/OAuthOrgInfo"
                  },
                  "title": "Response List Oauth Orgs Api V1 Workspaces  Workspace Id  Oauth Orgs  Provider  Get",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Oauth Orgs",
        "tags": [
          "workspaces"
        ]
      }
    },
    "/api/v1/workspaces/{workspace_id}/stats": {
      "get": {
        "description": "Aggregate statistics across every connected org in the workspace: repository and dependency counts, artifact orphan breakdowns, last scan summary, and the declaration-outcome breakdown.",
        "operationId": "get_workspace_stats_api_v1_workspaces__workspace_id__stats_get",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgStats"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Workspace Stats",
        "tags": [
          "workspaces"
        ]
      }
    },
    "/api/v1/workspaces/{workspace_id}/transfer": {
      "post": {
        "description": "Transfer ownership to another member. Caller is demoted to Admin; target is promoted to Owner.\n\nRequires session auth \u2014 API keys cannot transfer ownership (no user identity to demote).",
        "operationId": "transfer_ownership_api_v1_workspaces__workspace_id__transfer_post",
        "parameters": [
          {
            "in": "path",
            "name": "workspace_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Workspace Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Workspace-Id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Workspace-Id"
            }
          },
          {
            "in": "cookie",
            "name": "riftmap_access",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Riftmap Access"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransferOwnershipBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Transfer Ownership Api V1 Workspaces  Workspace Id  Transfer Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Transfer Ownership",
        "tags": [
          "workspaces"
        ]
      }
    },
    "/health": {
      "get": {
        "description": "Liveness probe \u2014 always returns 200 if the process is up.\n\nSuitable for Railway / Docker HEALTHCHECK and load-balancer pings.\nDoes not perform any subsystem checks so it never leaks internal\nhostnames, DSN fragments, or exception details.  Use /health/detailed\n(admin-gated) for rich subsystem diagnostics, or /ready (public)\nfor a strict ready-to-serve check.",
        "operationId": "health_health_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Health",
        "tags": [
          "meta"
        ]
      }
    },
    "/health/detailed": {
      "get": {
        "description": "Detailed subsystem health \u2014 requires admin API key (X-API-Key header).\n\nVerifies database, Redis broker, Redis state, Celery workers, Redis\nmemory pressure, and clone-directory disk space.  Rich exception details\nare written to the application log at WARN/ERROR level and are NOT\nincluded in the HTTP response body \u2014 the body only carries \"ok\",\n\"warning: <summary>\", or \"degraded\" per subsystem.",
        "operationId": "health_detailed_health_detailed_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          }
        ],
        "summary": "Health Detailed",
        "tags": [
          "meta"
        ]
      }
    },
    "/ready": {
      "get": {
        "description": "Readiness probe \u2014 public, unauthenticated.\n\nReturns 200 only when this API process can reach its own datastores:\nPostgres and both Redis DBs. Returns 503 with the failing subsystem\nnames ({\"status\": \"not_ready\", \"failed\": [...]}). Subsystem-level\n*detail* (hostnames, exceptions) is logged via structlog and never\nreturned in the body.\n\nDeliberately does **not** probe Celery workers. That leg was a Celery\n`inspect().ping()` \u2014 a broadcast RPC over the broker with a 2.5 s\nbudget \u2014 and it flapped: on 2026-08-20 it produced ten 503s in 19\nminutes, interleaved with 200s, while worker CPU sat at 0.2%. Worker\nliveness is covered twice over by signals that ask the workers\ndirectly: each worker service exposes its own /ready sidecar (broker\nreachability plus a 90 s Celery heartbeat, src/workers/healthcheck.py),\nand the `synthetic-probe` beat task runs every minute behind a Sentry\ncron monitor. `/health/detailed` still reports worker status for\non-demand diagnosis.\n\nIntended for Betterstack / external monitoring. **Do not** wire this\nas Railway's container healthcheck \u2014 a 30 s Redis blip would restart\nthe API. See docs/deployment/external-monitoring.md.",
        "operationId": "ready_ready_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Ready",
        "tags": [
          "meta"
        ]
      }
    }
  }
}
