# Contracts

Government contracts, grants and opportunities.

```text
"sources": ["contracts"]
```

The `contracts` source is government spending: contract and grant awards, opportunities, and the organisations that receive them. Most results are awards. A result names the agency, the recipient and, for an award, the amount and its currency.

## Good for

- Who buys what: awards by subject, with agency, recipient and amount.
- Finding open opportunities in a line of work.
- Checking a supplier's history with public buyers.

## Not the place for

- Private-sector contracts. Agreements a public company disclosed are in `finance`.
- Sorting by date: results here carry no `published_date`.

## What a result carries

Every result has the same fields whatever the source; the [Search reference](https://millionshort.com/docs/search/parameters#a-result) lists them. What differs is which of them are filled in:

| Field | In this source |
|---|---|
| `published_date` | `null`. |
| `page_type`, `topic` | `null`. |
| `popularity` | The popularity of the official site that publishes the record. |
| `signals` (with `explain`) | `text_rank` is set. |
| `extra` | `record_type` (for example `Award` or `Recipient`), `agency`, `recipient`, and for awards `amount` and `currency`. |

The `extra` keys are what this source returns today. Treat every one of them as optional: read it if it is there.

## Example queries

- `bridge inspection services`
- `road resurfacing`
- `language translation services`

Ten records with the agency, the recipient and the amount:

```bash
curl https://api.millionshort.com/v1/search \
  -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "bridge inspection services",
    "sources": ["contracts"],
    "num_results": 10
  }'
```

```python
import os

from millionshort import MillionShort

client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"])

r = client.search(
    "bridge inspection services",
    sources=["contracts"],
    num_results=10,
)
for hit in r.results:
    print(hit["extra"].get("agency"), hit["extra"].get("recipient"), hit["extra"].get("amount"))
print(r.usage.credits, "credit(s)")
```

```ts
import { MillionShort } from 'millionshort';

const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY });

const r = await client.search('bridge inspection services', {
  sources: ['contracts'],
  numResults: 10,
});
for (const hit of r.results) {
  console.log(hit.extra.agency, hit.extra.recipient, hit.extra.amount);
}
console.log(r.usage?.credits, 'credit(s)');
```

The same call as a tool of the MCP server:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "search",
    "arguments": {
      "query": "bridge inspection services",
      "sources": [
        "contracts"
      ],
      "num_results": 10
    }
  }
}
```

## Combine it with

`news` for coverage of a large award, `law` for the regulation behind a requirement. One call can ask up to five sources and returns one merged list; each result says which source it came from in `source`. See [Mixture of Experts](https://millionshort.com/docs/search/mixture-of-experts).

## Cost and limits

A search of this source costs 1 credit, like every source, and covers the first 10 results of the call. It is not one of the heavy sources, so only the plan's ordinary requests-per-minute limit applies. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers.

With [Monitor](https://millionshort.com/docs/monitor/parameters), a query monitor can watch this source, with a shortest interval of 24 hours.
