# x402stock Portfolio X-Ray

> x402stock Portfolio X-Ray is a paid API for AI agents from x402stock.xyz, paid per call via x402, $0.25/call, status unknown (last checked 2026-09-14).

Analyzes a portfolio of US stock tickers by returning pricing, sector concentration, diversification scores, market-cap distribution, and risk flags for a given set of holdings.

## Facts

- Endpoint: GET https://x402stock.xyz/api/v1/portfolio/xray
- Price: $0.25/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402stock-portfolio-x-ray-227e328a
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_pmqHPli1uJI2ORnIKAq9j

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability x402stock-portfolio-x-ray-227e328a
```

Example prompt: Can you run a portfolio x-ray on my three stocks — AAPL, MSFT, and NVDA — with equal weights, and tell me how diversified I am, which sectors I'm concentrated in, and which one moved the most today?

## When to prefer this

Use this endpoint when you need a holistic, multi-metric portfolio analysis (diversification, sector, market cap, risk flags, and performance) for a custom list of US stock tickers in a single call, rather than querying individual stock prices or metrics separately. Especially useful for AI agents that need structured, ready-to-interpret portfolio health summaries without building the analytics themselves.

## Known failure modes

- Invalid or unrecognized ticker symbols return partial data or errors for those holdings
- Weights string length or format mismatch with tickers list causes validation error
- Missing required 'tickers' query parameter returns 400 error
- Payment in USDC not provided or rejected results in 402 Payment Required
- Market data may be delayed or unavailable outside trading hours
- Truncated or malformed query parameters may cause schema validation failure

## How this service works

Risk x-ray for a whole watchlist or portfolio in one call. Pass `?tickers=AAPL,MSFT,NVDA` (up to 25; optional `?weights=`). Returns per-holding price, sector and cap, plus portfolio concentration (top-weight, Herfindahl, diversification score), sector concentration, market-cap distribution, weighted day performance and risk flags. Replaces dozens of per-holding calls. From x402stock

## Output

Returns a structured portfolio analysis including: each holding's current price, day change percent, sector, market cap, and weight; portfolio-level day change percent; sector concentration HHI and label; market cap bucket distribution (mega/large/mid/small/micro); diversification score; top3 weight concentration; best and worst performing tickers today; and a list of risk flags (e.g. sector_concentration, few_holdings). Also indicates whether equal or custom weighting was applied.

## Example request

```json
{
 "input": {
  "type": "http",
  "method": "GET",
  "queryParams": {
   "tickers": "AAPL,MSFT,NVDA"
  }
 }
}
```

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "$schema": "https://json-schema.org/draft/2020-12/schema",
     "required": [
      "tickers"
     ],
     "properties": {
      "tickers": {
       "type": "string",
       "minLength": 1
      },
      "weights": {
       "type": "string"
      }
     },
     "additionalProperties": false
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "$schema": "https://json-schema.org/draft/2020-12/schema",
     "required": [
      "source",
      "as_of",
      "holding_count",
      "weighting",
      "sections",
      "summary",
      "holdings",
      "disclaimer"
     ],
     "properties": {
      "as_of": {
       "type": "string"
      },
      "source": {
       "type": "string",
       "const": "x402stock"
      },
      "summary": {
       "type": "object",
       "required": [
        "day_change_percent",
        "sector_concentration",
        "market_cap_distribution",
        "concentration",
        "performance",
        "risk_flags"
       ],
       "properties": {
        "risk_flags": {
         "type": "array",
         "items": {
          "type": "string"
         }
        },
        "performance": {
         "type": "object",
         "required": [
          "best",
          "worst"
         ],
         "properties": {
          "best": {
           "anyOf": [
            {
             "type": "object",
             "required": [
              "ticker",
              "change_percent"
             ],
             "properties": {
              "ticker": {
               "type": "string"
              },
              "change_percent": {
               "anyOf": [
                {
                 "type": "number"
                },
                {
                 "type": "null"
                }
               ]
              }
             },
             "additionalProperties": false
            },
            {
        
… (truncated)
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "as_of": "2026-06-08T12:00:00.000Z",
  "source": "x402stock",
  "summary": {
   "risk_flags": [
    "sector_concentration",
    "few_holdings"
   ],
   "performance": {
    "best": {
     "ticker": "NVDA",
     "change_percent": 1.6
    },
    "worst": {
     "ticker": "AAPL",
     "change_percent": 0.2
    }
   },
   "concentration": {
    "hhi": 0.3333,
    "label": "moderate",
    "top_weight": 0.3333,
    "top3_weight": 1,
    "diversification_score": 66.7
   },
   "day_change_percent": 0.82,
   "sector_concentration": {
    "hhi": 0.56,
    "label": "high",
    "coverage": 1,
    "top_sectors": [
     {
      "sector": "Electronic Computers",
      "weight": 0.6667
     },
     {
      "sector": "Services-Prepackaged Software",
      "weight": 0.3333
     }
    ]
   },
   "market_cap_distribution": {
    "mid": 0,
    "mega": 1,
    "large": 0,
    "micro": 0,
    "small": 0,
    "unknown": 0
   }
  },
  "holdings": [
   {
    "name": "Apple Inc.",
    "price": 205.4,
    "sector": "Electronic Computers",
    "ticker": "AAPL",
    "weight": 0.3333,
    "cap_bucket": "mega",
    "market_cap": 3100000000000,
    "change_percent": 0.2
   },
   {
    "name": "Microsoft Corp",
    "price": 462.1,
    "sector": "Services-Prepackaged Software",
    "ticker": "MSFT",
    "weight": 0.3333,
    "cap_bucket": "mega",
    "market_cap": 3400000000000,
    "change_percent": 0.7
   },
   {
    "name": "NVIDIA Corp",
    "price": 138.9,
    "sector": "Electronic Computers",
    "ticker": "NVDA",
    "weight": 0.3333,
    "cap_bucket": "mega",
    "market_cap": 3300000000000,
    "change_percent": 1.6
   }
  ],
  "sections": {
   "prices": "ok",
   "profiles": "ok"
  },
  "weighting": "equal",
  "disclaimer": "Factual quantitative analysis, not investment advice. Inputs are delayed/periodic; verify before acting.",
  "holding_count": 3
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x402stock-portfolio-x-ray-227e328a/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402stock.xyz](https://www.zero.xyz/host/x402stock.xyz/llms.txt)
