jupiter-go: Jupiter Go SDK for Solana
Swap tokens, get prices, place limit orders and DCA on Solana from Go, with the Jupiter APIs
jupiter-go is a Go (Golang) SDK for Jupiter, the leading DEX aggregator and trading platform on Solana. Use it to get swap quotes and execute token swaps through Jupiter's Swap API (Ultra / Swap V2), look up token metadata and USD prices, place limit orders and dollar-cost averaging (DCA) orders, earn yield and borrow with Jupiter Lend, trade prediction markets, and land transactions fast through Jupiter's landing service, all from idiomatic, typed Go code.
Features
- Complete Jupiter API coverage: Swap V2, Tokens V2, Price V3, Trigger V2
tx.jup.ag).
- Managed swaps without an RPC node: order, sign locally, and let Jupiter
- Custom swap transactions: build instructions, add your own, and submit
- Safe signing with any ed25519
crypto.Signer(local keys, HSM, KMS):
- Production behavior: typed errors, request IDs and rate-limit headers on
Retry-After, and no
blind retries of anything that moves funds.
- Exact numbers: raw token amounts and prices never pass through
float64. - No SDK fee, MIT licensed, verified against Solana mainnet.
Supported Jupiter APIs
| Product | Package | Status |
| - | - | - |
| Swap V2 (order, execute, build, program labels) | swap | Stable |
| Tokens V2 (search, tags, categories, Express Verification) | tokens | Stable |
| Price V3 | price | Stable |
| Trigger V2 (limit orders, OCO/OTOCO, DCA) | trigger | Stable |
| Transaction landing (tx.jup.ag) | transaction | Stable |
| Lend (Earn and Borrow) | lend | Beta |
| Prediction markets | prediction | Beta |
| Send (invite transfers) | send | Beta |
| Studio (token launches) | studio | Beta |
Beta products. Jupiter labels Lend, Prediction, Send, and Studio as beta and
may change them without notice. Their Go types follow upstream and can change in
minor releases until Jupiter declares them stable.
The SDK charges no fee. You only pay Jupiter's and the network's fees. If you
run your own Jupiter referral account, WithReferral adds your fee to managed swap
orders.
Installation
go get github.com/ilkamo/jupiter-go
Go 1.26 or newer is required.
Quick start
client, err := jupiter.NewClient(jupiter.WithAPIKey(os.Getenv("JUPITER_API_KEY")))
if err != nil {
return err
}
quote, err := client.Swap.Order(ctx, swap.OrderRequest{
InputMint: "So11111111111111111111111111111111111111112", // SOL
OutputMint: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", // USDC
Amount: "100000000", // raw units: 0.1 SOL
})
if err != nil {
return err
}
fmt.Println("output:", quote.OutAmount)
Get an API key at developers.jup.ag/portal.
Client options
| Option | Purpose |
| - | - |
| WithAPIKey(key) | Jupiter API key sent as x-api-key. |
| WithTimeout(d) | Bounds each operation, including its retries (default 30s). |
| WithHTTPClient(c) | Your own Do(*http.Request) implementation. The default refuses redirects so the API key never leaves Jupiter's host; a custom client owns that policy. |
| WithoutRetries() | One attempt per operation, for clients that already retry. |
| WithReferral(account, bps) | Your Jupiter referral fee (50–255 bps) on managed swap orders. |
| WithBaseURL(url) / WithTransactionURL(url) | Override https://api.jup.ag / https://tx.jup.ag, for example for tests. |
Clients are safe for concurrent use and make no network calls when constructed.
Managed swap
Order with a Taker returns a transaction; sign it and hand it back to Jupiter.
Signing lives in solanatx, which accepts any ed25519 crypto.Signer
(local keys, HSMs, remote signers) and never alters the message or other signatures.
order, err := client.Swap.Order(ctx, swap.OrderRequest{
InputMint: sol,
OutputMint: usdc,
Amount: "10000000",
Taker: wallet.PublicKey().String(),
})
if err != nil {
return err
}
tx, err := solanatx.Parse(*order.Transaction)
if err != nil {
return err
}
if err := tx.Sign(ed25519.PrivateKey(wallet)); err != nil {
return err
}
result, err := client.Swap.Execute(ctx, swap.ExecuteRequest{
RequestID: order.RequestID,
SignedTransaction: tx.Base64(),
})
For full control use client.Swap.Build, assemble with solanatx.Assemble, and
submit through your RPC node or client.Transaction.Send (tx.jup.ag, which needs
a 0.001 SOL tip: set BuildRequest.TipAmount or add solanatx.TipInstruction).
Other products at a glance
// Tokens and prices
tokens, err := client.Tokens.Search(ctx, "JUP")
prices, err := client.Price.Get(ctx, []string{sol, usdc}) // prices.Missing lists unpriced mints
// Trigger V2: a wallet-scoped session with rotating refresh tokens
session, err := client.Trigger.Login(ctx, ed25519.PrivateKey(wallet), trigger.SessionOptions{})
vault, err := session.EnsureVault(ctx)
// Lend (beta): unsigned Earn deposit
deposit, err := client.Lend.Earn.Deposit(ctx, lend.AmountRequest{Asset: usdc, Signer: owner, Amount: "1000000"})
// Prediction (beta): markets priced in micro USD
events, err := client.Prediction.Events(ctx, prediction.EventsRequest{Filter: prediction.FilterTrending})
// Send (beta): invite codes never leave your process and print redacted
code, err := send.NewInviteCode()
// Studio (beta): token launch transaction plus presigned upload URLs
pool, err := client.Studio.CreatePool(ctx, poolRequest)
Runnable programs for every product are in examples/. Examples that
move funds only do so behind an explicit environment flag.
Errors, retries, and safety
- HTTP errors are
*jupiter.APIError(status, Jupiter error code and message,
errors.Is(err, swap.ErrInvalidAddress).
- Response metadata. Every result carries
Metadata(status, request ID,
- Retries follow each operation's semantics, not its HTTP method: reads and
Retry-After.
- Submissions never retry blindly. Operations that submit signed transactions
ErrOutcomeUnknown: check on-chain state
before trying again. transaction.Send retries because resubmitting identical
signed bytes cannot execute twice.
- Exact numbers. Raw token amounts are validated integer strings; prices and
json.Number or strings, never float64.
FAQ
How do I swap tokens on Solana in Go?
Call client.Swap.Order with the input mint, output mint, raw amount, and your
wallet as Taker; sign the returned transaction with solanatx.Parse(...).Sign;
then call client.Swap.Execute. Jupiter routes the swap across Solana DEXes and
lands the transaction for you. See Managed swap and
examples/managed.
How do I get a Solana token price in Go?
client.Price.Get(ctx, mints) returns USD prices from Jupiter's Price API V3
for up to 50 mints; mints without a reliable price are listed in Missing.
client.Swap.Order without a Taker returns a swap quote.
Can I place limit orders or DCA orders on Jupiter from Go?
Yes. client.Trigger.Login opens a wallet session for the Trigger V2 API, which
supports single limit orders, take-profit/stop-loss pairs (OCO), OTOCO,
trailing stops, and time-based or price-conditional DCA. See
examples/trigger.
Do I need a Jupiter API key?
Requests work without a key at a lower rate limit. For production, get a key
at developers.jup.ag/portal and pass it with
jupiter.WithAPIKey.
Do I need a Solana RPC node?
Not for managed swaps (Swap.Order and Swap.Execute) or any read API. You
need one to confirm transactions you submit yourself, for example custom swaps
built with Swap.Build; use a dedicated RPC provider for that.
Which Solana transaction versions are supported?
solanatx parses and signs legacy, version 0 (with address lookup tables), and
version 1 transactions without modifying the message or other signatures.
How do I protect a Solana swap from sandwich attacks?
For transactions you assemble yourself (Swap.Build and solanatx.Assemble),
attach Jito's sandwich-mitigation account to an instruction whose program
ignores extra accounts, such as the tip transfer:
tip, err := solanatx.TipInstruction(wallet, transaction.MinTipLamports)
tip, err = solanatx.WithReadOnlyAccount(tip, solanatx.JitoDontFront)
tx, err := solanatx.Assemble(build, wallet, tip)
Jito's block engine then rejects bundles that place the transaction anywhere but first. This reduces sandwiching on Jito validators; it is not a guarantee. Managed swap transactions come from Jupiter and cannot be changed.
Is jupiter-go an official Jupiter SDK?
No. It is an independent, community-maintained open-source library. It charges no fee and has been verified with real swaps on Solana mainnet.
Which Go versions are supported?
Go 1.26 and newer. CI tests Go 1.26 and 1.27.
Migrating from v0
v1 is a rewrite. The jupiter (generated client) and solana subpackages are
removed. See CHANGELOG.md for the mapping.
Contribute
Contributions are welcome. Read AGENTS.md for the code conventions and
run make check (vet, golangci-lint, go.mod tidiness, race tests) before opening
a pull request. make help lists the other tasks, such as cover and fuzz.
License
This library is licensed under the MIT License - see the LICENSE file for details.
This is an unofficial, community-maintained library and is not affiliated with or
endorsed by Jupiter. The Go gopher was designed by
Renée French and is licensed under
CC BY 4.0; the mascot artwork in
docs/assets/ is a derivative of it and carries the same license.
Sponsors
jupiter-go is free, charges no fee, and is maintained in my own time. If it saves you work, please consider sponsoring it on GitHub.
| Monthly tier | What you get | | - | - | | $10, $50 | My gratitude, and more time for the library. | | $200 | Your name or small logo listed below. | | $500 | Your logo at the top of this section, a vote on what gets built next, and your issues reviewed first. | | $1,000 | A large logo here and in the release notes, plus a monthly roadmap update. |
No sponsors yet. Become the first one.
You can also donate JUP or SOL to
BXzmfHxfEMcMj8hDccUNdrwXVNeybyfb2iV2nktE1VnJ.