Capital Gains

Log a capital-gains trade

Records a buy/sell with FIFO/LIFO/Specific-ID cost basis. Wash-sale detection runs automatically (api/_lib/wash-sale.js). Also discoverable via x402 (POST without auth + X-PAYMENT header returns a preview without writing).

post/api/v1/trades

Request

  • Base URL: https://www.agenttax.io
  • URL: https://www.agenttax.io/api/v1/trades
  • Auth: one of:
    • HTTP bearer
    • API key in header X-PAYMENT

Request body

asset_symbolstring required

Asset ticker — equity (AAPL), crypto (BTC), or token (COMPUTE-TOKEN). Auto-uppercased.

trade_type'buy' | 'sell' required
quantitynumber required
price_per_unitnumber required
fee_amountnumber
trade_datestring date-time

ISO 8601 trade timestamp. Defaults to server time when omitted.

accounting_method'fifo' | 'lifo' | 'specific_id'
specific_lot_idstring nullable

Required when accounting_method='specific_id'. Identifies which cost-basis lot to consume.

asset_namestring
counterpartystring
exchangestring
notesstring
resident_state'AL' | 'AK' | 'AZ' | 'AR' | 'CA' | 'CO' | 'CT' | 'DE' | 'FL' | 'GA' | 'HI' | 'ID' | 'IL' | 'IN' | 'IA' | 'KS' | 'KY' | 'LA' | 'ME' | 'MD' | 'MA' | 'MI' | 'MN' | 'MS' | 'MO' | 'MT' | 'NE' | 'NV' | 'NH' | 'NJ' | 'NM' | 'NY' | 'NC' | 'ND' | 'OH' | 'OK' | 'OR' | 'PA' | 'RI' | 'SC' | 'SD' | 'TN' | 'TX' | 'UT' | 'VT' | 'VA' | 'WA' | 'WV' | 'WI' | 'WY' | 'DC'

Two-letter resident state code used for state capital-gains estimation.

tax_entity_type'individual' | 'c_corp' | 'pass_through'

Entity classification for federal estimation.

filing_status'single' | 'mfj' | 'mfs' | 'hoh'

Federal filing status used to pick the income-tax / LT-capital-gains bracket.

estimated_annual_incomenumber

Estimated annual income; enables bracket-aware federal estimation and NIIT detection.

asset_class'stock' | 'security' | 'securities' | 'equity' | 'digital_asset' | 'crypto'

Opt into IRC §1091 wash-sale tracking. 'stock'/'security'/'securities'/'equity' enable detection; 'digital_asset'/'crypto'/omitted disable it (digital assets are not subject to §1091 under current Treasury guidance).

Response

Trade logged with realized gain/loss if SELL.

Changes

No recorded changes to this operation across all 1 revision of this API.