# Bubble

MillionShort search as a step in Bubble, with one call to the API.

Recipe · An HTTP step · Key in a form field · Checked 2026-11-19

> **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed.
> The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer <key>`, or no header for the no-key mode).
> On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once.
> Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md.

## 1. Call the API in an HTTP step

Install the **API Connector** plugin and add an API:

```text API Connector
API Name:        millionshort
Authentication:  Private key in header
  Key name:      Authorization
  Private key:   Bearer ms-YOUR_API_KEY
Call:            search, used as an Action (or as Data)
  Method:        POST
  URL:           https://api.millionshort.com/v1/search
  Body (JSON):   {"query": "<query>", "remove_top_sites": 1000, "num_results": 5}
```

Include `Bearer ` and a space in the private key. **Initialize call** runs it once so Bubble learns the shape of the answer; `<query>` becomes a parameter of the call.

## 2. Try it

Ask Bubble's agent, or run the step with this as the query:

> Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links.

A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before.

## 3. Tell it when to search

Bubble has no search of its own, so say which search to use.

If an AI step reads the results, tell it:

> Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns.

## 4. Check it works

**Initialize call** shows each field that came back. The call then appears under the API Connector in the workflow editor.

A search that worked returns `data.results`, each with a `title`, a `url` and a `snippet`, and `usage.credits`: what it cost.

## Tools

| Tool | What it does | Without a key | Cost |
|---|---|---|---|
| `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results |
| `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit |
| `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free |
| The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs |

## Costs and limits

A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers.

## When it fails

| What you see | Why | Fix |
|---|---|---|
| `401 AUTH_MISSING_KEY` or `AUTH_INVALID_KEY` | The key is missing or wrong | Set `MILLIONSHORT_API_KEY`; keys start with `ms-` |
| `400 INVALID_PARAM` | A field name or value the API does not take | The `message` names the field; the [search reference](https://millionshort.com/docs/search/parameters) lists them all |
| `429 RATE_LIMITED` or `CAPACITY` | Too many calls a minute, or no free capacity right now | Wait the `Retry-After` seconds, then retry |
| `429 INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; do not retry |

## Related

- [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows.
- [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes.
- More low-code builders: [n8n](https://millionshort.com/docs/integrations/n8n), [Zapier](https://millionshort.com/docs/integrations/zapier), [Make](https://millionshort.com/docs/integrations/make), [Dify](https://millionshort.com/docs/integrations/dify), and [every integration](https://millionshort.com/docs/integrations).
- Bubble's own documentation, read on 2026-11-19: [API Connector](https://manual.bubble.io/help-guides/integrations/api/the-api-connector), [Authentication](https://manual.bubble.io/help-guides/integrations/api/the-api-connector/authentication).
