Skip to main content 홈 크리에이터 jeremylongshore tons-of-skills-marketplace navan-data-handling
navan-data-handling Extract 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".
설치로 이동 Skills Marketplace 커뮤니티가 만든 AI 스킬을 발견하고 탐색하세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/jeremylongshore/tons-of-skills-marketplace --skill navan-data-handling명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
Zip 다운로드 다운로드 중... 이 저장소의 다른 Skills langchain-deploy-integration Deploy a LangChain 1.0 / LangGraph 1.0 app to Cloud Run, Vercel, or LangServe correctly — with timeouts sized for chain length, cold-start mitigation, SSE anti-buffering headers, and Secret Manager over .env. Use when prepping a first production deploy, debugging a stream that hangs behind a proxy, or diagnosing p99 latency spikes. Trigger with "langchain deploy", "langchain cloud run", "langchain vercel python", "langchain langserve", or "langchain docker".
langchain-langgraph-agents Build a correct LangGraph 1.0 ReAct agent with create_react_agent — typed tools, error propagation, recursion caps, and stop conditions that actually stop. Use when writing a first tool-calling agent, migrating from AgentExecutor or initialize_agent, or diagnosing an agent that loops on vague prompts. Trigger with "langgraph agent", "create_react_agent", "langgraph tool calling", "AgentExecutor migration", or "agent loop cost".
langchain-langgraph-human-in-loop Build LangGraph 1.0 human-in-the-loop approval flows with interrupt_before /
interrupt_after and Command(resume=...) — JSON-serializable state, clean
resume semantics, and UI wiring for approval decisions. Use when adding an
approval gate before an expensive tool call, wiring a Slack/web UI for agent
approvals, or debugging a graph that crashes on interrupt.
Trigger with "langgraph human in loop", "langgraph interrupt_before",
"langgraph approval flow", "Command resume", "langgraph HITL".
jeremylongshore
jeremylongshore/tons-of-skills-marketplace
GitHub 저장소 열기 name navan-data-handling description Extract 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".
allowed-tools Read, Write, Edit, Bash(npm:*), Bash(curl:*), Bash(pip:*), Grep version 1.7.0 license MIT author Jeremy Longshore <jeremy@intentsolutions.io> tags ["saas","navan","travel"] compatibility Designed for Claude Code
Navan Data Handling
Overview
This skill covers data extraction and transformation patterns for Navan booking and transaction data. Navan exposes two primary data tables with different refresh behaviors: BOOKING (full re-import weekly, keyed by UUID) and TRANSACTION (incremental append-only). Data can be extracted via the direct REST API or through managed connectors — Fivetran, Airbyte (source-navan v0.0.42), and Estuary Flow. This skill provides pagination patterns, date-range filtering, UUID-based deduplication, and schema mapping for downstream analytics.
Prerequisites
Navan account with OAuth 2.0 API credentials (see navan-install-auth)
For direct API: Node.js 18+ or Python 3.8+
For Fivetran: Fivetran account with Navan connector
For Airbyte: Airbyte instance (Cloud or OSS) with source-navan v0.0.42+
Environment variables: NAVAN_CLIENT_ID, NAVAN_CLIENT_SECRET, NAVAN_BASE_URL
Instructions
Step 1: Direct API — Paginated Booking Extraction
const tokenRes = await fetch (`${process.env.NAVAN_BASE_URL} /ta-auth/oauth/token` , {
method : 'POST' ,
headers : { 'Content-Type' : 'application/x-www-form-urlencoded' },
body : new URLSearchParams ({
grant_type : 'client_credentials' ,
client_id : process.env .NAVAN_CLIENT_ID !,
client_secret : process.env .NAVAN_CLIENT_SECRET !,
}),
});
const { access_token } = await tokenRes.json ();
const headers = { Authorization : `Bearer ${access_token} ` };
( ) {
: [] = [];
page = ;
size = ;
( ) {
res = (
+
+
,
{ headers }
);
(res. === ) {
retryAfter = (res. . ( ) ?? );
( (r, retryAfter * ));
;
}
{ data } = res. ();
(!data || !data. ) ;
allBookings. (...data);
(data. < size) ;
page++;
. ( );
}
allBookings;
}
bookings = ( , );
. ( );
async
function
extractAllBookings
startDate : string , endDate : string
const
allBookings
any
let
0
const
50
while
true
const
await
fetch
`${process.env.NAVAN_BASE_URL} /v1/bookings`
`?createdFrom=${startDate} &createdTo=${endDate} `
`&page=${page} &size=${size} `
if
status
429
const
parseInt
headers
get
'Retry-After'
'5'
await
new
Promise
r =>
setTimeout
1000
continue
const
await
json
if
length
break
push
if
length
break
console
log
`Fetched ${allBookings.length} bookings...`
return
const
await
extractAllBookings
'2026-01-01'
'2026-03-31'
console
log
`Total bookings extracted: ${bookings.length} `
Step 2: UUID-Based Deduplication
function deduplicateByUUID (records : any [] ): any [] {
const seen = new Map <string , any >();
for (const record of records) {
const existing = seen.get (record.uuid );
if (!existing || record.updated_at > existing.updated_at ) {
seen.set (record.uuid , record);
}
}
return Array .from (seen.values ());
}
const deduplicated = deduplicateByUUID (trips);
console .log (`After dedup: ${deduplicated.length} unique trips (was ${trips.length} )` );
Step 3: Date-Range Filtering and Chunking
function * dateChunks (start : string , end : string , daysPerChunk : number ) {
const startDate = new Date (start);
const endDate = new Date (end);
while (startDate < endDate) {
const chunkEnd = new Date (startDate);
chunkEnd.setDate (chunkEnd.getDate () + daysPerChunk);
if (chunkEnd > endDate) chunkEnd.setTime (endDate.getTime ());
yield {
start : startDate.toISOString ().split ('T' )[0 ],
end : chunkEnd.toISOString ().split ('T' )[0 ],
};
startDate.setDate (startDate.getDate () + daysPerChunk + 1 );
}
}
for (const chunk of dateChunks ('2025-01-01' , '2026-03-31' , 30 )) {
const chunkBookings = await extractAllBookings (chunk.start , chunk.end );
console .log (`${chunk.start} to ${chunk.end} : ${chunkBookings.length} bookings` );
}
Step 4: Fivetran Connector Setup Configure Fivetran for automated data extraction:
In Fivetran dashboard, add a new connector and search for "Navan"
Enter your OAuth credentials (client_id, client_secret)
Select destination warehouse (Snowflake, BigQuery, Redshift)
Configure sync frequency (recommended: daily for BOOKING, hourly for TRANSACTION)
Map schema: Fivetran creates navan.booking and navan.transaction tables
SELECT
department,
COUNT (* ) AS trip_count,
SUM (total_cost) AS total_spend,
AVG (total_cost) AS avg_trip_cost
FROM navan.booking
WHERE booking_date >= '2026-01-01'
GROUP BY department
ORDER BY total_spend DESC ;
Step 5: Airbyte Connector Configuration
sourceDefinitionId: source-navan
connectionConfiguration:
client_id: "${NAVAN_CLIENT_ID}"
client_secret: "${NAVAN_CLIENT_SECRET}"
In Airbyte, add source > search "Navan"
Enter client_id and client_secret
Select "bookings" stream
Set sync mode to "Full Refresh | Overwrite" (matches Navan's weekly re-import)
Configure destination and schedule
Step 6: Schema Mapping for Analytics
interface NormalizedBooking {
booking_id : string ;
employee_email : string ;
department : string ;
cost_center : string ;
origin : string ;
destination : string ;
start_date : string ;
end_date : string ;
booking_type : string ;
total_cost : number ;
currency : string ;
policy_compliant : boolean ;
created_at : string ;
updated_at : string ;
}
function normalizeBooking (raw : any ): NormalizedBooking {
return {
booking_id : raw.uuid ,
employee_email : raw.traveler_email ?? raw.email ,
department : raw.department ?? 'Unknown' ,
cost_center : raw.cost_center ?? '' ,
origin : raw.origin ,
destination : raw.destination ,
start_date : raw.start_date ,
end_date : raw.end_date ,
booking_type : raw.type ?? 'flight' ,
total_cost : parseFloat (raw.total_cost ?? raw.amount ?? '0' ),
currency : raw.currency ?? 'USD' ,
policy_compliant : raw.in_policy ?? true ,
created_at : raw.created_at ,
updated_at : raw.updated_at ,
};
}
Output Successful execution produces:
Paginated trip and transaction records extracted via REST API
Deduplicated records keyed by UUID for the BOOKING table
Configured Fivetran or Airbyte connectors for automated extraction
Normalized schema mappings ready for warehouse loading
Error Handling Error HTTP Code Cause Solution Unauthorized 401 Expired or invalid bearer token Re-authenticate via POST /ta-auth/oauth/token Forbidden 403 Insufficient API scope for admin endpoints Verify admin-level credentials Rate Limited 429 Too many API requests Use exponential backoff; chunk date ranges Timeout 504 Date range too large Split into 30-day chunks Empty Response 200 No data in date range Verify date format (YYYY-MM-DD); widen range Connector Auth Failed N/A Invalid credentials in Fivetran/Airbyte Verify client_id and client_secret
Examples Python — Bulk extraction with retry logic:
import requests
import time
import os
base_url = os.environ.get('NAVAN_BASE_URL' , 'https://api.navan.com' )
auth = requests.post(f'{base_url} /ta-auth/oauth/token' , data={
'grant_type' : 'client_credentials' ,
'client_id' : os.environ['NAVAN_CLIENT_ID' ],
'client_secret' : os.environ['NAVAN_CLIENT_SECRET' ],
})
headers = {'Authorization' : f'Bearer {auth.json()["access_token" ]} ' }
def extract_with_retry (endpoint, params, max_retries=3 ):
for attempt in range (max_retries):
res = requests.get(f'{base_url} /{endpoint} ' , params=params, headers=headers)
if res.status_code == 200 :
return res.json()
elif res.status_code == 429 :
wait = int (res.headers.get('Retry-After' , 2 ** attempt))
print (f'Rate limited, waiting {wait} s...' )
time.sleep(wait)
else :
res.raise_for_status()
raise Exception(f'Failed after {max_retries} retries' )
resp = extract_with_retry('v1/bookings' , {
'createdFrom' : '2026-01-01' , 'createdTo' : '2026-03-31' , 'page' : 0 , 'size' : 50
})
bookings = resp['data' ]
print (f'Extracted {len (bookings)} bookings' )
Resources
Next Steps After setting up data extraction, proceed to navan-data-sync for incremental sync strategies or navan-performance-tuning for optimizing large data pulls.