Authentication
You'll need to authenticate your requests to access any of the endpoints in the ScrapingLabs API. In this guide, we'll look at how authentication works.
ScrapingLabs offers two ways to authenticate your API requests: RapidAPI and with a Bearer token.
Bearer token
The recommended way to authenticate with the ScrapingLabs API is by using Bearer token. When establishing a connection using Bearer token, you will need your access token — you will find it in the ScrapingLabs dashboard under API settings. Here's how to add the token to the request header using cURL:
Example request with bearer token
curl https://scrapinglabs.com/api/v1 \
-H "Authorization: Bearer {token}"
Always keep your token safe and reset it if you suspect it has been compromised.
RapidAPI
ScrapingLabs also supports authentication through RapidAPI. If you're using ScrapingLabs via RapidAPI, you'll need to follow a slightly different authentication process:
- Subscribe to ScrapingLabs on the RapidAPI Hub.
- Once subscribed, RapidAPI will provide you with an API key.
- Include this API key in your request headers as
X-RapidAPI-Key
.
Here's an example of how to make a request using cURL with RapidAPI authentication:
Example request with RapidAPI
curl https://scrapinglabs.com/api/v1 \
-H "X-RapidAPI-Key: {api_key}"