Beginner
5 min read

Getting Started

Set up your development environment and make your first API call in just a few minutes.

Prerequisites

  • A StackDev account (sign up is free)
  • Basic knowledge of HTTP requests
  • Your favorite code editor or terminal

Step 1: Create Your Account

If you haven't already, create a free StackDev account to get access to our APIs and dashboard.

Step 2: Get Your API Key

Navigate to your dashboard and create a new API key. This key will authenticate your requests to our API.

🔑 API Key Best Practices

  • • Never commit API keys to version control
  • • Use environment variables to store keys
  • • Rotate keys regularly for better security
  • • Use different keys for development and production

Step 3: Make Your First Request

Let's make a simple API call to verify everything is working correctly.

Using cURL

Terminal
curl -X GET https://api.devdocs.com/v1/health \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"

Using JavaScript (fetch)

main.js
const API_KEY = process.env.DEVDOCS_API_KEY;
async function checkHealth() {
try {
const response = await fetch('https://api.devdocs.com/v1/health', {
method: 'GET',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log('API Response:', data);
} catch (error) {
console.error('Error:', error);
}
}
checkHealth();

Using Python (requests)

main.py
import os
import requests
API_KEY = os.getenv('DEVDOCS_API_KEY')
def check_health():
url = 'https://api.devdocs.com/v1/health'
headers = {
'Authorization': f'Bearer {API_KEY}',
'Content-Type': 'application/json'
}
try:
response = requests.get(url, headers=headers)
response.raise_for_status()
data = response.json()
print('API Response:', data)
except requests.exceptions.RequestException as e:
print('Error:', e)
if __name__ == '__main__':
check_health()

Expected Response

If everything is configured correctly, you should receive a response like this:

Response
{
"status": "ok",
"message": "API is healthy",
"timestamp": "2024-01-15T10:30:00Z",
"version": "1.0.0"
}