Skip to content

Code.gov

The primary platform for Open Source and code sharing for the U.S. Federal Government

Open documentation ↗
API keyHTTPSNo CORSGovernment

Checked today: not responding

API key

Required

HTTPS

Supported

Browser calls

No, needs a proxy

Status

Failing · 0/100

Overview & Architectural Role

Code.gov provides programmatic access to the primary platform for open source and code sharing for the u.s. federal government. Delivered over secure HTTPS protocols, it exposes structured endpoints designed to integrate cleanly into modern frontend frameworks, backend microservices, and automated data pipelines without requiring local database provisioning.

Who it is built for

Engineers building web dashboards, mobile applications, CLI utilities, or background cron workers in need of reliable government data feeds.

Architectural Advantage

Consuming Code.gov removes the operational overhead of running custom scrapers, orchestrating headless browser fleets, or manually seeding and maintaining a local database. Instead of reverse-engineering volatile DOM layouts or dealing with anti-bot IP blocks, your application connects directly to a standardized JSON interface designed for backend ingestion with consistent schema schemas. Dedicated authentication ensures rate quotas and credential tracking per project environment.

What our checks found

Health score
0/100
Reliability
0%
Average latency
3994ms

Last checked 2026-10-24. Measured independently, not self-reported by the provider.

Core Use Cases & Architecture Ideas

Practical real-world patterns for integrating Code.gov into software systems.

Automated SaaS Feature Integration

Embed data and functionality from Code.gov directly into application onboarding, profile enrichment, or reporting dashboards.

Architecture: Backend service worker fetches Code.gov during user workflows, caches responses in Redis, and hydrates UI state.

Scheduled Reporting & Monitoring Bot

Periodically extract updates from Code.gov to generate daily digests, analytics reports, or Slack notifications.

Architecture: A scheduled GitHub Action or cron worker executes a lightweight script calling Code.gov, formatting markdown summaries for stakeholders.

Rapid Prototyping & Hackathon Showcase

Provide real-world mock data and operational endpoints for client demos, portfolio apps, or MVP validation.

Architecture: Static client SPA queries Code.gov directly to populate mock dashboards, graphs, and interactive UI states without a custom backend.

Code Implementation Examples

Production-ready starting templates with error handling for Code.gov.

// Requires an API key. Check the docs for whether it goes in a header or a query parameter.
// Modern native fetch with error handling
async function callApi() {
  try {
    const response = await fetch('https://code.gov/api/v1/resource', {
      method: 'GET',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      Accept: 'application/json',
    },
    });

    if (!response.ok) {
      throw new Error(`HTTP ${response.status}: ${response.statusText}`);
    }

    const data = await response.json();
    console.log('Response payload:', data);
    return data;
  } catch (error) {
    console.error('API request failed:', error);
    throw error;
  }
}

// callApi();

This API does not send CORS headers, so a browser will block a direct call from your front end. Call it from your server, or put a small proxy in front of it.

Response Payload & Live Testing

Inspect the expected JSON structure returned by Code.gov.

Expected JSON Response Payload

Authentic sample payload structure to evaluate schema attributes before integration.

{
  "status": 200,
  "api": "Code.gov",
  "endpoint": "/code-gov",
  "data": {
    "id": 101,
    "title": "Code.gov Sample Payload",
    "description": "The primary platform for Open Source and code sharing for the U.S. Federal Government",
    "verified": true,
    "category": "Government",
    "updated_at": "2026-10-24T07:39:09.158Z"
  },
  "meta": {
    "response_time_ms": 3994,
    "cached": false
  }
}
Format: application/json

Integration Considerations & Best Practices

Technical factors to keep in mind when integrating Code.gov into production environments.

Implement In-Memory or Edge Caching

Avoid triggering rate limits on public feeds by caching response payloads in Redis, Vercel KV, or standard HTTP Cache-Control headers with a 5-to-15 minute TTL.

Shield Credentials in Backend Route Handlers

Never expose private API keys in client-side JavaScript or bundle environments. Proxy requests through a Next.js API route or serverless backend to keep secret keys out of public DevTools inspection.

CORS Proxy Required for Browser Frontend Calls

This API does not send Access-Control-Allow-Origin response headers. Direct fetch() calls from browser JavaScript will fail due to Same-Origin Policy. Route your calls through a server backend or lightweight edge proxy.

Validate HTTP Status Before Parsing JSON

Always inspect response.ok before executing response.json(). Upstream services returning 4xx or 502 Bad Gateway often serve HTML error pages, which cause syntax errors when parsed as JSON.

Where this listing comes from

Aggregated from 2 public sources (public-api-lists, public-apis), then normalised and checked by us.

Report an issue with this listing ↗

Other Government APIs

See all 146 →

Bidledger

Government

Every open public tender in the European Union, rebuilt daily from the official TED data

No keyCORSHTTPS

Verified today: 100% uptime

View Details

Brazil

Government

Community driven API for Brazil Public Data

No keyCORSHTTPS

Verified today: 100% uptime

View Details

EditalMD

Government

Brazilian public procurement (PNCP) notices as Markdown with deadlines and requirements

No keyCORSHTTPS

Verified today: 100% uptime

View Details

Indian Mandi Prices

Government

Free, keyless daily wholesale mandi prices for 5 Indian states, sourced from data.gov.in

No keyCORSHTTPS

Verified today: 100% uptime

View Details

Code.gov — common questions

Answered from what our own scheduled checks found, not from the provider's marketing.

Is Code.gov free to use?

Code.gov is listed in our free catalogue, but it requires an API key, so you will need to register before your first call. Providers frequently reserve higher limits and commercial use for paid plans.

Does Code.gov need an API key?

Yes. Code.gov authenticates with an API key. Keep it server-side rather than in browser code, because anything in your frontend bundle is readable by anyone who opens developer tools.

Can I call Code.gov from browser JavaScript?

Not directly. Code.gov did not return CORS headers when we checked, so the browser will block your page from reading the response even though the request itself succeeds. Call it from a server, or put a small proxy in front of it.

Is Code.gov still working?

Not at our last check on 2026-10-24. Code.gov did not respond successfully, which is why it is marked as down here. This may be temporary; we re-check on a schedule and the badge above reflects the most recent run.

Is Code.gov available over HTTPS?

Yes. Code.gov serves over HTTPS, so you can call it from a secure page without triggering a mixed-content block.