{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-guides/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Authentication","description":"Authenticate to the Vanda API with an API key or a bearer token, configure the Python SDK, check your tier limits and handle error codes.","llmstxt":{"title":"Vanda API documentation","description":"Data on investor positioning, capital flows, retail activity and macroeconomics across global markets, available through a REST API, the vanda-api Python SDK, an MCP connector for AI assistants and Snowflake Marketplace.","details":{"content":"- Base URL: https://api.vanda-analytics.com. Authenticate with an API key in the `x-api-key` header, or a bearer token from POST /auth/basic.\n- Python SDK: `pip install vanda-api`, then `VandaClient()` reads VANDA_SDK_KEY (or VANDA_LOGIN_EMAIL and VANDA_PASSWORD) from the environment.\n- Find series through each API's /catalog endpoint first. Use series_label for Positioning, slug for Flow and series_id for Macro.\n- Positioning values are z-scores against each series' own history; crowded_long at +1.5 sigma or above, crowded_short at -1.5 sigma or below.\n- Flow units differ between series; read `unit` on every value and never combine different units.\n- Normalisation and transformations apply to one series per request.\n"},"sections":[{"title":"Get started","description":"Products, quickstart, authentication and the concepts needed to read the data correctly.","includeFiles":["guides/index.md","guides/quickstart.md","guides/authentication.md","guides/concepts.md","guides/ai.md"]},{"title":"API reference","description":"Every endpoint, parameter and response field of the public Vanda APIs.","includeFiles":["apis/positioning/vanda-msvc-positioning.json","apis/flow/vanda-msvc-flow.json","apis/macro/vanda-msvc-macro.json","apis/series/vanda-msvc-series.json","apis/aggregates/vanda-msvc-aggregates.json","apis/auth/vanda-msvc-auth.json"]},{"title":"AI assistants (Vanda MCP)","description":"Connect Claude, ChatGPT or another assistant to Vanda data and research.","includeFiles":["ai-assistants/index.md","ai-assistants/vandatrack.md","ai-assistants/vandaxasset.md","ai-assistants/vandainsights.md","ai-assistants/vandamacro.md"]},{"title":"Snowflake","description":"Vanda datasets on Snowflake Marketplace, with views, metrics and example SQL.","includeFiles":["snowflake/index.md","snowflake/us-equities-daily.md","snowflake/us-equities-intraday.md","snowflake/vandaxasset.md"]},{"title":"About","includeFiles":["release-notes.md","policy-of-independence.md"]}]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"authentication","__idx":0},"children":["Authentication"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Every Vanda API accepts the same two credentials. Both run under your own Vanda account, so you get exactly the data your subscription covers."]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Method"},"children":["Method"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Send on each request"},"children":["Send on each request"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Best for"},"children":["Best for"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["API key"]}," (recommended)"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["x-api-key: <key>"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Scripts, notebooks, scheduled jobs"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Bearer token"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Authorization: Bearer <token>"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Quick tests, or tools that only support bearer auth"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"api-keys","__idx":1},"children":["API keys"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Sign in to Vanda Analytics and open ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://www.vanda-analytics.com/tools/api-keys"},"children":["Tools → API keys"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Create a key. Give it a name you will recognise later, such as the project or machine it is for."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Copy the key straight away. ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["It is shown once"]}," and cannot be recovered."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Send it as the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["x-api-key"]}," header:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl https://api.vanda-analytics.com/positioning/users/me \\\n  -H \"x-api-key: $VANDA_SDK_KEY\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Keys last ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["90 days"]}," by default. Revoke a key on the same page as soon as you stop using it, or if it may have leaked. A key belongs to your user: it carries your entitlements and tier limits, and never widens them."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"bearer-tokens","__idx":2},"children":["Bearer tokens"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Exchange your Vanda Analytics email and password for a short-lived token:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X POST https://api.vanda-analytics.com/auth/basic \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"email\": \"you@yourfirm.com\", \"password\": \"your_password\"}'\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The response holds ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["access_token"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["token_type"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["expires_in"]}," (seconds). Send the token on each request until it expires, then request a new one:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl https://api.vanda-analytics.com/positioning/users/me \\\n  -H \"Authorization: Bearer $VANDA_API_TOKEN\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"python-sdk","__idx":3},"children":["Python SDK"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://pypi.org/project/vanda-api/"},"children":["vanda-api"]}," reads credentials from environment variables, so nothing sensitive sits in your code."]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Holds"},"children":["Holds"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["VANDA_SDK_KEY"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["An API key"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["VANDA_API_TOKEN"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["A bearer token"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["VANDA_LOGIN_EMAIL"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["VANDA_PASSWORD"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Your login; the SDK exchanges it for a token"]}]}]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"from vanda import VandaClient\n\nclient = VandaClient()                       # reads the variables above\nclient = VandaClient(sdk_key=\"your_api_key\")  # or pass a credential directly\n","lang":"python"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If more than one credential is set, the API key wins, then the token, then email and password. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AsyncVandaClient"]}," takes the same arguments."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"tiers-and-limits","__idx":4},"children":["Tiers and limits"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Your subscription tier sets three limits on each request:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Page size:"]}," the most records one page can return."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Series per request:"]}," how many series one call can ask for."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["History per request:"]}," how far back one call can reach. Split longer histories into several requests."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Check yours at any time:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl https://api.vanda-analytics.com/positioning/users/me \\\n  -H \"x-api-key: $VANDA_SDK_KEY\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A request over a limit is refused with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["429"]},". Full-history exports also need Data Licence access; ask your account manager."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"errors","__idx":5},"children":["Errors"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Status"},"children":["Status"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Meaning"},"children":["Meaning"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"What to do"},"children":["What to do"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["400"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["A filter or value the endpoint does not recognise"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Check the value against ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/catalog/facets"]}," or the reference"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["401"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Missing, invalid or expired credentials"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Check the header name; request a new token or create a new key"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["403"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Your account is not entitled to this data"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Ask your account manager about access"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["404"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["None of the identifiers matched a series"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Search the catalog for the right label or slug"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["422"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["A parameter is missing or has the wrong type"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The response body names the parameter"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["429"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The request is over a tier limit"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Narrow the date range, page size or series list"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When some identifiers match and others do not, Flow and Macro return what matched and list the rest under ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["unresolved"]},", so check it before treating a short result as complete. On Macro, a request where nothing matches returns no rows rather than ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["404"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"keep-credentials-safe","__idx":6},"children":["Keep credentials safe"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Store keys in environment variables or a secrets manager, never in code, notebooks you share, or version control."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Never paste a key or password into an AI assistant. Tell it which variable holds the key instead."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Use one key per project or machine, so you can revoke one without breaking the others."]}]}]},"headings":[{"value":"Authentication","id":"authentication","depth":1},{"value":"API keys","id":"api-keys","depth":2},{"value":"Bearer tokens","id":"bearer-tokens","depth":2},{"value":"Python SDK","id":"python-sdk","depth":2},{"value":"Tiers and limits","id":"tiers-and-limits","depth":2},{"value":"Errors","id":"errors","depth":2},{"value":"Keep credentials safe","id":"keep-credentials-safe","depth":2}],"frontmatter":{"seo":{"title":"Authentication","description":"Authenticate to the Vanda API with an API key or a bearer token, configure the Python SDK, check your tier limits and handle error codes."}},"lastModified":"2026-11-26T21:58:54.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/guides/authentication","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}