Use when handling Navan API changes in production — defensive coding patterns, schema validation, deprecation monitoring, and gradual rollout strategies for unversioned APIs.
Trigger with "navan upgrade migration" or "navan api change handling".
Use when handling Navan API changes in production — defensive coding patterns, schema validation, deprecation monitoring, and gradual rollout strategies for unversioned APIs.
Trigger with "navan upgrade migration" or "navan api change handling".
allowed-tools
Read, Write, Edit, Bash(curl:*), Bash(jq:*), Grep
version
1.7.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
["saas","navan","travel"]
compatibility
Designed for Claude Code
Navan Upgrade Migration
Overview
Defensive patterns for maintaining Navan API integrations over time. Navan does not publicly version their API, publish a changelog, or guarantee backward compatibility. Every API response should be treated as potentially different from the last.
Prerequisites
Existing Navan API integration in production
OAuth credentials (client_id, client_secret) stored in a secret manager
Baseline API response snapshots for comparison (see Step 1)
curl, jq, and diff for schema comparison
Instructions
Step 1 — Capture Response Baselines
Store known-good API responses as reference schemas. Compare against these regularly to detect drift.
When you detect or anticipate an API change, use feature flags to roll out handling changes gradually:
# Feature flag pattern for API response handling# Store flag in environment or config serviceexport NAVAN_USE_NEW_TRIP_SCHEMA="${NAVAN_USE_NEW_TRIP_SCHEMA:-false}"# In your integration code, branch on the flagif [ "$NAVAN_USE_NEW_TRIP_SCHEMA" = "true" ]; then# New parsing logic for updated schema
jq '.[] | {id: .booking_uuid, flight: .flight_number}' /tmp/trips.json
else# Legacy parsing logic (current production)
jq '.[] | {id: .id, flight: .flight_no}' /tmp/trips.json
fi
Rollout procedure:
Deploy new parsing logic behind a feature flag (flag = off)
Enable for 5% of traffic — compare outputs between old and new parsers
If outputs match or new parser handles additional fields, increase to 25%
Monitor error rates at each stage for 24 hours
Full rollout at 100% when confidence is high
Remove old parsing logic and feature flag after 2 weeks at 100%
Step 6 — Automated Regression Testing
Run regression tests against live API responses on a schedule: