Quick Start Guide

Get up and running with Moon API in minutes. This guide will walk you through the basics of authentication and making your first API request.

1. Sign Up for an API Key

Before you can start using Moon API, you'll need to get an API key:

  1. Visit the Moon API on RapidAPI
  2. Sign up for a RapidAPI account if you don't have one
  3. Subscribe to a plan (there's a free tier available)
  4. Copy your API key from the Code Snippets section
ℹ️

Keep your API key secure and never share it publicly. If your key is compromised, you can revoke it and generate a new one from the dashboard.

2. Make Your First API Request

Let's start by getting the current moon phase using the basic endpoint:

curl
curl --request GET \
  --url 'https://moon-phase.p.rapidapi.com/basic' \
  --header 'X-RapidAPI-Key: YOUR_RAPIDAPI_KEY' \
  --header 'X-RapidAPI-Host: moon-phase.p.rapidapi.com'

The API will respond with JSON containing the current moon phase data:

json
{
  "phase_name": "Waxing Gibbous",
  "stage": "waxing",
  "days_until_next_full_moon": 3,
  "days_until_next_new_moon": 17
}

3. Using the API with Popular Languages

javascript
const getMoonData = async () => {
  const options = {
    method: 'GET',
    headers: {
      'X-RapidAPI-Key': 'YOUR_RAPIDAPI_KEY',
      'X-RapidAPI-Host': 'moon-phase.p.rapidapi.com'
    }
  };

  const response = await fetch('https://moon-phase.p.rapidapi.com/basic', options);
  const data = await response.json();
  console.log(data);
};

Next Steps