Skip to content
Switch branches/tags


Failed to load latest commit information.
Latest commit message
Commit time
Aug 16, 2020
Jun 15, 2020
Jun 15, 2020
Aug 23, 2020

Tests Coverage Status npm version npm downloads Twitter Follow

The Rick and Morty API JavaScript client

Hey, did you ever want to hold a terry fold?, I got one right here, grab my terry flap.

This is a Node wrapper to use the The Rick and Morty API in your favourite JavaScript project.

To get started check the documentation on


npm i rickmortyapi or yarn add rickmortyapi


import { getCharacter } from 'rickmortyapi' // getCharacter()
// or
import shlaami from 'rickmortyapi' // shlaami.getCharacter()
// or
const tinyRick = require('rickmortyapi')
// You can use the name that you desire,
// You could name it Plumbus for instance,
// because a Plumbus will provide you with a lifetime of better living and happiness.

All methods return a promise.

  • getCharacter()
  • getEpisode()
  • getLocation()

All the methods work in the same way. The only exception is the queries that you can pass as an object to each method. To know more about the schema of each response, please check here

Get by ID

const rick = await getCharacter(1)
const earth = await getLocation(1)
const episodeOne = await getEpisode(1)

// You can also use an array of IDs.
const theSmiths = await getCharacter([ 2, 3, 4, 5 ])
const [ earth, citadel ] = await getLocation([ 1, 3 ])
const s01 = await getEpisode(Array.from({ length: 11 }, (v, i) => i + 1))


Pass an object with the queries. To know more about filtering check the docs.

const aliveRicks = await getCharacter({
  name: 'rick',
  status: 'alive'

// You can pass page number inside the object
const planets = await getLocation({
  type: 'planet',
  page: 2

const seasonOne = await getEpisode({
  episode: 's01'

Get all

const chars = await getCharacter()
const locations = await getLocation()
const episodes = await getEpisode()

// You can pass a page number to access all the pages inside the info object
// To know more about the info object and pagination, check
const moreChars = await getCharacter({ page: 2 })
  • getEndpoints()

This method will response with the available REST endpoints, you can use it to ping the server status.