navan-sdk-patterns

Featured

Build a typed API wrapper around Navan REST endpoints since no official SDK exists. Use when you need production-grade API access with auto token refresh, retry logic, and typed responses. Trigger with "navan sdk patterns", "navan api wrapper", "navan client class", "navan typed client".

AI & Automation 2,926 stars 433 forks Updated yesterday MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Navan SDK Patterns ## Overview Build a typed API wrapper around Navan REST endpoints since no official SDK exists (`@navan/sdk` is not a real package). These patterns provide automatic token lifecycle management, typed responses, retry middleware, and centralized error handling. **Purpose:** Create a reusable NavanAPI class encapsulating authentication, request handling, and error recovery. ## Prerequisites - Completed `navan-install-auth` with working OAuth 2.0 credentials - TypeScript 5+ project with `dotenv` installed - Familiarity with the Navan endpoints from `navan-hello-world` ## Instructions ### Step 1: Define Response Interfaces Type the known API response shapes so every call returns structured data: ```typescript // navan-types.ts export interface NavanTrip { uuid: string; traveler_name: string; origin: string; destination: string; departure_date: string; return_date: string; booking_status: string; booking_type: 'flight' | 'hotel' | 'car'; } export interface NavanUser { id: string; email: string; first_name: string; last_name: string; department: string; role: string; } export interface NavanApiError { status: number; message: string; endpoint: string; timestamp: string; } ``` ### Step 2: Build the NavanAPI Wrapper Class Create a singleton client with automatic token management: ```typescript // navan-client.ts import 'dotenv/config'; import type { NavanTrip, NavanUser, NavanApiError } from './navan-types'; expo...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
1 years ago
Last Updated
yesterday
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category