Public APIs
PoetryDB favicon

PoetryDB

Books

Enables you to get instant data from our vast poetry collection.

PoetryDB's website screenshot

About PoetryDB

PoetryDB is a free API providing programmatic access to a database of poems, returning results in JSON format. Users query it by constructing URLs that specify search fields such as author, title, lines, or line count, with optional exact-match or partial-match search types. Responses can be filtered to return specific output fields (author, title, lines, linecount) or the full poem data.

The API is built with Ruby and Sinatra, with poetry data stored in a MongoDB database; the underlying database itself is not directly accessible, but the Ruby server code is available as open source under the GPL-2.0 license. Query parameters also support random poem selection and limiting the number of poems returned.

This is intended for developers building applications that programmatically retrieve or manipulate poetry text, such as generating new works from combined lines of existing poems matching given criteria (for example, retrieving all 14-line poems by an author to construct new sonnets).

Key features

  • Search poems by author, title, line content, or line count
  • Returns poem data in JSON format via simple URL requests
  • Retrieve random poems or a specified count of poems
  • Combine or restrict query results to specific output fields (author, title, lines, linecount)
  • Supports exact-match or partial-match search types
  • Open source Ruby/Sinatra codebase backed by a MongoDB database

Frequently asked questions

What is PoetryDB?

PoetryDB is a free API that returns poetry data (author, title, lines, linecount) in JSON format via simple URL requests.

What languages or platforms does it support?

The API itself is language-agnostic since it's accessed via URL requests, and the underlying code is written in Ruby using the Sinatra framework.

How do I query the API?

You construct a URL with an input field like author, title, lines, linecount, poemcount, or random, followed by a search term and optional output fields, e.g. https://poetrydb.org/title/Ozymandias/lines.json.

Is the source code available?

Yes, the Ruby code is open source and available in this GitHub repository under the GPL-2.0 license.

Can I access the underlying poetry database directly?

No, the PoetryDB database is not directly accessible in order to preserve its integrity.

Advertise here

Featured products

  • SerpApi - Search API favicon
  • Screenshot Scout favicon
  • TalorData favicon
  • CoreClaw favicon

Show your product to thousands of developers

· 100k monthly pageviews
· 7k newsletter subscribers

Advertise your product