API Authentication

Required

Secure access to Portfolio API endpoints using API keys and modern authentication patterns.

Last updated: December 15, 20242 min read
In this guide:
SetupConfigurationExamples
API Key Authentication
Simple and secure authentication using API keys in request headers.

Header Format

Authorization: Bearer YOUR_API_KEY

Example Request

curl -H "Authorization: Bearer pk_live_12345..." \
     https://journey.thakurganeshsingh.com/api/profile

🔑 Getting Your API Key

Step 1: Request Access

Contact me directly to request API access. Include your use case and expected usage volume.

📧 thakur.ganeshsingh@gmail.com💼 LinkedIn Message
Step 2: Receive Credentials

You'll receive your API key via secure email along with usage guidelines.

🛡️ Authentication Methods

RecommendedBearer Token
Standard OAuth 2.0 Bearer token authentication
Authorization: Bearer pk_live_1234567890abcdef
✅ Most secure
✅ Industry standard
✅ Works with all HTTP clients
AlternativeAPI Key Header
Custom header for API key authentication
X-API-Key: pk_live_1234567890abcdef
⚠️ Less common
⚠️ Custom implementation
✅ Simple to implement

🔒 Security Best Practices

Important Security Guidelines
Never expose API keys in client-side code
API keys should only be used in server-side applications
Store keys in environment variables
Use .env files or secure secret management systems
Use HTTPS for all requests
All API endpoints enforce SSL/TLS encryption
Rotate keys regularly
Contact support to rotate compromised or old keys

❌ Authentication Errors

401Unauthorized
{
  "error": "Unauthorized",
  "message": "Missing or invalid API key",
  "code": 401,
  "details": "Please provide a valid API key in the Authorization header"
}
403Forbidden
{
  "error": "Forbidden", 
  "message": "API key does not have permission for this resource",
  "code": 403,
  "details": "Contact support to upgrade your access level"
}

💻 Code Examples

JavaScript/Node.js
// Using fetch API
const response = await fetch('https://journey.thakurganeshsingh.com/api/profile', {
  headers: {
    'Authorization': 'Bearer ' + process.env.API_KEY,
    'Content-Type': 'application/json'
  }
});

// Using axios
const axios = require('axios');
const client = axios.create({
  baseURL: 'https://journey.thakurganeshsingh.com/api',
  headers: {
    'Authorization': 'Bearer ' + process.env.API_KEY
  }
});
Python
import requests
import os

# Using requests library
headers = {
    'Authorization': f'Bearer {os.getenv("API_KEY")}',
    'Content-Type': 'application/json'
}

response = requests.get(
    'https://journey.thakurganeshsingh.com/api/profile',
    headers=headers
)