March 21, 2025

Moralis Raydium API – Ultimate Solana DEX API 2025

Table of Contents

Do you need an easy way to fetch data from Raydium? If so, you’ll want to explore Moralis’ Raydium Solana API, which gives you the tools you need to get everything from decoded swap data to token prices with minimal code. This is the ultimate tool for anyone looking to integrate Raydium token data into Web3 applications! 

Are you eager to jump straight into the code? Check out the script below, showing you how easy it is to fetch open, high, low, close, and volume (OHLCV) data of any token on Raydium and other DEXs: 

import fetch from "node-fetch";

const options = {
 method: "GET",
 headers: {
   accept: "application/json",
   "X-API-Key": "YOUR_API_KEY",
 },
};

fetch(
 "https://solana-gateway.moralis.io/token/mainnet/pairs/FdjBRWXzieV1Qtn8FLDWWk2HK1HSQWYduo8y4F1e8GWu/ohlcv?timeframe=1h&currency=usd&fromDate=2024-11-25&toDate=2024-11-26&limit=10",
 options
)
 .then((response) => response.json())
 .then((response) => console.log(response))
 .catch((err) => console.error(err));

Before running the script above, add your Moralis API key and configure the parameters by, for example, adding a pair address from Raydium. Then, when you execute the code, you’ll receive the token’s OHLCV data for the specified time period. Here’s what it might look like: 

{
  cursor: '//…',
  page: 1,
  pairAddress: 'FdjBRWXzieV1Qtn8FLDWWk2HK1HSQWYduo8y4F1e8GWu',
  tokenAddress: '9BB6NFEcjBCtnNLFko2FqVQBq8HHM13kCyYcdQbgpump',
  timeframe: '1h',
  currency: 'usd',
  result: [
    {
      timestamp: '2024-11-26T00:00:00.000Z',
      open: 0.305299,
      high: 0.327636255,
      low: 0.304529734,
      close: 0.326479103,
      volume: 37241.772831329,
      trades: 34
    },
    //...
  ]
}

That’s it; fetching OHLCV data from Raydium doesn’t have to be more challenging than this when working with Moralis for Developers. If you immediately want to start using the API, click the button below and sign up for a free account today!

Overview

Raydium is a leading DEX on Solana, consistently handling hundreds of millions in daily trading volume. As such, if you’re building on Solana – whether it’s a portfolio tracker, DEX tracker, analytics tool, or other similar platforms – chances are your users care about where the action is. That’s why having an easy way to fetch data from Raydium isn’t just useful – it’s essential.

But what is the best way to fetch token data from Raydium? Enter Moralis’ Raydium Solana API, streamlining the process of fetching and integrating data directly from the DEX! 

With the Raydium Solana API, you can get detailed swap data, prices, OHLCV data, pairs, and much more with only single lines of code, allowing you to build Web3 projects both faster and smarter. 

Want to learn more about how this works? Join us in today’s guide as we introduce the Raydium Solana API and walk you through a comprehensive tutorial on how it works in practice. Let’s dive straight in.

What is a Raydium API?

The simplest way to explain a Raydium API is to break it down word by word. As such, let’s start with a brief introduction to Raydium! 

Text: "What is Raydium?"

Raydium is a decentralized exchange (DEX) built on the Solana blockchain network. More specifically, it’s an automated market maker (AMM) platform where users can swap, trade, and provide liquidity to earn yield on their cryptocurrency assets. 

An API – short for application programming interface – is a collection of rules, methods, and protocols that allow different software to communicate with each other. It defines how requests and responses are to be structured, enabling seamless integration between two systems. 

In short, a Raydium API is an interface that allows you to effortlessly fetch and integrate data about tokens that are being traded on the Raydium DEX. It can be used to fetch token prices, swaps, and other essential data needed when building powerful decentralized applications (dapps). 

So, what is the best Raydium API? For the answer to this question, join us in the following section as we introduce Moralis’ Raydium Solana API! 

Raydium Solana API

Moralis is a leading crypto data provider, offering a world-class developer experience by providing a variety of Web3 APIs and next-generation RPC nodes. Experience the industry’s most comprehensive responses, full cross-chain support, and enterprise-grade security, allowing you to build dapps faster and more efficiently.

Moralis Raydium Solana API.

The Raydium Solana API is the ultimate tool for integrating token data from the Raydium DEX into any crypto-based project. Here’s what you can get using this premier interface: 

  • Token Swaps: Get all swap-related transactions – including buy, sell, add liquidity, and remove liquidity – for a pair or token address. 
  • Token Pairs: Fetch all supported pairs of a specific token by its address.
  • Token Pair Stats: Query analytics for a token pair by address, including total buy volume, sell volume, and much more. 
  • Real-Time Prices: Get the token price – denominated in both USD and the chain’s native currency – based on any given contract address.
  • OHLCV Data: Fetch the open, high, low, close, and volume data for a token by pair address. 

…and much more!

All in all, the Raydium Solana API is a one-stop shop for token data on the Raydium exchange, allowing you to fetch everything from swaps to OHLCV data with single API calls. Please check out the Raydium API documentation to learn more about all supported endpoints and DEXs.

Full Tutorial: How to Get Token Swaps From Raydium with Moralis API

With an overview of the Raydium Solana API, let’s take a closer look at how this tool works in practice. More specifically, we’ll show you how to get token swaps from the Raydium DEX in three simple steps: 

  1. Get an API Key
  2. Write Your Script
  3. Run the Code

But before we can kickstart this tutorial, you need to handle a couple of prerequisites!

Prerequisites

If you haven’t already, make sure to install the following before proceeding:

  • Node.js v14+
  • npm/yarn

Step 1: Get an API Key

To kick things off, create an account with Moralis by clicking the ”Start for Free” button at the top right: 

Red arrow pointing at "Start for Free" button.

Once you have an account at hand, you’ll find your Moralis API key under the ”Home” tab in the admin panel: 

Red arrow pointing at copy button for API key.

Copy your key for now, as you’ll need it in the next step to call the Raydium Solana API. 

Step 2: Write Your Script

Open your preferred integrated development environment (IDE), create a new folder, launch a terminal, and set up a new Node.js project with this command: 

npm init

Next, install the required dependencies: 

npm install node-fetch --save
npm install moralis @moralisweb3/common-evm-utils

From here, open your ”package.json” file and add ”type”: ”module” to the list:

Type Module highlighted

Next, create an ”index.js” file and add the following code, which is used to fetch the swaps of a token based on a pair address: 

import fetch from "node-fetch";

const options = {
 method: "GET",
 headers: {
   accept: "application/json",
   "X-API-Key": "YOUR_API_KEY",
 },
};

fetch(
 "https://solana-gateway.moralis.io/token/mainnet/pairs/FdjBRWXzieV1Qtn8FLDWWk2HK1HSQWYduo8y4F1e8GWu/swaps",
 options
)
 .then((response) => response.json())
 .then((response) => console.log(response))
 .catch((err) => console.error(err));

Here, you need to make a few minor changes to the code. To start, replace YOUR_API_KEY with the key you fetched during the first step. Next, change the pair address to fit your preferences:  

In addition to the parameters above, you can also make even more specific queries. Here are some of the other parameters you can include: 

  • fromDate: The starting date.
  • toDate: The ending date.
  • order: The order of the results, either descending or ascending.
  • transactionTypes: The transaction types to be fetched. Either buy, sell, addLiquidity, or removeLiquidity

Step 3: Run the Code

Once you’re happy with your request, all that remains is to run the code. To do so, execute the following terminal command in the project’s root folder: 

node index.js

In return, you’ll get a list of transactions. Here’s an example of what it might look like: 

{
  "cursor": "//…",
  "page": 1,
  "pageSize": 100,
  "exchangeLogo": "https://entities-logos.s3.amazonaws.com/raydium.png",
  "exchangeName": "Raydium CLMM",
  "exchangeAddress": "CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK",
  "pairAddress": "FdjBRWXzieV1Qtn8FLDWWk2HK1HSQWYduo8y4F1e8GWu",
  "pairLabel": "Fartcoin /SOL",
  "baseToken": {
    "address": "9BB6NFEcjBCtnNLFko2FqVQBq8HHM13kCyYcdQbgpump",
    "name": "Fartcoin ",
    "symbol": "Fartcoin ",
    "logo": "https://ipfs.io/ipfs/QmQr3Fz4h1etNsF7oLGMRHiCzhB5y9a7GjyodnF7zLHK1g",
    "decimals": "6"
  },
  "quoteToken": {
    "address": "So11111111111111111111111111111111111111112",
    "name": "Wrapped SOL",
    "symbol": "SOL",
    "logo": null,
    "decimals": "9"
  },
  "result": [
    {
      "transactionHash": "GDna2AQJaLcQdnEHAvJHDNcTaCQ9GntmgzYuTbYRKgVEnpYTWhT8doFUUwWgJ7XLLXTNV7qUzo4nosT8LUTke78",
      "transactionType": "buy",
      "transactionIndex": 3,
      "subCategory": "accumulation",
      "blockTimestamp": "2025-03-21T12:19:30.000Z",
      "blockNumber": 328215525,
      "walletAddress": "MfDuWeqSHEqTFVYZ7LoexgAK9dxk7cy4DFJWjWMGVWa",
      "baseTokenAmount": "390.709256000",
      "quoteTokenAmount": "1.102431678",
      "baseTokenPriceUsd": 0.3534886,
      "quoteTokenPriceUsd": 126.487716798,
      "baseQuotePrice": "0.002794647646020197",
      "totalValueUsd": 138.111268046
    },
    //...
  ]
}

In addition to the list of transactions, each event is enriched with more valuable data. Here are some interesting examples: 

  • transactionType: Shows the type of transaction (buy or sell)
  • subCategory: Displays the transaction sub-category. Can, for instance, be accumulation, partialSell, newPosition, etc. 
  • walletAddress: The wallet address involved in the transaction.
  • totalValueUsd: The total value of the swap denominated in USD.

… and much more!

That’s it; it doesn’t have to be more challenging than this to fetch swap data for a token when working with Moralis. And thanks to the richness of the response, you only need a single API call to, for instance, build a detailed, real-time transaction table like the one below: 

To learn more about this endpoint, check out the official get swaps by pair address docs page.  

Why is Moralis’ Raydium API the Top Choice?

Now that you have familiarized yourself with the Raydium API, you might be asking yourself: ”What makes Moralis the top choice?” To answer this question, let’s explore some of the main benefits of using the API: 

  • Outcome-Oriented API Responses: The Solana Raydium API and other tools offered by Moralis are designed with the outcome in mind, giving you more data with fewer calls. For instance, get all swaps of a token – enriched with prices, transaction types, category tags, and more – all with one single request. 
  • Intuitive Developer Experience: Fetch token prices, swaps, pairs, and much more from Raydium with single API calls. Integrating and analyzing data from the Raydium DEX has never been easier. 
  • Enterprise-Grade Security & Reliability: Moralis for Developers is SOC 2 Type 2 certified, highlighting our commitment to maintaining enterprise-grade reliability and security across all features and tools. 

To summarize, Moralis offers the industry’s most comprehensive, easy-to-use, and reliable Raydium Solana API, giving you everything you need to integrate data directly from the DEX! 

Use Cases for the Raydium Solana API

The Raydium Solana API has many prominent use cases. Here are three examples you’ll likely find interesting if you’re building in the space: 

  • Real-Time Transaction Tables: Thanks to the Raydium Solana API’s rich responses, you can build a real-time transaction table with just one single endpoint. Here’s an example of what it can look like: 
Transaction Table.
  • Token Analytics Overview: With the help of the token analytics information provided by the Raydium Solana API, you can give your users seamless insight into total transactions, buys, sells, volume, and much more. Build something that looks like this without breaking a sweat:
Token analytics.
  • Price Charts: With seamless access to OHLCV data, you can build comprehensive price charts for any Raydium token that features both real-time and historical insights. Check out an example below: 
Price chart.

Transaction tables, token analytics, and price charts are only three prominent use cases for the Raydium Solana API, and you can build many more features with this premier interface!

Exploring Other Tools & Features Beyond the Raydium API

In addition to the Raydium API, Moralis offers a broad set of other top-tier Solana-compatible APIs. Let’s explore three prominent examples below: 

  • Wallet API: Get any wallet’s full history, holdings, profitability, and more with minimal code. This is a premier interface for anyone looking to build portfolio trackers, tax tools, and other similar platforms that rely on wallet-related data. 
  • NFT API: Fetch NFT balances and rich metadata for any token across the Solana network and other EVM chains. Use this top-tier interface to streamline reliable NFT data integration into your websites, applications, and other crypto-related projects. 
  • Price API: Query real-time DEX prices, trading data, and OHLCV insights for any token. With the Price API, you can integrate price data into your projects with single lines of code, allowing you to build powerful features like trading charts, transaction tables, and much more with ease. 

Check out the Solana API page to learn more about the interfaces above and other tools offered by Moralis! 

Summary: Moralis Raydium API – How to Get Data From Raydium in 2025

Raydium is a leading DEX on the Solana blockchain, making it a valuable marketplace to track for anyone looking to build exchange terminals, analytics platforms, and other similar projects. But what is the best way to track tokens on the Raydium DEX? Enter Moralis’ Raydium Solana API! 

Text: "Summary: Moralis Raydium API - How to Get Data From Raydium in 2025"

The Raydium Solana API is a top-tier API for anyone looking to get token data from Raydium. Here’s some of the information you can fetch using this premier interface: 

  • Token Swaps: Fetch all swap-related transactions for a pair or token address.
  • OHLCV data: Get the OHLCV data of any token by pair address.
  • Token Pairs: Get all supported pairs of a token. 
  • Token Pair Stats: Fetch analytics for a token, including total buy volume, sell volume, etc. 
  • Real-Time Prices: Get any token’s price denominated in both the chain’s native currency and USD.

…and much more! 

With the Raydium Solana API, you can build world-class features like real-time transaction tables, interactive price charts, and much more with minimal effort. So, if you want to start building smarter and more efficiently, sign up for a free Moralis account today! 

If you liked this tutorial, feel free to check out other content here on the blog. For example, explore our Pump Fun API article or dive into the best SimpleHash API alternative.

Related Articles