Skip to main content

Authentication

Overview

Scrape Loop API uses API keys for authentication. You can provide your API key in one of two ways:

  1. As a header (recommended)
  2. As a query parameter

API Key Methods

curl -X GET "https://api.scrapeloop.com/v1/recipes" \
-H "x-api-key: YOUR_API_KEY"

Header Details

NameValue
Header Namex-api-key
ValueYour API key

Implementation Examples

const apiKey = process.env.SCRAPE_LOOP_API_KEY;

// Using header authentication
async function fetchRecipes() {
const response = await fetch('https://api.scrapeloop.com/v1/recipes', {
headers: {
'x-api-key': apiKey
}
});
return await response.json();
}

Error Handling

Common Authentication Errors

Error CodeDescriptionSolution
401Missing API keyInclude API key in header or query parameter
401Invalid API keyCheck if the API key is correct and active
403Insufficient permissionsVerify API key has required permissions

Error Response Example

{
"success": false,
"message": "Invalid API key provided",
"statusCode": 401
}