Skip to main content

Error Response Format

All Fetchin API errors return a JSON object with an error field:
{
  "error": "Error message describing what went wrong"
}

HTTP Status Codes

400 Bad Request

Invalid parameters or malformed request. Example:
{
  "error": "Missing profileUrlOrUrn parameter"
}
Common causes:
  • Missing required parameters
  • Invalid parameter format
  • Malformed LinkedIn URL
Solution:
  • Check that all required parameters are included
  • Verify parameter values are properly formatted
  • Use LinkedIn profile URLs in the correct format

401 Unauthorized

Invalid or missing API key. Example:
{
  "error": "Invalid API key"
}
Common causes:
  • Missing X-API-Key header
  • Incorrect API key value
  • Revoked or expired API key
Solution:
  • Include the X-API-Key header in your request
  • Copy your API key from the dashboard
  • Verify you’re using the correct key

429 Too Many Requests

Quota exceeded for your current plan. Example:
{
  "error": "Quota exceeded. Upgrade your plan or wait for renewal."
}
Common causes:
  • Monthly quota depleted
  • Too many requests in short time period
Solution:
  • Wait for quota renewal (check dashboard for date)
  • Upgrade to a plan with higher limits
  • Implement request caching to reduce usage

500 Internal Server Error

Server-side error occurred. Example:
{
  "error": "Failed to fetch LinkedIn data"
}
Common causes:
  • Temporary server issue
  • LinkedIn API unavailable
  • Network timeout
Solution:
  • Retry the request with exponential backoff
  • Check API status page
  • Contact support if error persists

Error Handling Examples

JavaScript/TypeScript

async function fetchLinkedInPosts(profileUrl, apiKey) {
  try {
    const response = await fetch(
      `https://api.fetchin.io/api/v1/posts?profileUrlOrUrn=${encodeURIComponent(profileUrl)}`,
      {
        headers: { 'X-API-Key': apiKey }
      }
    );
    
    if (!response.ok) {
      const error = await response.json();
      
      switch (response.status) {
        case 400:
          console.error('Invalid request:', error.error);
          break;
        case 401:
          console.error('Authentication failed:', error.error);
          break;
        case 429:
          console.error('Quota exceeded:', error.error);
          break;
        case 500:
          console.error('Server error:', error.error);
          break;
        default:
          console.error('Unknown error:', error.error);
      }
      
      throw new Error(error.error);
    }
    
    return await response.json();
  } catch (err) {
    console.error('Request failed:', err);
    throw err;
  }
}

Python

import requests

def fetch_linkedin_posts(profile_url, api_key):
    try:
        response = requests.get(
            'https://api.fetchin.io/api/v1/posts',
            headers={'X-API-Key': api_key},
            params={'profileUrlOrUrn': profile_url}
        )
        
        if response.status_code == 400:
            error = response.json()
            print(f"Invalid request: {error['error']}")
        elif response.status_code == 401:
            error = response.json()
            print(f"Authentication failed: {error['error']}")
        elif response.status_code == 429:
            error = response.json()
            print(f"Quota exceeded: {error['error']}")
        elif response.status_code == 500:
            error = response.json()
            print(f"Server error: {error['error']}")
        
        response.raise_for_status()
        return response.json()
        
    except requests.exceptions.RequestException as err:
        print(f"Request failed: {err}")
        raise

Best Practices

Don’t assume requests succeed. Check response.ok or response.status_code before processing data.
For 429 and 500 errors, wait progressively longer between retries: 1s, 2s, 4s, 8s, etc.
Include request parameters, timestamps, and user context in error logs for debugging.
Translate technical errors into actionable messages for end users.
Don’t wait forever. Set reasonable timeouts (e.g., 30 seconds) for API requests.
Track error rates in your application to catch issues early.

Debugging Tips

Enable Verbose Logging

curl -v -X GET "https://api.fetchin.io/api/v1/posts?profileUrlOrUrn=..." \
  -H "X-API-Key: your-api-key"

Check API Status

If you’re experiencing persistent errors:
  1. Check your dashboard for quota status
  2. Verify your API key is active
  3. Test with a known-good LinkedIn profile URL
  4. Contact support with error details

Error Prevention

Validate inputs

Validate LinkedIn URLs before making API requests

Cache responses

Store successful responses to avoid redundant requests

Monitor quota

Check remaining quota before bulk operations

Test thoroughly

Test error handling with invalid inputs