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

  1. 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.
  2. Open a new Google Sheet.
  3. In the menu, choose Extensions → Apps Script. A code editor opens in a new tab.
  4. 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);
    }
  5. Replace oih_paste_your_token_here with the token you copied. Keep the quotation marks around it.
  6. Click the save icon, then Run.
  7. 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.
  8. 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

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

Anyone holding it can read your whole trade history. Treat it like a password: keep it out of shared spreadsheets, screenshots and public scripts, and revoke it if it is ever exposed.

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