freeagent_create_mileage_expense
Create a mileage expense in FreeAgent by providing journey details, origin/destination or manual miles, and optional rate. Supports round trips and HMRC threshold logic for automated mileage rates.
Instructions
Create a mileage expense in FreeAgent. Provide either origin + destination (requires ORS_API_KEY or GOOGLE_MAPS_API_KEY for distance lookup) or manualMiles for the journey distance. Set roundTrip=true to double the distance.
Rate: pass ratePence to set the per-mile rate explicitly (e.g. 45 for 45p/mile). If omitted, defaults to the MILEAGE_RATE_PENCE env var, or HMRC approved rates (configurable via HMRC_RATE_HIGH_PENCE / HMRC_RATE_LOW_PENCE / HMRC_THRESHOLD_MILES env vars, defaulting to 45p/25p at 10,000 miles — pass cumulativeMilesYTD to enable threshold logic).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| datedOn | Yes | Journey date YYYY-MM-DD | |
| description | Yes | Journey description (e.g. 'Wakefield to Ackworth TT Club, coaching session') | |
| origin | No | Origin address. Requires distance API key. Omit if providing manualMiles. | |
| destination | No | Destination address. Requires distance API key. Omit if providing manualMiles. | |
| manualMiles | No | Journey distance in miles (use instead of origin/destination) | |
| roundTrip | No | Double the distance for a return journey | |
| ratePence | No | Pence per mile (e.g. 45). If omitted, uses MILEAGE_RATE_PENCE env var or HMRC rates (configurable via env vars, defaults to 45p/25p with threshold logic). | |
| cumulativeMilesYTD | No | Cumulative business miles already claimed this tax year. Used for HMRC threshold logic (high rate → low rate at threshold). Only relevant when ratePence is not set. | |
| currency | No | ISO 4217 currency code (default GBP) | GBP |