All requests to the StudyFetch API require authentication using an API key. This guide covers how to obtain and use your API key across different platforms.
Obtaining Your API Key
Via StudyFetch Dashboard
- Log in to your StudyFetch Console
- Click API Keys
- Click Create New API Key
- Give your key a descriptive name (e.g., "Production App")
- Copy the generated key
Using Your API Key
The StudyFetch API uses API key authentication via the x-api-key header.
Header Format
x-api-key: YOUR_API_KEY
Example Requests
JavaScript
import StudyfetchSDK from '@studyfetch/sdk';
const client = new StudyfetchSDK({
apiKey: 'YOUR_API_KEY',
baseURL: 'https://studyfetchapi.com',
});
// The SDK automatically includes the x-api-key header
const components = await client.v1.components.list();
Python
from studyfetch_sdk import StudyfetchSDK
client = StudyfetchSDK(
api_key="YOUR_API_KEY",
base_url="https://studyfetchapi.com",
)
# The SDK automatically includes the x-api-key header
components = client.v1.components.list()
Java
import com.studyfetch.javasdk.client.StudyfetchSdkClient;
import com.studyfetch.javasdk.client.okhttp.StudyfetchSdkOkHttpClient;
StudyfetchSdkClient client = StudyfetchSdkOkHttpClient.builder()
.apiKey("YOUR_API_KEY")
.baseUrl("https://studyfetchapi.com")
.build();
// The SDK automatically includes the x-api-key header
var components = client.v1().components().list();
Bash
curl https://studyfetchapi.com/api/v1/components \
-H "x-api-key: YOUR_API_KEY"
