/navan-pack:navan-reference-architecturefrom navan-pack
Provides a production-grade architecture for Navan API integrations with five layers: API gateway, token management, Navan API client, data sync pipelines, and ERP connectors. Includes rate limiting, OAuth 2.0 token caching, circuit breakers, and monitoring stack.
Ships in navan-pack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Production-grade architecture for Navan API integrations. Navan provides raw REST endpoints with OAuth 2.0 — no SDK, no webhooks, no sandbox. This architecture handles those constraints with five purpose-built layers.
┌──────────────────────────────────────────────────────────────────┐
│ CONSUMERS │
│ Travel Dashboard │ Expense Reports │ Finance System │
└────────┬────────────┴────────┬──────────┴────────┬───────────────┘
│ │ │
┌────────▼─────────────────────▼────────────────────▼───────────────┐
│ LAYER 1: API GATEWAY │
│ ┌─────────────┐ ┌──────────────┐ ┌─────────────────────────┐ │
│ │ Rate Limiter │ │ Request Log │ │ Circuit Breaker (5xx) │ │
│ └─────────────┘ └──────────────┘ └─────────────────────────┘ │
└────────┬─────────────────────────────────────────────────────────┘
│
┌────────▼─────────────────────────────────────────────────────────┐
│ LAYER 2: TOKEN MANAGEMENT SERVICE │
│ ┌──────────────────┐ ┌──────────────┐ ┌────────────────────┐ │
│ │ OAuth Client Cred │ │ Token Cache │ │ Auto-Refresh │ │
│ │ POST /ta-auth/ │ │ (Redis/KMS) │ │ (before expiry) │ │
│ └──────────────────┘ └──────────────┘ └────────────────────┘ │
└────────┬─────────────────────────────────────────────────────────┘
│
┌────────▼─────────────────────────────────────────────────────────┐
│ LAYER 3: NAVAN API CLIENT │
│ ┌───────────────┐ ┌──────────────┐ ┌────────────────────────┐ │
│ │ /get_user_trips│ │ /get_users │ │ /get_admin_trips │ │
│ │ /get_invoices │ │ /get_itin_pdf│ │ /reauthenticate │ │
│ └───────────────┘ └──────────────┘ └────────────────────────┘ │
└────────┬────────────────────┬────────────────────────────────────┘
│ │
┌────────▼──────────┐ ┌──────▼─────────────────────────────────────┐
│ LAYER 4: DATA │ │ LAYER 5: MONITORING │
│ SYNC PIPELINE │ │ ┌──────────┐ ┌─────────┐ ┌────────────┐ │
│ ┌───────────────┐ │ │ │ API Call │ │ Error │ │ Token │ │
│ │ Fivetran / │ │ │ │ Metrics │ │ Alerts │ │ Expiry │ │
│ │ Airbyte / │ │ │ │ (volume, │ │ (PD/ │ │ Monitor │ │
│ │ Estuary │ │ │ │ latency)│ │ Slack) │ │ │ │
│ ├───────────────┤ │ │ └──────────┘ └─────────┘ └────────────┘ │
│ │ BOOKING table │ │ │ │
│ │ (weekly full) │ │ └─────────────────────────────────────────────┘
│ ├───────────────┤ │
│ │ TRANSACTION │ │
│ │ (incremental) │ │
│ ├───────────────┤ │
│ │ ERP Connector │ │
│ │ (SAP/NetSuite)│ │
│ └───────────────┘ │
└───────────────────┘
The gateway provides rate limiting, request logging, and circuit breaking before any call reaches Navan.
# Example: test gateway → Navan connectivity
curl -s -w "connect: %{time_connect}s | ttfb: %{time_starttransfer}s | total: %{time_total}s\n" \
-o /dev/null "https://api.navan.com/ta-auth/oauth/token"
Key decisions:
Centralized OAuth lifecycle management. Navan uses client_credentials grant type via POST /ta-auth/oauth/token.
# Token acquisition
TOKEN_RESPONSE=$(curl -s -X POST "https://api.navan.com/ta-auth/oauth/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials&client_id=$NAVAN_CLIENT_ID&client_secret=$NAVAN_CLIENT_SECRET")
TOKEN=$(echo "$TOKEN_RESPONSE" | jq -r '.access_token')
EXPIRES=$(echo "$TOKEN_RESPONSE" | jq -r '.expires_in')
echo "Token acquired, expires in: ${EXPIRES}s"
Design principles:
Thin wrapper around Navan's REST endpoints with consistent error handling:
| Endpoint | Method | Purpose | Data Table |
|---|---|---|---|
/ta-auth/oauth/token | POST | OAuth token acquisition | — |
/v1/bookings | GET | Booking records | BOOKING |
/v1/users | GET | Employee directory | — |
Navan has no push/webhook mechanism — all data sync is poll-based.
| Table | Sync Strategy | Frequency | Connector |
|---|---|---|---|
| BOOKING | Full refresh | Weekly | Fivetran, Airbyte, or Estuary |
| TRANSACTION | Incremental (by date range) | Daily/hourly | Fivetran, Airbyte, or custom |
Connector selection:
| Metric | Alert Threshold | Channel |
|---|---|---|
| API error rate | > 5% over 5 minutes | PagerDuty (P2) |
| Token refresh failure | Any failure | PagerDuty (P1) |
| API response latency | p95 > 5 seconds | Slack |
| Data sync staleness | BOOKING > 8 days old | Slack |
| Rate limit proximity | > 80% utilization | Slack |
| Failure Mode | Architecture Response |
|---|---|
| Token expired | Layer 2 auto-refreshes; Layer 1 retries transparently |
| Rate limited (429) | Layer 1 queues requests; Layer 5 alerts on sustained throttling |
| API outage (5xx) | Layer 1 circuit breaker opens; consumers get cached data |
| Data sync gap | Layer 4 runs catch-up sync; Layer 5 alerts on staleness |
Validate the full stack end-to-end:
# End-to-end integration test
echo "1. Auth..." && \
TOKEN=$(curl -s -X POST "https://api.navan.com/ta-auth/oauth/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials&client_id=$NAVAN_CLIENT_ID&client_secret=$NAVAN_CLIENT_SECRET" \
| jq -r '.access_token') && \
echo "2. Users..." && \
curl -s -H "Authorization: Bearer $TOKEN" \
"https://api.navan.com/v1/users" | jq '.data | length' && \
echo "3. Bookings..." && \
curl -s -H "Authorization: Bearer $TOKEN" \
"https://api.navan.com/v1/bookings?page=0&size=50" | jq '.data | length'
navan-prod-checklist to validate each layer before launchnavan-data-sync for detailed data pipeline configurationnavan-observability for monitoring stack implementation detailsWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
navan, travel-api, integration-architecture, api-gateway, oauth2
26 skills in this plugin
/navan-ci-integrationUse when setting up CI/CD pipelines that validate Navan API integrations, run booking data health checks, or generate automated compliance reports.
Trigger with "navan ci integration" or "navan pipeline" or "navan github actions".
/navan-common-errorsDiagnose and fix common Navan API errors with targeted fix procedures.
Use when an API call returns an unexpected HTTP error or when debugging production failures.
Trigger with "navan error", "fix navan", "debug navan", "navan 401", "navan 403", "navan 429".
/navan-core-workflow-aManage the complete Navan travel booking lifecycle via REST API.
Use when building travel dashboards, automating trip reporting, or syncing booking data to internal systems.
Trigger with "navan travel workflow", "navan booking management", "navan trip retrieval".
/navan-core-workflow-bManage Navan expense reporting, transaction data, and ERP synchronization.
Use when building expense pipelines, automating approval workflows, or syncing transactions to accounting systems.
Trigger with "navan expense management", "navan expense workflow", "navan transaction sync".
/navan-cost-tuningUse when optimizing travel spend with Navan's policy engine, analyzing booking patterns for savings, and configuring the Navan Rewards program.
Trigger with "navan cost tuning" or "navan travel savings" or "navan spend optimization".
/navan-data-handlingExtract and transform Navan booking and transaction data using pagination, filtering, and data pipeline connectors.
Use when building data warehouses, analytics dashboards, or debugging data quality issues with Navan data.
Trigger with "navan data handling", "navan data extraction", "navan pagination".
npx claudepluginhub flight505/skill-forge --plugin navan-packOther plugins' skills for the same job