fix: Fixes prompted by lite-api.jup.ag being deprecated on 31st January 2026 #59
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Branch Summary:
fix/update_to_api_responseOverview
This branch updates the Jupiter Swap API Client to align with recent Jupiter API changes, focusing on mandatory API key authentication, enhanced error handling, and expanded response data structures.
Branch:
fix/update_to_api_responseBase:
mainCommits: 6 commits ahead of main
Files Changed: 8 files (+80 insertions, -25 deletions)
Key Changes
1. Mandatory API Key Authentication 🔑
Breaking Change: API key is now required for all requests.
JupiterSwapApiClientconstructor to require anapi_keyparameterx-api-keyheader in all HTTP requestsBefore:
After:
Files Modified:
jupiter-swap-api-client/src/lib.rs- Addedapi_keyfield to struct and header injectionexample/src/main.rs- Updated to read API key fromJUPITER_API_KEYenv variableREADME.md- Added API key documentation and usage examples2. Enhanced Error Handling & Logging 🔍
Added comprehensive logging and improved error diagnostics for API responses.
Changes:
tracingdependency for structured loggingJsonParseErrorvariant toClientErrorenumcheck_status_code_and_deserialize()to:Benefits:
Files Modified:
jupiter-swap-api-client/Cargo.toml- Addedtracing = "0.1"dependencyjupiter-swap-api-client/src/lib.rs- Implemented enhanced logging3. Updated
SwapInfoResponse Structure 📊Extended
SwapInfostruct to include additional fields returned by Jupiter API v6.New Fields:
fee_amount: Option<String>- Optional fee amount charged by the AMMfee_mint: Option<String>- Optional fee token mint (rarely populated)out_amount_after_slippage: u64- Output amount accounting for configured slippageKey Notes:
fee_amountandfee_mintare optional as Jupiter API doesn't always return themOption<String>instead of deserialization helpers for flexibilityout_amount_after_slippageis required and usesfield_as_stringserializationFiles Modified:
jupiter-swap-api-client/src/quote.rs- Updated mainSwapInfostructjupiter-swap-api-client/src/route_plan_with_metadata.rs- Updated route planningSwapInfojupiter-swap-api-client/src/serde_helpers/option_field_as_string.rs- Improved empty string handling4. Documentation & Code Quality Improvements 📝
README Updates:
Code Comments:
SwapInfofield descriptionsEnvironment Variables:
JUPITER_API_KEYenvironment variableDetailed Commit History
Migration Guide
For Existing Users
Required Changes:
Update Constructor Calls:
Obtain API Key:
Update Environment Variables:
Update Code to Handle New Fields:
Optional Changes:
tracingsubscriber to capture detailed API logsJsonParseErrorvariantTesting Recommendations
API Key Validation:
x-api-keyheader is present in all requestsResponse Parsing:
out_amount_after_slippagecalculationError Handling:
Backward Compatibility:
SwapInfostructureDependencies Added
tracingBreaking Changes Summary
✅ API Key Required - All instantiations of
⚠️ SwapInfo Extended - New fields added (backward compatible for deserialization)
JupiterSwapApiClientmust now provide an API key✅ Constructor Signature Changed -
new()method now takes two parameters instead of oneRelated Resources
Authors & Contributors
This branch includes contributions addressing Jupiter API v6 updates and authentication requirements.
Next Steps
mainafter testingCargo.toml(bump minor version for breaking change)Last Updated: January 23, 2026