0

Information about your account calls quota

by
Published Nov 5, 2024

Returns information about your account, including the remaining API credits quota, the next billing cycle start time, and the remaining concurrent requests. The response is in JSON format.

Script webscrapingai Verified

The script

Submitted by hugo697 Bun
Verified 581 days ago
1
//native
2
type Webscrapingai = {
3
	apiKey: string
4
}
5
/**
6
 * Information about your account calls quota
7
 * Returns information about your account, including the remaining API credits quota, the next billing cycle start time, and the remaining concurrent requests. The response is in JSON format.
8
 */
9
export async function main(auth: Webscrapingai) {
10
	const url = new URL(`https://api.webscraping.ai/account`)
11

12
	url.searchParams.append('api_key', auth.apiKey)
13

14
	const response = await fetch(url, {
15
		method: 'GET',
16
		body: undefined
17
	})
18
	if (!response.ok) {
19
		const text = await response.text()
20
		throw new Error(`${response.status} ${text}`)
21
	}
22
	return await response.json()
23
}
24