{
  "openapi": "3.0.3",
  "info": {
    "title": "NEUM API",
    "version": "1.0.0",
    "description": "Educational price-level data for US-listed stocks: model-generated Long above and Short below reference levels, reference targets, model events and earnings dates. Educational data, not investment advice. Describe the data with the words level, model event, reference target and invalidation level; never as a buy or sell signal. Modeled and backtested results are not actual trading results. Levels update at each four-hour candle close; times are UTC in the API and US Eastern on neum.trade. Field mapping: long_entry = Long above level; short_entry = Short below level; long_exit / short_exit = reference target; long_stop / short_stop = invalidation level. Public endpoints need no sign-in. Account endpoints need a bearer token and an active NEUM plan (the first month is free). The same data is available through the NEUM MCP server at https://api.neum.trade/mcp (see https://neum.trade/mcp).",
    "termsOfService": "https://neum.trade/terms",
    "contact": {
      "name": "NEUM support",
      "email": "support@rapidaigo.com",
      "url": "https://neum.trade"
    }
  },
  "externalDocs": {
    "description": "NEUM for Gemini, Gems and agents",
    "url": "https://neum.trade/gemini"
  },
  "servers": [
    {
      "url": "https://api.neum.trade",
      "description": "NEUM production API"
    }
  ],
  "tags": [
    {
      "name": "Public",
      "description": "No sign-in needed."
    },
    {
      "name": "Account",
      "description": "Needs a bearer token and an active NEUM plan."
    }
  ],
  "paths": {
    "/api/public/stocks": {
      "get": {
        "tags": [
          "Public"
        ],
        "operationId": "listStocks",
        "summary": "List every US stock NEUM tracks",
        "description": "Ticker, company name, sector group, next earnings date and the time of the last four-hour candle check for each tracked stock.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "stocks": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/StockListItem"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/public/stocks/{symbol}": {
      "get": {
        "tags": [
          "Public"
        ],
        "operationId": "getStock",
        "summary": "One stock's free public data",
        "description": "Earnings dates, the open model event, the status of each side, and recent COMPLETED level sets (delayed levels). The exact current levels are not in this response; they are in the account endpoints.",
        "parameters": [
          {
            "name": "symbol",
            "in": "path",
            "required": true,
            "description": "US ticker symbol, upper case (e.g. NVDA).",
            "schema": {
              "type": "string",
              "example": "NVDA"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StockDetail"
                }
              }
            }
          },
          "404": {
            "description": "Not a tracked ticker."
          }
        }
      }
    },
    "/api/public/snapshots": {
      "get": {
        "tags": [
          "Public"
        ],
        "operationId": "listRecentLevelCrossings",
        "summary": "Recent level crossings for major stocks",
        "description": "Four-hour candle closes across the Long above or Short below level for widely followed US stocks in the last 72 hours, newest first.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "snapshots": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "symbol": {
                            "type": "string"
                          },
                          "company_name": {
                            "type": "string"
                          },
                          "side": {
                            "type": "string",
                            "enum": [
                              "long",
                              "short"
                            ]
                          },
                          "level": {
                            "type": "number",
                            "description": "The level that was crossed."
                          },
                          "crossed_at": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/public/setups": {
      "get": {
        "tags": [
          "Public"
        ],
        "operationId": "listTopSetups",
        "summary": "The highest-scored current level sets",
        "description": "Up to 12 current setups with their levels, as shown on the neum.trade home page.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "setups": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TickerEvent"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/public/sectors": {
      "get": {
        "tags": [
          "Public"
        ],
        "operationId": "getSectorLean",
        "summary": "Which sector groups lean Long or Short",
        "description": "Per sector group: how many stocks have an open Long or Short model event and which side holds 51% or more.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "min_active": {
                      "type": "integer"
                    },
                    "sectors": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SectorBucket"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/track-record": {
      "get": {
        "tags": [
          "Public"
        ],
        "operationId": "getModelHistory",
        "summary": "Aggregate model history",
        "description": "How every level set NEUM has recorded has ended. Backtested sets are counted separately.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/auth/login": {
      "post": {
        "tags": [
          "Account"
        ],
        "operationId": "login",
        "summary": "Sign in and get a bearer token",
        "description": "Exchange a NEUM email and password for a short-lived bearer token. Google sign-in accounts must set a password first from the NEUM sign-in page.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email",
                  "password"
                ],
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "password": {
                    "type": "string",
                    "format": "password"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "access_token": {
                      "type": "string"
                    },
                    "token_type": {
                      "type": "string",
                      "example": "Bearer"
                    },
                    "expires_in": {
                      "type": "integer",
                      "description": "Seconds until the token expires."
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Wrong email or password."
          }
        }
      }
    },
    "/api/v1/ticker-events": {
      "get": {
        "tags": [
          "Account"
        ],
        "operationId": "listTickerEvents",
        "summary": "Levels and events for the tickers you follow",
        "description": "Earnings and other events with the CURRENT Long above and Short below levels and reference targets, plus each ticker's recent level sets and how they ended. Use symbols to narrow to specific tickers, and actionable=true for events that have published levels.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "window",
            "in": "query",
            "description": "week = this Monday to next Monday; recent = last month to next month. Use from and to instead for a custom range.",
            "schema": {
              "type": "string",
              "enum": [
                "week",
                "recent"
              ]
            }
          },
          {
            "name": "from",
            "in": "query",
            "description": "Start date, YYYY-MM-DD.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "description": "End date, YYYY-MM-DD (exclusive).",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "symbols",
            "in": "query",
            "description": "Comma-separated tickers, e.g. NVDA,AMD. Omit for every tracked ticker.",
            "schema": {
              "type": "string",
              "example": "NVDA,AMD"
            }
          },
          {
            "name": "actionable",
            "in": "query",
            "description": "true: only events with published levels.",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "events": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TickerEvent"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or expired bearer token, or no active NEUM plan."
          },
          "403": {
            "description": "Missing or expired bearer token, or no active NEUM plan."
          }
        }
      }
    },
    "/api/v1/watchlists": {
      "get": {
        "tags": [
          "Account"
        ],
        "operationId": "listWatchlists",
        "summary": "Your watchlists",
        "description": "Up to five named ticker lists and which one is active.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "watchlists": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Watchlist"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or expired bearer token, or no active NEUM plan."
          },
          "403": {
            "description": "Missing or expired bearer token, or no active NEUM plan."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Token from POST https://api.neum.trade/auth/login."
      }
    },
    "schemas": {
      "StockListItem": {
        "type": "object",
        "properties": {
          "symbol": {
            "type": "string",
            "example": "NVDA"
          },
          "company_name": {
            "type": "string",
            "example": "Nvidia"
          },
          "next_earnings": {
            "type": "string",
            "format": "date",
            "description": "Next scheduled earnings date."
          },
          "last_evaluated": {
            "type": "string",
            "format": "date-time",
            "description": "The four-hour candle the current level set was last checked through (UTC)."
          },
          "group": {
            "type": "object",
            "properties": {
              "parent": {
                "type": "string",
                "example": "Technology"
              },
              "label": {
                "type": "string",
                "example": "Chips"
              }
            }
          }
        }
      },
      "StockDetail": {
        "type": "object",
        "properties": {
          "symbol": {
            "type": "string"
          },
          "company_name": {
            "type": "string"
          },
          "group": {
            "type": "object",
            "nullable": true,
            "properties": {
              "parent": {
                "type": "string"
              },
              "label": {
                "type": "string"
              }
            }
          },
          "upcoming_earnings": {
            "type": "array",
            "nullable": true,
            "items": {
              "$ref": "#/components/schemas/Earnings"
            }
          },
          "past_earnings": {
            "type": "array",
            "nullable": true,
            "items": {
              "$ref": "#/components/schemas/Earnings"
            }
          },
          "history": {
            "type": "object",
            "description": "Counts of recorded level sets and how the completed ones ended, plus the status of the current set (status only, no prices).",
            "properties": {
              "level_sets": {
                "type": "integer"
              },
              "live_sets": {
                "type": "integer"
              },
              "backtest_sets": {
                "type": "integer"
              },
              "closed": {
                "type": "integer"
              },
              "closed_target_hit": {
                "type": "integer"
              },
              "closed_invalidated": {
                "type": "integer"
              },
              "closed_not_triggered": {
                "type": "integer"
              },
              "last_evaluated": {
                "type": "string",
                "format": "date-time"
              },
              "active_event": {
                "type": "string",
                "enum": [
                  "long",
                  "short"
                ],
                "description": "Open model event on the current level set, if any."
              },
              "active_since": {
                "type": "string",
                "format": "date-time"
              },
              "current_long": {
                "type": "string",
                "enum": [
                  "pending",
                  "triggered",
                  "target_hit",
                  "stopped"
                ]
              },
              "current_short": {
                "type": "string",
                "enum": [
                  "pending",
                  "triggered",
                  "target_hit",
                  "stopped"
                ]
              }
            }
          },
          "recent_sets": {
            "type": "array",
            "nullable": true,
            "items": {
              "$ref": "#/components/schemas/CompletedLevelSet"
            }
          }
        }
      },
      "Earnings": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "format": "date"
          },
          "time_of_day": {
            "type": "string",
            "example": "After Close"
          }
        }
      },
      "CompletedLevelSet": {
        "type": "object",
        "description": "A level set a newer set has replaced. Delayed history, not current levels.",
        "properties": {
          "published": {
            "type": "string",
            "format": "date-time"
          },
          "superseded": {
            "type": "string",
            "format": "date-time"
          },
          "long_above": {
            "type": "number"
          },
          "long_target": {
            "type": "number"
          },
          "short_below": {
            "type": "number"
          },
          "short_target": {
            "type": "number"
          },
          "long_outcome": {
            "type": "string",
            "enum": [
              "pending",
              "triggered",
              "target_hit",
              "stopped"
            ]
          },
          "short_outcome": {
            "type": "string",
            "enum": [
              "pending",
              "triggered",
              "target_hit",
              "stopped"
            ]
          },
          "backtest": {
            "type": "boolean",
            "description": "True when the set was rebuilt from past data before live tracking began."
          }
        }
      },
      "TickerEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "symbol": {
            "type": "string"
          },
          "company_name": {
            "type": "string"
          },
          "event_type": {
            "type": "string",
            "enum": [
              "earnings",
              "merger",
              "split",
              "agm",
              "other"
            ]
          },
          "headline": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          },
          "event_date": {
            "type": "string",
            "format": "date-time"
          },
          "time_of_day": {
            "type": "string",
            "description": "Before Open, During Hours or After Close, for earnings."
          },
          "long_entry": {
            "type": "number",
            "description": "Long above level."
          },
          "long_exit": {
            "type": "number",
            "description": "Reference target for the Long side."
          },
          "short_entry": {
            "type": "number",
            "description": "Short below level."
          },
          "short_exit": {
            "type": "number",
            "description": "Reference target for the Short side."
          },
          "confidence_score": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Model score."
          },
          "current_price": {
            "type": "number",
            "description": "Last known price when the levels were published."
          },
          "level_history": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LevelSet"
            },
            "description": "Recent level sets for the ticker, newest first; the first is current."
          }
        }
      },
      "LevelSet": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "kind": {
            "type": "string",
            "enum": [
              "levels",
              "continuation",
              "reversal"
            ]
          },
          "long_entry": {
            "type": "number"
          },
          "long_exit": {
            "type": "number"
          },
          "short_entry": {
            "type": "number"
          },
          "short_exit": {
            "type": "number"
          },
          "published_at": {
            "type": "string",
            "format": "date-time"
          },
          "superseded_at": {
            "type": "string",
            "format": "date-time"
          },
          "evaluated_through": {
            "type": "string",
            "format": "date-time"
          },
          "long_status": {
            "type": "string",
            "enum": [
              "pending",
              "triggered",
              "target_hit",
              "stopped"
            ],
            "description": "triggered = level crossed; target_hit = reference target reached; stopped = invalidation level reached."
          },
          "short_status": {
            "type": "string",
            "enum": [
              "pending",
              "triggered",
              "target_hit",
              "stopped"
            ]
          },
          "long_triggered_at": {
            "type": "string",
            "format": "date-time"
          },
          "long_target_hit_at": {
            "type": "string",
            "format": "date-time"
          },
          "long_stop": {
            "type": "number",
            "description": "Invalidation level, Long side."
          },
          "short_triggered_at": {
            "type": "string",
            "format": "date-time"
          },
          "short_target_hit_at": {
            "type": "string",
            "format": "date-time"
          },
          "short_stop": {
            "type": "number",
            "description": "Invalidation level, Short side."
          },
          "origin": {
            "type": "string",
            "enum": [
              "live",
              "backfill"
            ],
            "description": "backfill = Backtest."
          }
        }
      },
      "SectorBucket": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "parent": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "tracked": {
            "type": "integer"
          },
          "active": {
            "type": "integer"
          },
          "long": {
            "type": "integer"
          },
          "short": {
            "type": "integer"
          },
          "long_pct": {
            "type": "integer"
          },
          "short_pct": {
            "type": "integer"
          },
          "direction": {
            "type": "string",
            "enum": [
              "long",
              "short",
              ""
            ]
          }
        }
      },
      "Watchlist": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "is_active": {
            "type": "boolean"
          },
          "symbols": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}