agentsclimarketplace

Navan common errors

Skill jeremylongshore/claude-code-plugins-plus-skills/plugins/saas-packs/navan-pack/skills/navan-common-errors

'Diagnose and fix common Navan API errors with targeted fix procedures.From its SKILL.md

Install
npx -y skills add jeremylongshore/claude-code-plugins-plus-skills --skill navan-common-errors

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

What its file declares

Copied from the file, not written here

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

8.6 KB, ~2.0k tokens by cl100k_base, as published. Nobody here has run it

Navan Common Errors

Overview

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.

Prerequisites

  • Navan API credentials configured (see navan-install-auth)
  • curl and jq available in your terminal
  • Environment variables set: NAVAN_CLIENT_ID, NAVAN_CLIENT_SECRET, NAVAN_BASE_URL

Instructions

Error 401 — Unauthorized (Invalid or Expired OAuth Token)

Root causes:

  1. OAuth token has expired (tokens have a limited expires_in window)
  2. client_secret was rotated in the Navan dashboard but not updated in .env
  3. Malformed Authorization header (missing Bearer prefix)
  4. Token from a different Navan organization

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.

Error 403 — Forbidden (Insufficient Permissions)

Root causes:

  1. API credentials lack required scopes for the endpoint
  2. Account is on Business tier but endpoint requires Enterprise
  3. Expense Transaction API not enabled (requires separate Navan support request)
  4. User role lacks admin permissions for admin-only endpoints

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.

Error 404 — Not Found (Invalid Endpoint)

Root causes:

  1. Typo in endpoint path
  2. Using a legacy or reverse-engineered endpoint that no longer exists
  3. Referencing an endpoint not available on your Navan tier

Known valid endpoints (from Airbyte connector source):

EndpointMethodDescription
/ta-auth/oauth/tokenPOSTOAuth token exchange (client_credentials)
/v1/bookingsGETBooking records (paginated with page + size)

Note: Older references to endpoints like /get_user_trips, /get_admin_trips, /get_users originate from Supergood's reverse-engineered browser automation and are not part of the official Navan REST API. Use /v1/bookings for booking data.

Fix: Verify the endpoint path against the table above. The Navan API uses /v1/ prefixed paths at https://api.navan.com.

Error 429 — Rate Limited

Root causes:

  1. Exceeding the per-minute request limit
  2. Automated scripts making rapid sequential calls without throttling
  3. Multiple services sharing the same credentials

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');
}

Error 500 — Internal Server Error

Root causes:

  1. Navan backend service failure
  2. Malformed request body causing server-side exception
  3. Data inconsistency in your organization's records

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.

Error 503 — Service Unavailable (Maintenance)

Root causes:

  1. Scheduled Navan maintenance window
  2. Navan infrastructure scaling event
  3. Regional AWS outage (Navan is AWS-hosted)

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.

Output

This error reference delivers:

  • Six HTTP error codes with Navan-specific root causes
  • Copy-paste diagnostic curl commands for each error type
  • Fix procedures ranked by likelihood
  • A backoff implementation for automated retry handling

Error Handling

ErrorCodeMost Likely CauseFirst Action
Unauthorized401Expired OAuth tokenRe-run token exchange
Forbidden403Tier or scope limitationCheck plan tier; contact Navan support
Not found404Wrong endpoint pathVerify against known endpoints table
Rate limited429No throttling in client codeAdd exponential backoff
Server error500Navan backend issueRetry after 30s; check request body
Maintenance503Navan downtimeWait and retry; check help center

Examples

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

Resources

Next Steps

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 ships with it: 1 file

1.5 KB alongside SKILL.md

references/

Keep looking

Skills are one crate of 326,144. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.