DataGraph API Documentation
Quick Start
Get started with DataGraph in 3 simple steps:
2. Make your first request
curl -H "Authorization: Bearer YOUR_API_KEY" \
https://api.datagraph.city/api/nyc/query \
-d '{"query": "Properties under $800K in Brooklyn"}'
3. Parse the response
{
"results": [...],
"count": 42,
"execution_time_ms": 123,
"query_type": "graph"
}
Using DataGraph with Claude (MCP)
The easiest way to use DataGraph is through Claude Desktop with the Model Context Protocol (MCP). This allows Claude to query NYC urban data (6.9M+ nodes including transit, DOB permits, property sales, crime data, and demographics) directly in your conversations.
💡 Recommended: Use MCP for the best experience. Claude can intelligently query city data and provide insights without you writing any code.
2. Configure MCP
Add DataGraph to your Claude Desktop configuration:
Mac: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"datagraph": {
"command": "npx",
"args": [
"-y",
"datagraph-city-mcp-server"
],
"env": {
"DATAGRAPH_API_KEY": "your_api_key_here"
}
}
}
}
Replace your_api_key_here with your actual API key.
3. Restart Claude Desktop
After saving the configuration, restart Claude Desktop to load the DataGraph MCP server.
4. Start Querying!
Now you can ask Claude about urban data naturally:
You: "Show me subway stations in Brooklyn that are wheelchair accessible"
You: "What's the average commute time from Queens to Manhattan?"
You: "Find neighborhoods near the L train with good transit access"
✨ Pro Tip: Claude will automatically use DataGraph when you ask questions about cities, neighborhoods, transit, or urban data. No need to specify the API!
Authentication (Direct API Access)
If you're making direct API calls (not using MCP), all requests require authentication using an API key in the Authorization header:
Authorization: Bearer dgc_your_api_key_here
Security: Never share your API key or commit it to version control. Use environment variables.
API Endpoints
/api/{city}/query
Query city data using natural language
{
"query": "Properties under $800K near transit",
"city": "nyc",
"limit": 10
}
/me
Get current user information and usage stats
/cities
List all supported cities and their available datasets
/usage
Get detailed usage statistics and query history
Example Queries
Real Estate
"Show recent property sales in Brooklyn"
"Properties at 552 West 43 Street"
"Find buildings with DOB permits in Manhattan"
"Show property ownership for this address"
DOB Permits & Buildings
"Recent construction permits in Queens"
"Show all permits for a specific building"
"Find buildings with active permits"
"Permits filed by a specific applicant"
Crime & Safety
"Crime statistics in Brooklyn neighborhoods"
"Show complaints by precinct"
"Recent incidents near a location"
"Crime patterns by offense type"
Transit & Location
"Neighborhoods within 0.5 miles of subway"
"Properties with best transit access"
"Commute time to Manhattan from Queens"
Subway Graph Queries
"List all subway stations in Manhattan"
"Show stations on the A train"
"Find connections from Times Square"
"Show transfer stations between L and 1 trains"
"List accessible stations in Brooklyn"
Graph queries leverage station connectivity data to find routes, transfers, and optimal paths through the subway network.
Business Intelligence
"Best neighborhoods for opening a coffee shop"
"Restaurant density by area"
"Retail competition in SoHo"
Supported Cities
| City | Code | Status |
|---|---|---|
| New York City | nyc |
Active |
| San Francisco | sf |
Coming Soon |
| Chicago | chicago |
Coming Soon |
Error Handling
401 Unauthorized
Invalid or missing API key
429 Too Many Requests
Rate limit or quota exceeded
404 Not Found
City not available