# Connect curl to SAM.gov data

To call SAM.gov data with curl, send curl "https://samgovapi.io/api/v1/registration-status/<UEI>" -H "Authorization: Bearer $SAMGOVAPI_API_KEY". The MCP server answers plain JSON-RPC too: POST {"jsonrpc":"2.0","id":1,"method":"tools/list"} to https://samgovapi.io/api/mcp to see every tool, or tools/call to run one.

curl is the shortest path from a key to an answer, and the best way to debug any client on this page: if curl works with your key, the problem is in the client's configuration.

- Connects with: MCP or REST
- MCP server: https://samgovapi.io/api/mcp
- REST base: https://samgovapi.io/api/v1
- Auth: Authorization: Bearer <key>, kept in SAMGOVAPI_API_KEY
- Tested: Raw JSON-RPC tools/list and tools/call without initialize, as above (2026-11-13)

## Get a key

Free key at https://samgovapi.io/sign-up, or have the agent call start_signup and approve the link it shows you. Keep the key in SAMGOVAPI_API_KEY so it is not saved in shell history.

## Set up curl

1. REST lookup

Terminal:

```bash
curl "https://samgovapi.io/api/v1/registration-status/ZXBCU6K5KL99" \
  -H "Authorization: Bearer $SAMGOVAPI_API_KEY"
```

2. REST search: Quote the URL so the shell leaves the ampersands alone.

Terminal:

```bash
curl "https://samgovapi.io/api/v1/opportunities?naics=541512&open=true&sort=deadline&limit=5" \
  -H "Authorization: Bearer $SAMGOVAPI_API_KEY"
```

3. MCP: list tools: The server is stateless, so a single POST works without an initialize handshake.

Terminal:

```bash
curl -s https://samgovapi.io/api/mcp \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $SAMGOVAPI_API_KEY" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
```

4. MCP: call a tool

Terminal:

```bash
curl -s https://samgovapi.io/api/mcp \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $SAMGOVAPI_API_KEY" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"registration_status","arguments":{"id":"ZXBCU6K5KL99","user_request":"check registration"}}}'
```

## Finish account setup once

Data tools unlock after the account answers its onboarding questions: ask the agent to set up your samgovapi account (get_onboarding_questions, then answer_onboarding). Free.

## Check that it works

Expected response (trimmed):

```json
{
  "data": {
    "uei": "ZXBCU6K5KL99",
    "status": "active",
    "expiration_date": "2027-10-20",
    "renewal_window": "current",
    "as_of": "2026-11-01"
  },
  "meta": {
    "credits_charged": 1
  }
}
```

## Things to know

- GET on the MCP URL answers 405 by design: the server has no SSE stream.

## Troubleshooting

- 405 Method Not Allowed: Use POST for the MCP endpoint.
- zsh: no matches found: Quote the URL.
- isError true with ONBOARDING_REQUIRED: Answer the onboarding questions once (get_onboarding_questions, then answer_onboarding); REST calls are not gated.

## Questions

### Why does the MCP call return text inside JSON?

MCP tool results are content blocks; the text block holds the JSON answer.

## Official documentation

- curl manual: https://curl.se/docs/manpage.html
- MCP: transports: https://modelcontextprotocol.io/specification/2025-06-18/basic/transports

Checked 2026-11-13. All guides: https://samgovapi.io/agents.md

Independent. Not affiliated with, endorsed by or sponsored by GSA, SAM.gov or any U.S. government agency. Registering in SAM.gov is free at sam.gov.
