API
Pro plan · read-only export of your own trades.
What this is
Your trades, in a Google Sheet, updated whenever you want. Included with Pro. No spreadsheet formulas to maintain and no re-typing — the sheet pulls straight from your journal.
If you just want your trades in a spreadsheet once, you do not need any of this: use the CSV export inside the app. This page is for keeping a sheet that refreshes.
Put your trades in a Google Sheet
- In the app, open the 🔑 API Tokens panel. Give the token a name — anything, for example
Sheets— and choose Generate New Token. Copy it somewhere safe immediately. It is shown once and cannot be recovered afterwards. If you lose it, revoke it and make another. - Open a new Google Sheet.
- In the menu, choose Extensions → Apps Script. A code editor opens in a new tab.
- Delete whatever is already in that editor, and paste this in its place:
function pullTrades() { var TOKEN = "oih_paste_your_token_here"; var res = UrlFetchApp.fetch( "https://optionsincomeharvester.com/api/v1/trades/export", { headers: { Authorization: "Bearer " + TOKEN, Accept: "text/csv" } } ); var rows = Utilities.parseCsv(res.getContentText()); var sheet = SpreadsheetApp.getActiveSheet(); sheet.clear(); sheet.getRange(1, 1, rows.length, rows[0].length).setValues(rows); } - Replace
oih_paste_your_token_herewith the token you copied. Keep the quotation marks around it. - Click the save icon, then Run.
- The first time only, Google asks for permission. Choose your account, then Advanced, then "Go to Untitled project (unsafe)", then Allow. This is Google asking whether you trust your own script — it says "unsafe" about every script that has not been through Google's review, including this one. It is your sheet talking to your account.
- Go back to the sheet. Your trades are in it.
To update it later, open Apps Script and click Run again. To have it update on its own, in Apps
Script choose Triggers (the clock icon), Add Trigger, function pullTrades, event source
Time-driven, and pick how often.
If it does not work
- "Missing Authorization" or "Invalid or revoked token" — the token is wrong, or the quotation marks around it were deleted. Generate a fresh one and paste it again.
- The sheet fills with one long column instead of a table — the
Accept: "text/csv"line was changed or removed. - Nothing happens at all — the script was not saved before running, or the permission step in step 7 was not completed.
- "Rate limit exceeded" — more than 60 runs in an hour. Wait an hour.
Every field you get
One row per position, not per leg, which is how the journal stores it: a spread stays one line.
id · ticker · trade_type · entry_date · quantity · expiration_date · strike · premium · short_strike · long_strike · short_premium · long_premium · net_credit · status · exit_date · exit_price · notes · entry_fee · exit_fee · pl
Spreads, condors and butterflies use short_strike / long_strike and short_premium / long_premium; single-leg trades use strike and premium. pl is profit and loss net of entry_fee and exit_fee.
Keep your token private
For developers
GET https://optionsincomeharvester.com/api/v1/trades/export with header
Authorization: Bearer oih_...
Read-only, GET only, HTTPS only. Tokens are oih_ plus 64 hex characters and are stored
as a SHA-256 hash. Rate limit 60 requests per hour per token.
Accept: text/csv returns a CSV download; anything else returns JSON as
{ "as_of": "2026-09-17T14:05:00Z", "count": 128, "trades": [ ... ] }
Errors: 400 not HTTPS · 401 missing, malformed, invalid or revoked token, with a
WWW-Authenticate: Bearer header · 429 hourly rate limit exceeded.
curl example:
curl -H "Authorization: Bearer oih_your_token_here" \
https://optionsincomeharvester.com/api/v1/trades/export