JavaScript SDK
Learn how to use the AI Studio JavaScript SDK.

We offer a JavaScript SDK for seamlessly interacting with Oxylabs AI Studio API services, including AI-Scraper, AI-Crawler, AI-Browser-Agent, and other data extraction tools.
Installation
Install the SDK:
Either add OXYLABS_AI_STUDIO_API_URL and OXYLABS_AI_STUDIO_API_KEY values to the .env file, or as your environment variables:
Usage
AI-Scraper
Basic usage
Input parameters
url(string): The target URL to process.user_prompt(string): Instructions for what data to extract. This is used to automatically generate theopenapi_schemawhen using thescrapeWithAutoSchemamethod.output_format(string): The desired format for the output. Can be eithermarkdownorjson. Defaults tomarkdown.render_html(boolean): Specifies whether to render JavaScript on the page before extraction. Defaults tofalse.openapi_schema(Record<string, any>): A JSON Schema object that defines the structure of the output data. This is required whenoutput_formatis set tojson.geo_location(string): Specifies the geographic location (ISO2 format) from which the request should be simulated.
AI-Crawler
Basic usage
Input parameters
url(string): The starting URL for the crawl.crawl_prompt(string): Instructions defining the types of pages to find and crawl.parse_prompt(string): Instructions for what data to extract from the crawled pages. This is used to automatically generate theopenapi_schemawhen using thecrawlWithAutoSchemamethod.output_format(string): The desired format for the output. Can be eithermarkdownorjson. Defaults tomarkdown.max_pages(integer): The maximum number of pages or sources to return. Defaults to25.render_html(boolean): Specifies whether to render JavaScript on the pages before extraction. Defaults tofalse.openapi_schema(Record<string, any>): A JSON Schema object that defines the structure of the output data. This is required whenoutput_formatis set tojson.geo_location(string): Specifies the geographic location (ISO2 format) from which the request should be simulated.
Browser-Agent
Basic usage
Input parameters
url(string): The target URL for the browser agent to start at.browse_prompt(string): Instructions defining the actions the browser agent should perform.parse_prompt(string): Instructions for what data to extract after performing the browser actions. This is used to automatically generate theopenapi_schemawhen using thebrowseWithAutoSchemamethod.output_format(string): The desired format for the output. Can bemarkdown,html,json, orscreenshot. Defaults tomarkdown.render_html(boolean): Specifies whether to render JavaScript on the page. Although this is a browser agent, this flag might influence certain behaviors. Defaults tofalse.openapi_schema(Record<string, any>): A JSON Schema object that defines the structure of the output data. This is required whenoutput_formatis set tojson.geo_location(string): Specifies the geographic location (ISO2 format) from which the request should be simulated.
AI-Search
Basic usage
Input parameters
query(string): The search query.limit(integer): The maximum number of search results to return. Maximum: 50.render_javascript(boolean): Whether to render JavaScript on the page. Defaults tofalse.return_content(boolean): Whether to return the markdown content of each of the search result. Defaults totrue.geo_location(string): Specifies the geographic location (ISO2 format) from which the request should be simulated.
AI-Map
Basic usage
Input parameters
url(string): The target URL to map and extract data from.user_prompt(string): Instructions for what data to extract from the mapped pages.return_sources_limit(integer): The maximum number of sources/pages to return from the mapping process.geo_location(string): The geographical location to use for the mapping request (e.g., 'US', 'UK').render_javascript(boolean): Specifies whether to render JavaScript on the pages before mapping. Defaults tofalse.
Usage examples
You can find more examples of each application here:
Last updated
Was this helpful?

