Skip to content
Back to skills

007 Https 1e8e2251

ASecurity

``` https://api.stlouisfed.org/fred/ ```

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 11, 2026
researchpythonbashapi

Works with

  • api

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned October 11, 2026

npx -y skills add tools-only/X-Skills --skill 007-https_1e8e2251 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 007 Https 1e8e2251?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 007 Https 1e8e2251
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-007-https-1e8e2251/badge)](https://www.skillsdirectory.com/skills/tools-only-007-https-1e8e2251)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
# FRED API Basics

## Base URL

```
https://api.stlouisfed.org/fred/
```

For GeoFRED endpoints:
```
https://api.stlouisfed.org/geofred/
```

## Authentication

All requests require an API key passed as a query parameter:

```
api_key=YOUR_32_CHARACTER_KEY
```

### Obtaining an API Key

1. Create account at https://fredaccount.stlouisfed.org
2. Log in and request an API key
3. Key is a 32-character lowercase alphanumeric string

### Rate Limits

- API implements rate limiting
- HTTP 429 (Too Many Requests) when exceeded
- Contact FRED team for higher limits if needed

## Response Formats

All endpoints support multiple formats via `file_type` parameter:

| Format | Content-Type |
|--------|--------------|
| `xml` | text/xml (default) |
| `json` | application/json |

Some observation endpoints also support:
- `csv` - Comma-separated values
- `xlsx` - Excel format

## Common Parameters

These parameters are available on most endpoints:

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `api_key` | string | required | 32-character API key |
| `file_type` | string | xml | Response format: xml, json |
| `realtime_start` | date | today | Start of real-time period (YYYY-MM-DD) |
| `realtime_end` | date | today | End of real-time period (YYYY-MM-DD) |

## Real-Time Periods (ALFRED)

FRED supports historical (vintage) data access through real-time parameters:

- `realtime_start`: Beginning of the real-time period
- `realtime_end`: End of the real-time period
- Format: YYYY-MM-DD

This allows you to see data as it appeared at specific points in time:

```python
# Get GDP as it was reported on Jan 1, 2020
params = {
    "series_id": "GDP",
    "realtime_start": "2020-01-01",
    "realtime_end": "2020-01-01"
}
```

### FRED vs ALFRED

- **FRED**: Shows current/most recent data values
- **ALFRED**: Shows historical vintages and revisions of data

Use real-time parameters to access ALFRED data through the same API endpoints.

## Pagination

Many endpoints support pagination:

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `limit` | integer | varies | Maximum results (typically 1000) |
| `offset` | integer | 0 | Number of results to skip |

Example:
```python
# First page
params = {"limit": 100, "offset": 0}

# Second page
params = {"limit": 100, "offset": 100}
```

## Sorting

Many endpoints support sorting:

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `order_by` | string | varies | Field to sort by |
| `sort_order` | string | asc | Sort direction: asc, desc |

## Error Responses

### HTTP Status Codes

| Code | Description |
|------|-------------|
| 200 | Success |
| 400 | Bad Request - Invalid parameters |
| 401 | Unauthorized - Invalid/missing API key |
| 404 | Not Found - Invalid endpoint or resource |
| 429 | Too Many Requests - Rate limit exceeded |
| 500 | Internal Server Error |

### Error Response Format

**XML:**
```xml
<error code="400" message="Bad Request. Variable api_key has not been set."/>
```

**JSON:**
```json
{
    "error_code": 400,
    "error_message": "Bad Request. The value for variable api_key is not registered..."
}
```

## Data Types

### Date Format

All dates use YYYY-MM-DD format:
- Valid: `2023-01-15`
- Invalid: `01/15/2023`, `Jan 15, 2023`

### Missing Values

In observation data, missing values are represented as a period:
```json
{"date": "2020-01-01", "value": "."}
```

Always check for this when parsing values:
```python
value = obs["value"]
if value != ".":
    numeric_value = float(value)
```

## Tag Groups

Tags are organized into groups:

| Group ID | Description |
|----------|-------------|
| freq | Frequency (monthly, quarterly, etc.) |
| gen | General/topic tags |
| geo | Geography (usa, california, etc.) |
| geot | Geography type (nation, state, etc.) |
| rls | Release |
| seas | Seasonal adjustment |
| src | Source |
| cc | Citation/Copyright |

## Example API Call

```python
import requests

response = requests.get(
    "https://api.stlouisfed.org/fred/series/observations",
    params={
        "api_key": "YOUR_KEY",
        "series_id": "GDP",
        "file_type": "json",
        "observation_start": "2020-01-01",
        "units": "pch"
    }
)

data = response.json()
print(data)
```

## Python Setup

Install required packages:

```bash
uv pip install requests pandas
```

Environment variable setup:
```bash
export FRED_API_KEY="your_32_character_key"
```

```python
import os
api_key = os.environ.get("FRED_API_KEY")
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.