Getting Started

Up and running in under five minutes. Follow the steps below for your preferred tool.

1

No setup required

The API is public and read-only. You don't need an account or token — just send a GET request.

2

Send your first request

The example below fetches the list of planets:

Terminal
curl https://spacedb.cloud/api/v1/planets

You should receive a paginated JSON response with planet data. Try swapping planets for stars, moons, or spaceships to explore the other resources.

Fetch a single record
curl https://spacedb.cloud/api/v1/stars/1

Open Postman and create a new request:

  1. Set the method to GET and enter the URL https://spacedb.cloud/api/v1/planets
  2. Click Send.

Open Insomnia and create a new HTTP request:

  1. Set the method to GET and enter the URL https://spacedb.cloud/api/v1/planets
  2. Click Send.

API Documentation

SpaceDB is a REST API providing data on stars, planets, moons, and spacecraft. All responses are JSON. The API is read-only and fully public — no authentication required.

Download OpenAPI spec

Base URL

All endpoints are prefixed with:

http://spacedb.test/api/v1

Authentication

No authentication is currently required. All endpoints are public and read-only — only GET requests are supported.

Example request
curl http://spacedb.test/api/v1/stars

Requests are rate limited to 120 per minute. Exceeding the limit returns 429 Too Many Requests.

Responses

All successful responses return JSON. Single resources are wrapped in a data object. Collection responses include data, links, and meta.

Single resource — GET /api/v1/stars/1
{
  "data": {
    "id": 1,
    "name": "Sol",
    "type": "main_sequence",
    "mass_solar": 1,
    "luminosity_solar": 1,
    "temperature_k": 5778,
    "distance_ly": 0,
    "constellation": null,
    "discovered_at": null,
    "planet_count": 9,
    "created_at": "2026-01-01T00:00:00+00:00",
    "updated_at": "2026-01-01T00:00:00+00:00"
  }
}
Collection — GET /api/v1/stars
{
  "data": [ ... ],
  "links": {
    "first": "http://spacedb.test/api/v1/stars?page=1",
    "last":  "http://spacedb.test/api/v1/stars?page=1",
    "prev":  null,
    "next":  null
  },
  "meta": {
    "current_page": 1,
    "per_page": 25,
    "total": 8
  }
}

Pagination

List endpoints return 25 results per page by default. Use the page and per_page query parameters to paginate. Maximum per_page is 100.

GET /api/v1/planets?page=2&per_page=10

Errors

StatusMeaning
200OK — request succeeded
404Not Found — resource or endpoint does not exist
405Method Not Allowed — the API is read-only; only GET is supported
429Too Many Requests — rate limit exceeded

Stars

Stellar objects including main sequence stars, giants, white dwarfs, neutron stars, and supergiants.

The star object

FieldTypeDescription
idintegerUnique identifier
namestringName of the star
typeenummain_sequence, red_giant, white_dwarf, neutron, supergiant
mass_solarfloatMass relative to the Sun (Sol = 1.0)
luminosity_solarfloatLuminosity relative to the Sun
temperature_kintegerSurface temperature in Kelvin
distance_lyfloatDistance from Earth in light-years
constellationstring | nullHost constellation
discovered_atdate | nullDiscovery date (ISO 8601)
planet_countintegerNumber of planets linked to this star
GET /api/v1/stars List all stars

Returns a paginated list of all stars.

Request
curl http://spacedb.test/api/v1/stars
GET /api/v1/stars/{id} Get a star

Returns a single star by ID.

Request
curl http://spacedb.test/api/v1/stars/1

Planets

Planetary bodies including terrestrial planets, gas giants, ice giants, and dwarf planets.

The planet object

FieldTypeDescription
idintegerUnique identifier
namestringName of the planet
typeenumterrestrial, gas_giant, ice_giant, dwarf
star_idinteger | nullID of the parent star
mass_earthfloatMass relative to Earth (Earth = 1.0)
radius_kmfloatMean radius in kilometres
orbital_period_daysfloatOrbital period in Earth days
distance_aufloatSemi-major axis in astronomical units
has_ringsbooleanWhether the planet has a ring system
discovered_atdate | nullDiscovery date
moon_countintegerNumber of moons linked to this planet
GET/api/v1/planetsList all planets
curl http://spacedb.test/api/v1/planets
GET/api/v1/planets/{id}Get a planet
curl http://spacedb.test/api/v1/planets/3

Moons

Natural satellites orbiting planets.

The moon object

FieldTypeDescription
idintegerUnique identifier
namestringName of the moon
planet_idinteger | nullID of the parent planet
mass_kgfloatMass in kilograms
radius_kmfloatMean radius in kilometres
orbital_period_daysfloatOrbital period in Earth days
discovered_atdate | nullDiscovery date
GET/api/v1/moonsList all moons
curl http://spacedb.test/api/v1/moons
GET/api/v1/moons/{id}Get a moon
curl http://spacedb.test/api/v1/moons/1

Spaceships

Real and fictional spacecraft, probes, space stations, and rockets.

The spaceship object

FieldTypeDescription
idintegerUnique identifier
namestringName of the spacecraft
typeenumspacecraft, probe, station, rocket
operatorstring | nullOperating agency or owner
launch_datedate | nullLaunch date
statusenumactive, retired, planned, lost
crew_capacityinteger | nullMaximum crew size (null if uncrewed)
mass_kgfloat | nullMass in kilograms
descriptionstring | nullBrief description
GET/api/v1/spaceshipsList all spaceships
curl http://spacedb.test/api/v1/spaceships
GET/api/v1/spaceships/{id}Get a spaceship
curl http://spacedb.test/api/v1/spaceships/1