Validation tools
The Public APIs repository uses automated validation scripts to ensure quality, consistency, and accuracy of all API entries. These tools run automatically when you submit a Pull Request.Overview
The validation process checks:- Link validity - All URLs are accessible and working
- Format compliance - Entries follow the correct structure
- Alphabetical ordering - APIs are sorted correctly within categories
- Duplicate detection - No duplicate links exist
- Content standards - Descriptions, auth types, and other fields meet requirements
Link validation
Purpose
The link validation script (scripts/validate/links.py) ensures that all API links in the directory are:
- Accessible and returning valid responses
- Not returning error codes (4xx, 5xx)
- Not duplicate entries
- Free from SSL/connection errors
What it checks
Duplicate links
- Scans all links in the README
- Identifies duplicate URLs
- Prevents the same API from being listed multiple times
- Case-insensitive comparison
Link accessibility
- Tests each URL with HTTP GET request
- Uses randomized User-Agent headers to avoid blocking
- Sets proper host headers
- Timeout limit: 25 seconds per link
| Error Type | Code | Description |
|---|---|---|
| Client error | ERR:CLT | HTTP 4xx responses (except Cloudflare protection) |
| SSL error | ERR:SSL | SSL certificate or security errors |
| Connection error | ERR:CNT | Unable to establish connection |
| Timeout error | ERR:TMO | Request took longer than 25 seconds |
| Redirect error | ERR:TMR | Too many redirects |
| Unknown error | ERR:UKN | Other unexpected errors |
Cloudflare protection handling
The validator intelligently handles Cloudflare-protected sites:- Detects Cloudflare DDoS protection (403, 503 responses)
- Identifies Cloudflare challenge pages
- Allows these links to pass validation
- Prevents false positives from security measures
- “Security check” pages
- “Checking your browser” messages
- Cloudflare Ray ID patterns
- Challenge tokens and redirects
How to run
Check all links
- Check for duplicate links
- Validate all links are working
Check only duplicates
Understanding output
Success:Format validation
Purpose
The format validation script (scripts/validate/format.py) ensures that all entries follow the standardized structure and meet quality requirements.
What it checks
Alphabetical order
- Verifies APIs are sorted alphabetically within each category
- Case-insensitive comparison
- Helps prevent duplicates and makes navigation easier
Title format
Checks:- Title must use
[TITLE](URL)Markdown link syntax - Title must not end with “API” or ”… API”
- Title must not include TLD (like .com, .org)
Description requirements
Checks:- First character must be capitalized
- Must not exceed 100 characters
- Must not end with punctuation (
.,!,,, etc.)
Auth field validation
Checks:- Must be one of:
OAuth,apiKey,X-Mashape-Key,User-Agent, orNo - Must be wrapped in backticks (except
No) - Uses exact case-sensitive matching
HTTPS field validation
Checks:- Must be exactly
YesorNo - Case-sensitive
CORS field validation
Checks:- Must be exactly
Yes,No, orUnknown - Case-sensitive
Table structure
Checks:- Each entry must have at least 5 columns (API, Description, Auth, HTTPS, CORS)
- Each segment must start and end with exactly 1 space
- Proper table formatting with
|separators
Category validation
Checks:- Each category must have minimum 3 entries
- Category headers must be listed in the Index section
- Headers must use
###format
How to run
Understanding output
Success:- No output (script exits with code 0)
- All checks passed
(L045)- Line number in README.md (line 46, since counting starts at 0)- Error description
Running tests locally
Before submitting a Pull Request, run both validation scripts:Automated CI checks
When you open a Pull Request:- GitHub Actions automatically runs all validation scripts
- Build status is shown in the PR
- Build logs show any errors found
- PR cannot merge until all checks pass
Viewing build results
- Look for the check status at the bottom of your PR
- Click “Details” to view full build logs
- Scroll to find any error messages
- Fix the errors and push new commits
- Checks will run again automatically
Common validation errors
Error: Alphabetical order
Problem: APIs not sorted alphabetically Fix: Reorder entries within the categoryError: Duplicate links
Problem: Same URL listed multiple times Fix: Remove the duplicate entryError: Title ends with “API”
Problem: Title like “GitHub API” instead of “GitHub” Fix: Remove ” API” from the titleError: Invalid Auth value
Problem: Using auth type not in allowed list Fix: Use one of:OAuth, apiKey, X-Mashape-Key, User-Agent, or No
Error: Description too long
Problem: Description exceeds 100 characters Fix: Shorten description to be more conciseError: Missing backticks
Problem: Auth value not wrapped in backticks Fix: ChangeapiKey to `apiKey` (except for No)
Advanced validation
Test suite
The repository includes unit tests for validators:scripts/tests/test_validate_links.pyscripts/tests/test_validate_format.py
Contributing to validators
If you want to improve the validation tools:- Fork the repository
- Modify scripts in
scripts/validate/ - Add/update tests in
scripts/tests/ - Submit a Pull Request
Learn more
- GitHub repository - Contribution guidelines
- API standards - Format requirements
- FAQ - Common questions
