GET /api/v1/data/feed • HTTP 200 OK
API Key Header Authentication Example — Request & Response Example
Demonstrates how developer platforms like Stripe, SendGrid, and OpenAI authenticate server-to-server requests using dedicated secret API keys.
1. HTTP Client Request (GET)
GET /api/v1/data/feed HTTP/1.1
{
"X-API-Key": "cmt_live_9f82a17b63c4e09d",
"Accept": "application/json"
}
2. Server JSON Response (HTTP 200 OK)
{
"authenticated_organization": "Acme Robotics Corp",
"api_tier": "Enterprise Dedicated",
"events": [
{
"id": "evt_101",
"type": "sensor.temperature",
"value": 24.2,
"timestamp": 1728211600
},
{
"id": "evt_102",
"type": "sensor.pressure",
"value": 1013.25,
"timestamp": 1728211605
}
]
}
Copy-Paste Code Snippets (cURL, JavaScript Fetch, Python, Node.js)
curl -X GET "https://cometflow.space/api/v1/data/feed" \
-H "X-API-Key: cmt_live_9f82a17b63c4e09d"
fetch('https://cometflow.space/api/v1/data/feed', {
headers: {
'X-API-Key': 'cmt_live_9f82a17b63c4e09d'
}
}).then(res => res.json()).then(console.log);
import requests
res = requests.get(
"https://cometflow.space/api/v1/data/feed",
headers={"X-API-Key": "cmt_live_9f82a17b63c4e09d"}
)
print(res.json())
How This API Call Works Step-by-Step
- 1. Secret Generation: Developer creates an API key in their developer dashboard.
- 2. Header Attachment: Attached as X-API-Key or Authorization header.
- 3. Hash Comparison: Server hashes incoming key (SHA-256) and verifies against database records.
- 4. Rate Limiting Tracked: Usage is credited against the organization quota.
Backend API Functions: The API function validateApiKey(req, res, next) compares the hashed key, looks up the organization tenant, and enforces tiered rate limits.
Frequently Asked Questions
Should API keys ever be exposed in frontend client-side code?
Never expose secret API keys in browser JavaScript. Anyone can open Developer Tools and steal your key. Proxy requests through a backend server or use restricted client-side publishable keys.