https://api.psxlens.com/mcp/portfolioClaude: Settings → Connectors → Add custom connector → paste → Connect. ChatGPT: Settings → Apps & Connectors → Advanced → turn on Developer mode → Create, paste this URL, keep OAuth. Your AI then opens a PSX Lens page: sign in with Google and tap Allow. That's it.
claude mcp add --transport http psxlens https://api.psxlens.com/mcp/portfolioThe last one is for Claude Code (terminal).
For agents that call web APIs themselves. A normal chat can't use a pasted key: add the connector in step 1 instead. Anyone holding the key can change your records (never move money), so paste it only where you trust.
PSX Lens is a free Pakistan Stock Exchange data API. It serves delayed prices for every listed security, dividend history with the book closure dates that decide eligibility, annual and quarterly financials, sector valuations, a full-market screener, technical indicators, and portfolio endpoints for your own holdings. There is no paid tier and no feature held back.
GET /v1/search?q=Find a PSX ticker from a company name.GET /v1/stocks/{symbol}Everything about one company in one call: quote, profile, ratios, peers, dividends, financials, technicals, market cap and the 52-week range.GET /v1/quotes/{symbol}Delayed price, day range, volume and corporate-action state.GET /v1/prices/{symbol}?range=1YDaily closes for a named window, with that window's high, low and change.GET /v1/dividends/{symbol}Payout history by fiscal year, trailing DPS and yield.GET /v1/calendar/dividendsEvery announced payout still open, with the last day to buy and still receive it.GET /v1/financials/{symbol}Annual and quarterly income statement.GET /v1/screenerFilter the whole market by yield, P/E, market cap, drawdown and liquidity.GET /v1/compare?symbols=Companies side by side; two symbols return a scored head-to-head.GET /v1/market/boardIndices, breadth, gainers, losers and sector performance.GET /v1/sectors/boardEvery sector with median P/E, yield and constituents.GET /v1/me/holdingsYour own portfolio, with an API key you create below.| Endpoint | What it returns |
|---|---|
GET /v1/search?q= | Find a PSX ticker from a company name. |
GET /v1/stocks/{symbol} | Everything about one company in one call: quote, profile, ratios, peers, dividends, financials, technicals, market cap and the 52-week range. |
GET /v1/quotes/{symbol} | Delayed price, day range, volume and corporate-action state. |
GET /v1/prices/{symbol}?range=1Y | Daily closes for a named window, with that window's high, low and change. |
GET /v1/dividends/{symbol} | Payout history by fiscal year, trailing DPS and yield. |
GET /v1/calendar/dividends | Every announced payout still open, with the last day to buy and still receive it. |
GET /v1/financials/{symbol} | Annual and quarterly income statement. |
GET /v1/screener | Filter the whole market by yield, P/E, market cap, drawdown and liquidity. |
GET /v1/compare?symbols= | Companies side by side; two symbols return a scored head-to-head. |
GET /v1/market/board | Indices, breadth, gainers, losers and sector performance. |
GET /v1/sectors/board | Every sector with median P/E, yield and constituents. |
GET /v1/me/holdings | Your own portfolio, with an API key you create below. |
Full reference at api.psxlens.com/docs · machine-readable spec at /openapi.json · build an app with Sign in with PSX Lens · developer portal · MCP server at /mcp
Checking your session…
Paste this into Claude, ChatGPT or any assistant that can make web requests, then give it your key when it asks. It describes where the data lives and how to authenticate.
You can use the PSX Lens API for Pakistan Stock Exchange data.
Base URL: https://api.psxlens.com
Auth: send the header Authorization: Bearer <MY_KEY>
Tool list: https://api.psxlens.com/v1/ai/tools
OpenAPI spec: https://api.psxlens.com/openapi.json
Useful endpoints:
GET /v1/quotes/{symbol} delayed price for one symbol
GET /v1/companies/{symbol} profile, shares outstanding, auditor
GET /v1/financials/{symbol} annual and quarterly income statement
GET /v1/dividends/{symbol} payout history
GET /v1/calendar/dividends upcoming payouts and who is still eligible
GET /v1/stocks/{symbol} everything on one company in one call:
profile, quote, ratios, peers, sector
medians, dividends, technicals, and a
"derived" block with market cap, the
52-week range, circuit breaker bounds,
margins and growth
GET /v1/compare?symbols=ABL,MEBL side by side; two symbols adds a scored
head-to-head with a winner per measure
GET /v1/screener?dividend_yield_min=5&pe_max=10
GET /v1/me/portfolio my holdings (only if the key allows it)
Quotes are delayed at source by regulation. A blank field means unknown, never zero.
Prices are not adjusted for bonus issues or splits.Treat the key like a password. Pasting it into an assistant hands it to that provider, so use a key without portfolio access unless you specifically want your holdings read, and revoke anything you stop using.
Market and company endpoints are open, so you can check the API answers before wiring anything up. A key is only needed for your own portfolio.
curl https://api.psxlens.com/v1/quotes/ABL curl -H "Authorization: Bearer pl_live_..." \ https://api.psxlens.com/v1/me/portfolio
Yes. Every market, company, dividend, screening and comparison endpoint is free and needs no key. Only endpoints that read your own portfolio require one, and creating a key is free too. There is no paid tier.
No. Prices, dividends, financials, screening and comparison are open. Send a request and you get JSON. A key is only needed for your own portfolio.
No, and nothing here claims otherwise. PSX delays its public feed at source, so quotes are delayed and every response labels them as such.
Yes. There is an MCP server at https://api.psxlens.com/mcp exposing typed tools, so an assistant can search symbols, read a company, compare two, screen the market and check dividend eligibility without being told URLs.
Balance sheet lines are absent for every company, because PSX publishes them only inside audited filing PDFs, so return on equity, price to book and debt to equity cannot be computed. There is no Shariah screening and no index history. Missing fields are returned as null, never as zero.
A key is a password. Anyone who has it can read whatever you granted it, and pasting it into an assistant hands it to that provider. Create separate keys so you can revoke one without breaking the others, and revoke anything you stop using.
Nothing here connects to a broker. A key can edit your own book of record if you grant it that, but it cannot place an order or move money anywhere.