canonical: https://jentic.com/apis/code.gov/code-gov

# Code.gov API

The Code.gov API provides programmatic access to the United States government's open-source software catalog: it lists code repositories published by federal agencies, returns repository and agency details, reports harvesting status, and enumerates the programming languages in use. Use it to discover and analyze government open-source projects.

## For AI agents

List and look up open-source repositories published by U.S. federal agencies, retrieve agency details, list programming languages, and check catalog harvesting status.

## Scope

Does not host code, accept repository submissions, or run source-control operations like commits or pull requests. Use for reading the Code.gov catalog of agencies, repositories, and languages only.

## Capabilities

- List open-source repositories published by U.S. federal agencies
- Retrieve a single repository by its repository id
- List participating agencies and get details for one by its acronym
- List the programming languages used across the catalog
- Check the harvesting status, issues, and fetch results for an agency

## Use cases

### AI agent open-source discovery

An AI agent finds relevant government open-source projects by listing an agency's repositories and filtering by programming language, then retrieves each repository's details. Through Jentic the agent finds these read operations by intent and calls them with the stored API key, without hand-building the catalog query.

Example prompt: List repositories published by the General Services Administration and return their names and languages

### Agency code inventory

Researchers building an inventory of federal open-source output list every participating agency and count the repositories each one publishes. The API returns the agency list and per-agency repository data so the inventory can be assembled and refreshed on a schedule.

Example prompt: List all agencies and record how many repositories each one has published

### Harvest status monitoring

Because Code.gov harvests each agency's code inventory, teams tracking data freshness check the harvest status, outstanding issues, and last fetch time per agency. The status endpoints report these so a monitor can flag agencies whose data is stale or failing to import.

Example prompt: Check the harvest issues for a given agency and report whether its data imported cleanly

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | `/repos` | List repositories |
| GET | `/repos/{repoId}` | Get a repository by id |
| GET | `/agencies` | List agencies |
| GET | `/agencies/{agency_acronym}` | Get an agency by acronym |
| GET | `/languages` | List programming languages |
| GET | `/status/{agencyName}/issues` | Get harvest issues for an agency |

## Key resources

- **Repositories** — List and retrieve open-source repositories published by federal agencies
- **Agencies** — List participating agencies and get details for one by its acronym
- **Languages and status** — List programming languages in the catalog and report per-agency harvest status

## Why Jentic

- **Setup:** Querying the Code.gov API by hand means supplying an API key on each request, paging through repository results, and matching agency acronyms to their records. Through Jentic you install once, import Code.gov from the API Directory, store the key once, and your agent calls it.
- **Permission scoping:** Every Code.gov operation is a read, and the agency acronym or repository id sits in the URL path, so a rule can pin your agent to one agency's repositories. You choose the operations it may call, so the agent only reads the catalog data you allow.
- **Credential handling:** Your Code.gov API key is stored once, encrypted, by your own Jentic One instance and injected at request time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'list an agency's repositories' or 'list programming languages', and Jentic returns the matching Code.gov operation with its input schema so the agent calls the right endpoint without reading the API docs.

## Related APIs

- **USA.gov** — Official directory of U.S. government agencies, services, and contact data.
- **National Park Service** — Data on U.S. national parks, alerts, events, and visitor information.
- **Country State City** — Reference data for countries, states, and cities worldwide.

## FAQ

### Is there a Code.gov MCP server?

You don't need an MCP server to connect your agent to the Code.gov API. Jentic connects it directly from the API Directory: import Code.gov, store your API key once, and your agent lists repositories, agencies, and languages on demand.

### Can I limit what my agent is allowed to do with the Code.gov API?

Yes. Because every operation is read-only, you can allow your agent just the repository and language lookups and leave the status endpoints out. The agency acronym sits in the URL path, so you can even scope it to a single agency, and every call the agent makes is logged.

### What authentication does the Code.gov API use?

The Code.gov API requires an API key from api.data.gov, sent with each request. Through Jentic the key is stored once by your self-hosted instance and injected at call time, so it never reaches the agent's context.

### Can I list all repositories from one agency with the Code.gov API?

Yes. Look up the agency by its acronym, then list repositories filtered to that agency to get its published open-source projects with their languages and descriptions. Page through the results for agencies with large catalogs.

### What are the rate limits for the Code.gov API?

The OpenAPI spec does not specify rate limits. Code.gov uses api.data.gov keys, which apply their own per-key hourly limits, so check your key's quota before large crawls.

### How do I connect the Code.gov API to my AI agent?

Search the Jentic API Directory for the Code.gov operation you need, such as listing an agency's repositories, and import it. To run it on your own infrastructure, install Jentic One from its GitHub repo, then your agent calls the API with your API key injected at execution time.
