/navan-pack:navan-common-errorsfrom navan-pack
Diagnoses and fixes common Navan API errors (401, 403, 404, 429, 500, 503) using curl-based diagnostics and targeted fix procedures.
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.
Diagnose and resolve Navan API errors using targeted fix procedures. All errors surface as raw HTTP status codes since Navan has no public SDK — this guide covers 401, 403, 404, 429, 500, and 503 with curl-based diagnostics.
Purpose: Identify the root cause of a Navan API error and apply the correct fix.
navan-install-auth)curl and jq available in your terminalNAVAN_CLIENT_ID, NAVAN_CLIENT_SECRET, NAVAN_BASE_URLRoot causes:
expires_in window)client_secret was rotated in the Navan dashboard but not updated in .envAuthorization header (missing Bearer prefix)Diagnostic steps:
# 1. Verify credentials can still obtain a 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" \
| python3 -c "import sys,json; d=json.load(sys.stdin); print('TOKEN OK' if 'access_token' in d else f'FAIL: {d}')"
# 2. Check if existing token is expired
echo "Token var length: ${#NAVAN_TOKEN}"
Fix: Re-run the token exchange. If that also returns 401, regenerate credentials at Admin > Travel admin > Settings > Integrations > Navan API Credentials.
Root causes:
Diagnostic steps:
# Test the bookings endpoint
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" \
| python3 -c "import sys,json; print(json.load(sys.stdin)['access_token'])")
echo "Bookings:" && curl -s -o /dev/null -w "%{http_code}" \
"https://api.navan.com/v1/bookings?page=0&size=1" -H "Authorization: Bearer $TOKEN"
Fix: If the bookings endpoint returns 403, your credentials lack the required scope. Contact Navan support. If the Expense API returns 403, it requires separate enablement — request it through your Navan account manager.
Root causes:
Known valid endpoints (from Airbyte connector source):
| Endpoint | Method | Description |
|---|---|---|
/ta-auth/oauth/token | POST | OAuth token exchange (client_credentials) |
/v1/bookings | GET | Booking records (paginated with page + size) |
Note: Older references to endpoints like
/get_user_trips,/get_admin_trips,/get_usersoriginate from Supergood's reverse-engineered browser automation and are not part of the official Navan REST API. Use/v1/bookingsfor booking data.
Fix: Verify the endpoint path against the table above. The Navan API uses /v1/ prefixed paths at https://api.navan.com.
Root causes:
Diagnostic steps:
# Check rate limit headers in response
curl -s -D - "https://api.navan.com/v1/bookings?page=0&size=1" \
-H "Authorization: Bearer $TOKEN" \
-o /dev/null 2>&1 | grep -i "rate\|retry\|limit"
Fix: Implement exponential backoff. Start with a 2-second delay, doubling on each retry up to 3 attempts. Cache tokens to avoid redundant auth requests. If using multiple services, consider separate credentials per service.
async function withBackoff<T>(fn: () => Promise<T>, maxRetries = 3): Promise<T> {
for (let i = 0; i < maxRetries; i++) {
try { return await fn(); }
catch (err: any) {
if (err.status !== 429 || i === maxRetries - 1) throw err;
await new Promise(r => setTimeout(r, Math.pow(2, i + 1) * 1000));
}
}
throw new Error('Max retries exceeded');
}
Root causes:
Diagnostic steps:
# Test with minimal request to isolate
curl -s -w "\nHTTP %{http_code}" "https://api.navan.com/v1/bookings?page=0&size=1" \
-H "Authorization: Bearer $TOKEN"
Fix: Retry after 30 seconds. If the error persists across multiple endpoints, it is likely a Navan-side outage. If only one endpoint fails, check your request body for malformed JSON. For persistent 500 errors, contact Navan support with the endpoint, timestamp, and request ID from the response headers.
Root causes:
Fix: Wait and retry with exponential backoff. Check the Navan Help Center for maintenance announcements. 503 errors are typically transient and resolve within minutes. Implement circuit-breaker patterns for production systems to avoid cascading failures during extended outages.
This error reference delivers:
| Error | Code | Most Likely Cause | First Action |
|---|---|---|---|
| Unauthorized | 401 | Expired OAuth token | Re-run token exchange |
| Forbidden | 403 | Tier or scope limitation | Check plan tier; contact Navan support |
| Not found | 404 | Wrong endpoint path | Verify against known endpoints table |
| Rate limited | 429 | No throttling in client code | Add exponential backoff |
| Server error | 500 | Navan backend issue | Retry after 30s; check request body |
| Maintenance | 503 | Navan downtime | Wait and retry; check help center |
Full diagnostic script:
#!/bin/bash
echo "=== Navan API Diagnostic ==="
echo "1. Testing authentication..."
AUTH_RESULT=$(curl -s -w "\n%{http_code}" -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")
AUTH_CODE=$(echo "$AUTH_RESULT" | tail -1)
echo " Auth: HTTP $AUTH_CODE"
if [ "$AUTH_CODE" = "200" ]; then
TOKEN=$(echo "$AUTH_RESULT" | head -1 | python3 -c "import sys,json; print(json.load(sys.stdin)['access_token'])")
echo "2. Testing bookings (page 0)..."
curl -s -o /dev/null -w " Bookings: HTTP %{http_code}\n" \
"https://api.navan.com/v1/bookings?page=0&size=1" -H "Authorization: Bearer $TOKEN"
else
echo " Auth failed — check NAVAN_CLIENT_ID and NAVAN_CLIENT_SECRET"
fi
After resolving your error, see navan-sdk-patterns for production-grade error handling with automatic retries, or navan-local-dev-loop for request logging that captures errors for post-mortem analysis.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
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-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".
/navan-data-syncImplement incremental sync strategies for Navan BOOKING and TRANSACTION data with ETL pipeline patterns.
Use when setting up production data pipelines, debugging sync drift, or adding real-time event processing.
Trigger with "navan data sync", "navan incremental sync", "navan ETL pipeline".
npx claudepluginhub flight505/skill-forge --plugin navan-packOther plugins' skills for the same job