# pnljournal > pnljournal is an agentic trading journal. Traders record each closed trade (ticker, the date and time it was opened and closed, and realized P&L), either themselves or through their AI agent, and review P&L day by day. They can also write down their trading strategies for their agent to read. People use the website: they sign in with a 6-digit code sent to their email, log and review trades on the dashboard (https://www.pnljournal.com/dashboard), and create an API key on the Account page (https://www.pnljournal.com/account). Agents act for one user through that API key, over MCP or a REST API. Everything an agent needs is on this page. ## Authentication Every request needs an API key. Create, reset or delete it on the Account page (https://www.pnljournal.com/account) and send it in the `Authorization` header. Keys start with `pnl_`. ``` Authorization: Bearer YOUR_KEY ``` A missing or invalid key gets a `401`. Treat the key like a password: anyone with it can read and change the account's trades. ## MCP server AI agents that support MCP can use tools instead of the REST API. - URL: `https://www.pnljournal.com/api/mcp` (Streamable HTTP, stateless; supports the 2026-07-28 and 2025 protocol revisions) - Header: `Authorization: Bearer YOUR_KEY` - Tools: - `log_trade`: record a closed trade, with the same fields as `POST /trades` - `list_trades`: a day's trades (default today) and total P&L per currency, each with an id - `delete_trade`: delete one of the account's trades by id - `get_account`: the account's email, saved time zone, and today's date in it - `list_strategies`: the account's strategies (id, name, last updated), by name - `get_strategy`: one strategy in full, by `name` (ignoring case) or `id` ## REST API Base URL: `https://www.pnljournal.com/api/v1`. The OpenAPI 3.1 spec is at https://www.pnljournal.com/api/v1/openapi.json. Responses are never cached. ### Log a trade `POST /api/v1/trades` with a JSON body of the trade fields below. Returns `201` with `{ "trade": { "id", "ticker", "opened_at", "closed_at", "pnl", "pnl_currency", "thesis" } }`. ```sh curl -X POST https://www.pnljournal.com/api/v1/trades \ -H "Authorization: Bearer YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{"ticker":"AAPL","opened_at":"2026-11-19T09:31:00-05:00","closed_at":"2026-11-19T10:02:00-05:00","pnl":125.5}' ``` ### List a day's trades `GET /api/v1/trades?date=YYYY-MM-DD&time_zone=America/New_York` returns the trades that closed on `date` (default today) in `time_zone` (default the account's saved time zone, else UTC), oldest first: `{ "date", "time_zone", "total_pnl": { "USD", "SOL" }, "trades": [...] }`. ```sh curl "https://www.pnljournal.com/api/v1/trades?date=2026-11-19&time_zone=America/New_York" \ -H "Authorization: Bearer YOUR_KEY" ``` ### Delete a trade `DELETE /api/v1/trades/{id}` returns `204`, or `404` if the account has no trade with that id. ```sh curl -X DELETE https://www.pnljournal.com/api/v1/trades/TRADE_ID \ -H "Authorization: Bearer YOUR_KEY" ``` ### Check a key `GET /api/v1/me` returns `{ "email", "time_zone" }` for the key's owner. ```sh curl https://www.pnljournal.com/api/v1/me \ -H "Authorization: Bearer YOUR_KEY" ``` ### List strategies `GET /api/v1/strategies` returns the account's strategies, sorted by name: `{ "strategies": [{ "id", "name", "updated_at" }] }`. ```sh curl https://www.pnljournal.com/api/v1/strategies \ -H "Authorization: Bearer YOUR_KEY" ``` ### Get a strategy `GET /api/v1/strategies/{id}` returns `{ "strategy": { "id", "name", "body", "created_at", "updated_at" } }`, or `404` if the account has no strategy with that id. ```sh curl https://www.pnljournal.com/api/v1/strategies/STRATEGY_ID \ -H "Authorization: Bearer YOUR_KEY" ``` ## Trade fields - `ticker`: 1–15 characters from A–Z, 0–9 and `. / ^ = -`, like `AAPL`. Stored uppercase. - `opened_at`, `closed_at`: ISO 8601 date and time. With a UTC offset (`2026-11-19T09:31:00-05:00` or `2026-11-19T14:31:00Z`) the time is exact. Without one (`2026-11-19T09:31`) it's read in `time_zone`, else the account's saved time zone; if there's neither, the request is rejected. `closed_at` can't be before `opened_at` or in the future. - `pnl`: realized profit or loss in `pnl_currency`, negative for a loss, like `125.5` or `-40`. At most 2 decimals for USD and 9 for SOL (under 1,000,000 SOL). - `pnl_currency` (optional): `"USD"` (the default) or `"SOL"`. A day's totals are kept per currency; SOL is never converted to dollars. - `thesis` (optional): why the trade was taken, in the trader's own words, up to 2,000 characters. A blank thesis is saved as `null`. - `time_zone` (optional): an IANA time zone, like `America/New_York`, for times without a UTC offset. A trade belongs to the day it closed in the time zone being viewed. ## Strategies Strategies are written on the Strategies page (https://www.pnljournal.com/strategies). Each has a `name`, unique per account ignoring case and up to 100 characters, and a `body`: how the trader runs the setup, in their own words, up to 20,000 characters. Agents can read strategies but not change them. ## Errors Errors come back as JSON with a `400`, `401` or `404` status. The message says what to fix. ```json { "error": { "code": "invalid_request", "message": "…" } } ``` Codes: `invalid_json`, `invalid_request`, `unauthorized`, `not_found`. ## Guidance for agents - Use the user's API key; it's the only credential meant for agents. Never ask the user for their email sign-in code. - Start with `get_account` (MCP) or `GET /me` (REST) to learn the user's time zone and today's date, and use that zone's UTC offset in the times you send. - If the ticker, either time, or the P&L is missing or unclear, ask the user instead of guessing. Log the P&L in the currency the user gives it in (dollars or SOL); don't convert it. - If the user says why they took a trade, save it as `thesis` in their words. Don't write a thesis for them. - After logging, tell the user what you saved. To fix a mistake, delete the trade and log it again. - When the user mentions one of their strategies ("my breakout strategy"), read it with `get_strategy` (MCP) or `GET /strategies` then `GET /strategies/{id}` (REST) before answering, and judge trades against what it actually says. If no name matches, list the strategies and ask which one they mean. Don't invent rules the strategy doesn't state. - To import trades from Robinhood, the user connects Robinhood's MCP server (https://agent.robinhood.com/mcp/trading, Streamable HTTP, signed in with the user's Robinhood account) to the same agent. Read the user's closed trades there and log them here. Only read from Robinhood: never place, change or cancel orders. Check `list_trades` for each day first so no trade is logged twice, and log options under the underlying ticker. ## Links - [API docs](https://www.pnljournal.com/docs/api): this reference as a web page - [Dashboard](https://www.pnljournal.com/dashboard): where people log and review trades - [Account](https://www.pnljournal.com/account): API key and connection instructions - [Strategies](https://www.pnljournal.com/strategies): where people write their strategies - [OpenAPI spec](https://www.pnljournal.com/api/v1/openapi.json): the REST API, machine-readable