# RubyGems Gem Search API

> Ruby gems matching a search on RubyGems.org, with version, summary, total downloads, license, authors and links.

- Page: https://cleanedweb.com/catalog/rubygems-gem-search-api/
- Contract (JSON): https://cleanedweb.com/catalog/rubygems-gem-search-api/contract.json
- Source: rubygems.org (https://rubygems.org/)
- Category: Public data
- Languages: English
- Updated: 2026-12-01

## About

RubyGems.org is the public registry of Ruby libraries. One record is one gem found by a search.

Each record has the gem name, version, summary, total downloads, downloads for this version, license, authors, required Ruby version and links to the homepage and documentation.

Enter a search word, such as rails, and choose the order with sort. max_items limits how many records a run returns.

## Typical uses

- Compare gems by downloads
- Check licenses of gems you use
- Follow new versions of a gem

A run reads until the source ends or your `max_items`, `timeout_seconds` or budget stops it.

## Key fields

| Field | Type | Sample value |
| --- | --- | --- |
| `title` | string | `rails` |
| `description` | string | `Full-stack web application framework.` |
| `version` | string | `8.1.4.1` |
| `license` | string | `MIT` |
| `url` | string | `https://rubygems.org/gems/rails` |

Sample values come from one saved record, not a live run. Every field with its type, and the schemas, are in https://cleanedweb.com/catalog/rubygems-gem-search-api/contract.json. Some fields the source returns are not published, so a record can carry fields the schema does not list.

## Inputs

- `search` (string \| array of string, required): Required. Supply an array to union distinct results from each source search, in query order. Default: rails.
- `sort` (string): Order of the collection, as the site's own sort control offers it; omitted keeps the site's default order. Options: Most recently published (recent), Number of downloads (downloads), Alphabetical (name).

`enrich_records` is on by default and adds the fields that only appear on each record's detail page. Send `false` to read list fields only. See https://cleanedweb.com/docs/run-api/

## Request

`POST https://api.cleanedweb.com/v1/catalog/public/apis/generated_b448cdefdbf826fea8b06011/endpoints/generated_b448cdefdbf826fea8b06011_search/run`

```bash
curl -X POST https://api.cleanedweb.com/v1/catalog/public/apis/generated_b448cdefdbf826fea8b06011/endpoints/generated_b448cdefdbf826fea8b06011_search/run \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: UNIQUE_REQUEST_ID" \
  -H "Content-Type: application/json" \
  -d '{
  "input": {
    "search": "rails"
  },
  "version": 4,
  "max_items": 25
}'
```

Send an `Idempotency-Key` header with every run and save it before you send. Reuse it only to retry the same request. If the run does not end within `wait_seconds`, read the result with the same API key and key:

`GET https://api.cleanedweb.com/v1/catalog/public/apis/generated_b448cdefdbf826fea8b06011/endpoints/generated_b448cdefdbf826fea8b06011_search/result`

## Versions

Current: `4.0`. Pin a major with "version": N in the run body (an integer). Leave it out and the call runs on the latest major. A sunset major runs on the latest major and the response says rerouted. An unknown major answers 404 catalog_version_not_found and lists the available majors.

- v4: current, newest minor `4.0`
- v3: deprecated, newest minor `3.1`, sunsets 2027-01-30
- v1: deprecated, newest minor `1.0`, sunsets 2027-01-25

### Changelog

- `4.0` (major) 2026-12-01
  - Records are now grouped: related fields sit under shared keys, so 14 field(s) have new paths (each listed below). Callers pinned to the previous major keep the previous shape until its sunset.
  - Field \`total_downloads\` is now \`downloads.total\`.
  - Field \`detail_total_downloads\` is now \`downloads.detail_total\`.
  - Field \`for_this_version\` is now \`downloads.for_this_version\`.
  - Field \`required_ruby_version\` is now \`requirements.ruby_version\`.
  - Field \`required_rubygems_version\` is now \`requirements.rubygems_version\`.
  - Field \`new_versions_require_mfa\` is now \`mfa.new_versions_require_mfa\`.
  - Field \`version_published_with_mfa\` is now \`mfa.version_published\`.
  - Field \`homepage_url\` is now \`links.homepage\`.
  - Field \`documentation_url\` is now \`links.documentation\`.
  - Field \`report_abuse_email\` is now \`links.report_abuse_email\`.
  - Field \`versions_url\` is now \`links.versions\`.
  - Field \`previous_version_url\` is now \`links.previous_version\`.
  - Field \`rss_url\` is now \`links.rss\`.
  - Field \`reverse_dependencies_url\` is now \`links.reverse_dependencies\`.
  - Field \`latest_version_release_date\` is no longer shown by the source; it stays and is \`null\`.
- `3.1` 2026-12-01
  - Field \`latest_version_release_date\` is no longer shown by the source; it stays and is \`null\`.
- `3.0` (major) 2026-11-26
  - Field \`version\` added.
  - Field \`authors\` added.
  - Field \`detail_total_downloads\` added.
  - Field \`for_this_version\` added.
  - Field \`required_ruby_version\` added.
  - Field \`required_rubygems_version\` added.
  - Field \`new_versions_require_mfa\` added.
  - Field \`version_published_with_mfa\` added.
  - Field \`license\` added.
  - Field \`homepage_url\` added.
  - Field \`documentation_url\` added.
  - Field \`report_abuse_email\` added.
  - Field \`versions_url\` added.
  - Field \`previous_version_url\` added.
  - Field \`rss_url\` added.
  - Field \`reverse_dependencies_url\` added.
  - Field \`pushed_by\` added.
  - Field \`latest_version_release_date\` added.
  - Field \`other_details\` added.
  - Optional input \`enrich_records\` added.
  - Input \`search\` is now required; calls that omit it use \`rails\`.
  - Option \`relevance\` removed from input \`sort\`.
- `1.0` (major) 2026-11-06

The same changelog, as data, is in https://cleanedweb.com/catalog/rubygems-gem-search-api/contract.json

## Use it from an AI agent

MCP server: https://api.cleanedweb.com/mcp?profile=catalog (Streamable HTTP). Sign in with a CleanedWeb account when the client asks (OAuth), or send an API key with the `read` and `run` scopes as `Authorization: Bearer`. Call `get_api` with `api_id` `generated_b448cdefdbf826fea8b06011`, then `run_api` with the `run_with` arguments it returns. See https://cleanedweb.com/docs/mcp/

## Run it

Reading the catalog needs no credential. Running needs a CleanedWeb account and an API key with the `run` scope; the first 5,000 records are free, then $1 per 1,000 records. See https://cleanedweb.com/docs/run-catalog-api/

CleanedWeb is not affiliated with RubyGems.
