Package com.firecrawl.client
Class FirecrawlClient
- java.lang.Object
-
- com.firecrawl.client.FirecrawlClient
-
public class FirecrawlClient extends java.lang.ObjectClient for the Firecrawl v2 API.Example usage:
FirecrawlClient client = FirecrawlClient.builder() .apiKey("fc-your-api-key") .build(); // Scrape a single page Document doc = client.scrape("https://example.com", ScrapeOptions.builder() .formats(List.of("markdown")) .build()); // Crawl a website CrawlJob job = client.crawl("https://example.com", CrawlOptions.builder() .limit(50) .build());
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFirecrawlClient.Builder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description AgentStatusResponseagent(AgentOptions options)Runs an agent task and waits for completion (auto-polling).AgentStatusResponseagent(AgentOptions options, int pollIntervalSec, int timeoutSec)Runs an agent task and waits for completion with custom polling settings.java.util.concurrent.CompletableFuture<AgentStatusResponse>agentAsync(AgentOptions options)Asynchronously runs an agent task and waits for completion.BatchScrapeJobbatchScrape(java.util.List<java.lang.String> urls, BatchScrapeOptions options)Batch-scrapes URLs and waits for completion (auto-polling).BatchScrapeJobbatchScrape(java.util.List<java.lang.String> urls, BatchScrapeOptions options, int pollIntervalSec, int timeoutSec)Batch-scrapes URLs and waits for completion with custom polling settings.java.util.concurrent.CompletableFuture<BatchScrapeJob>batchScrapeAsync(java.util.List<java.lang.String> urls, BatchScrapeOptions options)Asynchronously batch-scrapes URLs and waits for completion.BrowserCreateResponsebrowser()Creates a new browser session with default settings.BrowserCreateResponsebrowser(java.lang.Integer ttl, java.lang.Integer activityTtl, java.lang.Boolean streamWebView)Creates a new browser session with options.java.util.concurrent.CompletableFuture<BrowserCreateResponse>browserAsync(java.lang.Integer ttl, java.lang.Integer activityTtl, java.lang.Boolean streamWebView)Asynchronously creates a new browser session.BrowserExecuteResponsebrowserExecute(java.lang.String sessionId, java.lang.String code)Executes code in a browser session using the default language (bash).BrowserExecuteResponsebrowserExecute(java.lang.String sessionId, java.lang.String code, java.lang.String language, java.lang.Integer timeout)Executes code in a browser session with options.java.util.concurrent.CompletableFuture<BrowserExecuteResponse>browserExecuteAsync(java.lang.String sessionId, java.lang.String code, java.lang.String language, java.lang.Integer timeout)Asynchronously executes code in a browser session.static FirecrawlClient.Builderbuilder()Creates a new builder for constructing a FirecrawlClient.java.util.Map<java.lang.String,java.lang.Object>cancelAgent(java.lang.String jobId)Cancels a running agent task.java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.Object>>cancelAgentAsync(java.lang.String jobId)Asynchronously cancels an agent task.java.util.Map<java.lang.String,java.lang.Object>cancelBatchScrape(java.lang.String jobId)Cancels a running batch scrape job.java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.Object>>cancelBatchScrapeAsync(java.lang.String jobId)Asynchronously cancels a batch scrape job.java.util.Map<java.lang.String,java.lang.Object>cancelCrawl(java.lang.String jobId)Cancels a running crawl job.java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.Object>>cancelCrawlAsync(java.lang.String jobId)Asynchronously cancels a crawl job.CrawlJobcrawl(java.lang.String url, CrawlOptions options)Crawls a website and waits for completion (auto-polling).CrawlJobcrawl(java.lang.String url, CrawlOptions options, int pollIntervalSec, int timeoutSec)Crawls a website and waits for completion with custom polling settings.java.util.concurrent.CompletableFuture<CrawlJob>crawlAsync(java.lang.String url, CrawlOptions options)Asynchronously crawls a website and waits for completion.java.util.concurrent.CompletableFuture<CrawlJob>crawlAsync(java.lang.String url, CrawlOptions options, int pollIntervalSec, int timeoutSec)Asynchronously crawls with custom polling settings.MonitorcreateMonitor(java.util.Map<java.lang.String,java.lang.Object> request)java.util.concurrent.CompletableFuture<Monitor>createMonitorAsync(java.util.Map<java.lang.String,java.lang.Object> request)BrowserDeleteResponsedeleteBrowser(java.lang.String sessionId)Deletes a browser session.java.util.concurrent.CompletableFuture<BrowserDeleteResponse>deleteBrowserAsync(java.lang.String sessionId)Asynchronously deletes a browser session.booleandeleteMonitor(java.lang.String monitorId)java.util.concurrent.CompletableFuture<java.lang.Boolean>deleteMonitorAsync(java.lang.String monitorId)BrowserDeleteResponsedeleteScrapeBrowser(java.lang.String jobId)Deprecated.java.util.concurrent.CompletableFuture<BrowserDeleteResponse>deleteScrapeBrowserAsync(java.lang.String jobId)Deprecated.static FirecrawlClientfromEnv()Creates a client from the FIRECRAWL_API_KEY environment variable.AgentStatusResponsegetAgentStatus(java.lang.String jobId)Gets the status of an agent task.java.util.concurrent.CompletableFuture<AgentStatusResponse>getAgentStatusAsync(java.lang.String jobId)Asynchronously gets the status of an agent task.BatchScrapeJobgetBatchScrapeStatus(java.lang.String jobId)Gets the status and results of a batch scrape job.java.util.concurrent.CompletableFuture<BatchScrapeJob>getBatchScrapeStatusAsync(java.lang.String jobId)Asynchronously gets the status of a batch scrape job.ConcurrencyCheckgetConcurrency()Gets current concurrency usage.java.util.concurrent.CompletableFuture<ConcurrencyCheck>getConcurrencyAsync()Asynchronously gets concurrency info.java.util.Map<java.lang.String,java.lang.Object>getCrawlErrors(java.lang.String jobId)Gets errors from a crawl job.CrawlJobgetCrawlStatus(java.lang.String jobId)Gets the status and results of a crawl job.java.util.concurrent.CompletableFuture<CrawlJob>getCrawlStatusAsync(java.lang.String jobId)Asynchronously gets the status of a crawl job.CreditUsagegetCreditUsage()Gets current credit usage.java.util.concurrent.CompletableFuture<CreditUsage>getCreditUsageAsync()Asynchronously gets credit usage.MonitorgetMonitor(java.lang.String monitorId)java.util.concurrent.CompletableFuture<Monitor>getMonitorAsync(java.lang.String monitorId)MonitorCheckDetailgetMonitorCheck(java.lang.String monitorId, java.lang.String checkId)MonitorCheckDetailgetMonitorCheck(java.lang.String monitorId, java.lang.String checkId, java.lang.Integer limit, java.lang.Integer skip, java.lang.String status)MonitorCheckDetailgetMonitorCheck(java.lang.String monitorId, java.lang.String checkId, java.lang.Integer limit, java.lang.Integer skip, java.lang.String status, boolean autoPaginate)java.util.concurrent.CompletableFuture<MonitorCheckDetail>getMonitorCheckAsync(java.lang.String monitorId, java.lang.String checkId, java.lang.Integer limit, java.lang.Integer skip, java.lang.String status)java.util.concurrent.CompletableFuture<MonitorCheckDetail>getMonitorCheckAsync(java.lang.String monitorId, java.lang.String checkId, java.lang.Integer limit, java.lang.Integer skip, java.lang.String status, boolean autoPaginate)BrowserExecuteResponseinteract(java.lang.String jobId, java.lang.String code)Interacts with the scrape-bound browser session for a scrape job.BrowserExecuteResponseinteract(java.lang.String jobId, java.lang.String code, java.lang.String language, java.lang.Integer timeout)Interacts with the scrape-bound browser session for a scrape job.BrowserExecuteResponseinteract(java.lang.String jobId, java.lang.String code, java.lang.String language, java.lang.Integer timeout, java.lang.String origin)Interacts with the scrape-bound browser session for a scrape job.java.util.concurrent.CompletableFuture<BrowserExecuteResponse>interactAsync(java.lang.String jobId, java.lang.String code)Asynchronously executes code in a scrape-bound browser session.java.util.concurrent.CompletableFuture<BrowserExecuteResponse>interactAsync(java.lang.String jobId, java.lang.String code, java.lang.String language, java.lang.Integer timeout)Asynchronously executes code in a scrape-bound browser session.java.util.concurrent.CompletableFuture<BrowserExecuteResponse>interactAsync(java.lang.String jobId, java.lang.String code, java.lang.String language, java.lang.Integer timeout, java.lang.String origin)Asynchronously executes code in a scrape-bound browser session.BrowserListResponselistBrowsers()Lists all browser sessions.BrowserListResponselistBrowsers(java.lang.String status)Lists browser sessions with optional status filter.java.util.concurrent.CompletableFuture<BrowserListResponse>listBrowsersAsync(java.lang.String status)Asynchronously lists browser sessions.java.util.List<MonitorCheck>listMonitorChecks(java.lang.String monitorId)java.util.List<MonitorCheck>listMonitorChecks(java.lang.String monitorId, java.lang.Integer limit, java.lang.Integer offset)java.util.concurrent.CompletableFuture<java.util.List<MonitorCheck>>listMonitorChecksAsync(java.lang.String monitorId, java.lang.Integer limit, java.lang.Integer offset)java.util.List<Monitor>listMonitors()java.util.List<Monitor>listMonitors(java.lang.Integer limit, java.lang.Integer offset)java.util.concurrent.CompletableFuture<java.util.List<Monitor>>listMonitorsAsync(java.lang.Integer limit, java.lang.Integer offset)MapDatamap(java.lang.String url)Discovers URLs on a website.MapDatamap(java.lang.String url, MapOptions options)Discovers URLs on a website with options.java.util.concurrent.CompletableFuture<MapData>mapAsync(java.lang.String url, MapOptions options)Asynchronously runs a map operation.Documentparse(ParseFile file)Parses an uploaded file and returns the extracted document.Documentparse(ParseFile file, ParseOptions options)Parses an uploaded file with scrape-compatible options.java.util.concurrent.CompletableFuture<Document>parseAsync(ParseFile file)Asynchronously parses an uploaded file with default options.java.util.concurrent.CompletableFuture<Document>parseAsync(ParseFile file, ParseOptions options)Asynchronously parses an uploaded file.MonitorCheckrunMonitor(java.lang.String monitorId)java.util.concurrent.CompletableFuture<MonitorCheck>runMonitorAsync(java.lang.String monitorId)Documentscrape(java.lang.String url)Scrapes a single URL and returns the document.Documentscrape(java.lang.String url, ScrapeOptions options)Scrapes a single URL with options.java.util.concurrent.CompletableFuture<Document>scrapeAsync(java.lang.String url, ScrapeOptions options)Asynchronously scrapes a URL.BrowserExecuteResponsescrapeExecute(java.lang.String jobId, java.lang.String code)Deprecated.BrowserExecuteResponsescrapeExecute(java.lang.String jobId, java.lang.String code, java.lang.String language, java.lang.Integer timeout)Deprecated.BrowserExecuteResponsescrapeExecute(java.lang.String jobId, java.lang.String code, java.lang.String language, java.lang.Integer timeout, java.lang.String origin)Deprecated.java.util.concurrent.CompletableFuture<BrowserExecuteResponse>scrapeExecuteAsync(java.lang.String jobId, java.lang.String code)Deprecated.java.util.concurrent.CompletableFuture<BrowserExecuteResponse>scrapeExecuteAsync(java.lang.String jobId, java.lang.String code, java.lang.String language, java.lang.Integer timeout)Deprecated.java.util.concurrent.CompletableFuture<BrowserExecuteResponse>scrapeExecuteAsync(java.lang.String jobId, java.lang.String code, java.lang.String language, java.lang.Integer timeout, java.lang.String origin)Deprecated.SearchDatasearch(java.lang.String query)Performs a web search.SearchDatasearch(java.lang.String query, SearchOptions options)Performs a web search with options.java.util.concurrent.CompletableFuture<SearchData>searchAsync(java.lang.String query, SearchOptions options)Asynchronously runs a search.AgentResponsestartAgent(AgentOptions options)Starts an async agent task.java.util.concurrent.CompletableFuture<AgentResponse>startAgentAsync(AgentOptions options)Asynchronously starts an agent task and returns immediately with the job reference.BatchScrapeResponsestartBatchScrape(java.util.List<java.lang.String> urls, BatchScrapeOptions options)Starts an async batch scrape job.java.util.concurrent.CompletableFuture<BatchScrapeResponse>startBatchScrapeAsync(java.util.List<java.lang.String> urls, BatchScrapeOptions options)Asynchronously starts a batch scrape job and returns immediately with the job reference.CrawlResponsestartCrawl(java.lang.String url, CrawlOptions options)Starts an async crawl job and returns immediately.java.util.concurrent.CompletableFuture<CrawlResponse>startCrawlAsync(java.lang.String url, CrawlOptions options)Asynchronously starts a crawl job and returns immediately with the job reference.BrowserDeleteResponsestopInteractiveBrowser(java.lang.String jobId)Stops the interactive browser session for a scrape job.java.util.concurrent.CompletableFuture<BrowserDeleteResponse>stopInteractiveBrowserAsync(java.lang.String jobId)Asynchronously deletes a scrape-bound browser session.MonitorupdateMonitor(java.lang.String monitorId, java.util.Map<java.lang.String,java.lang.Object> request)java.util.concurrent.CompletableFuture<Monitor>updateMonitorAsync(java.lang.String monitorId, java.util.Map<java.lang.String,java.lang.Object> request)
-
-
-
Method Detail
-
builder
public static FirecrawlClient.Builder builder()
Creates a new builder for constructing a FirecrawlClient.
-
fromEnv
public static FirecrawlClient fromEnv()
Creates a client from the FIRECRAWL_API_KEY environment variable.
-
scrape
public Document scrape(java.lang.String url)
Scrapes a single URL and returns the document.- Parameters:
url- the URL to scrape- Returns:
- the scraped document
-
scrape
public Document scrape(java.lang.String url, ScrapeOptions options)
Scrapes a single URL with options.- Parameters:
url- the URL to scrapeoptions- scrape configuration options- Returns:
- the scraped document
-
interact
public BrowserExecuteResponse interact(java.lang.String jobId, java.lang.String code)
Interacts with the scrape-bound browser session for a scrape job.- Parameters:
jobId- the scrape job IDcode- the code to execute- Returns:
- the execution result including stdout, stderr, and exit code
-
interact
public BrowserExecuteResponse interact(java.lang.String jobId, java.lang.String code, java.lang.String language, java.lang.Integer timeout)
Interacts with the scrape-bound browser session for a scrape job.- Parameters:
jobId- the scrape job IDcode- the code to executelanguage- the language: "python", "node", or "bash" (default: "node")timeout- execution timeout in seconds (1-300), or null for default (30)- Returns:
- the execution result including stdout, stderr, and exit code
-
interact
public BrowserExecuteResponse interact(java.lang.String jobId, java.lang.String code, java.lang.String language, java.lang.Integer timeout, java.lang.String origin)
Interacts with the scrape-bound browser session for a scrape job.- Parameters:
jobId- the scrape job IDcode- the code to executelanguage- the language: "python", "node", or "bash" (default: "node")timeout- execution timeout in seconds (1-300), or null for default (30)origin- optional origin tag for request attribution- Returns:
- the execution result including stdout, stderr, and exit code
-
stopInteractiveBrowser
public BrowserDeleteResponse stopInteractiveBrowser(java.lang.String jobId)
Stops the interactive browser session for a scrape job.- Parameters:
jobId- the scrape job ID- Returns:
- the stop response with session duration and billing info
-
scrapeExecute
@Deprecated public BrowserExecuteResponse scrapeExecute(java.lang.String jobId, java.lang.String code)
Deprecated.
-
scrapeExecute
@Deprecated public BrowserExecuteResponse scrapeExecute(java.lang.String jobId, java.lang.String code, java.lang.String language, java.lang.Integer timeout)
Deprecated.
-
scrapeExecute
@Deprecated public BrowserExecuteResponse scrapeExecute(java.lang.String jobId, java.lang.String code, java.lang.String language, java.lang.Integer timeout, java.lang.String origin)
Deprecated.
-
deleteScrapeBrowser
@Deprecated public BrowserDeleteResponse deleteScrapeBrowser(java.lang.String jobId)
Deprecated.
-
parse
public Document parse(ParseFile file)
Parses an uploaded file and returns the extracted document.- Parameters:
file- the file payload to parse- Returns:
- the parsed document
-
parse
public Document parse(ParseFile file, ParseOptions options)
Parses an uploaded file with scrape-compatible options.- Parameters:
file- the file payload to parseoptions- parse options (parse-compatible subset)- Returns:
- the parsed document
-
startCrawl
public CrawlResponse startCrawl(java.lang.String url, CrawlOptions options)
Starts an async crawl job and returns immediately.- Parameters:
url- the URL to start crawling fromoptions- crawl configuration options- Returns:
- the crawl job reference with ID
-
getCrawlStatus
public CrawlJob getCrawlStatus(java.lang.String jobId)
Gets the status and results of a crawl job.- Parameters:
jobId- the crawl job ID- Returns:
- the crawl job status
-
crawl
public CrawlJob crawl(java.lang.String url, CrawlOptions options)
Crawls a website and waits for completion (auto-polling).- Parameters:
url- the URL to crawloptions- crawl configuration options- Returns:
- the completed crawl job with all documents
-
crawl
public CrawlJob crawl(java.lang.String url, CrawlOptions options, int pollIntervalSec, int timeoutSec)
Crawls a website and waits for completion with custom polling settings.- Parameters:
url- the URL to crawloptions- crawl configuration optionspollIntervalSec- seconds between status checkstimeoutSec- maximum seconds to wait- Returns:
- the completed crawl job with all documents
-
cancelCrawl
public java.util.Map<java.lang.String,java.lang.Object> cancelCrawl(java.lang.String jobId)
Cancels a running crawl job.- Parameters:
jobId- the crawl job ID- Returns:
- the cancellation response
-
getCrawlErrors
public java.util.Map<java.lang.String,java.lang.Object> getCrawlErrors(java.lang.String jobId)
Gets errors from a crawl job.- Parameters:
jobId- the crawl job ID- Returns:
- error details
-
startBatchScrape
public BatchScrapeResponse startBatchScrape(java.util.List<java.lang.String> urls, BatchScrapeOptions options)
Starts an async batch scrape job.- Parameters:
urls- the URLs to scrapeoptions- batch scrape configuration options- Returns:
- the batch job reference with ID
-
getBatchScrapeStatus
public BatchScrapeJob getBatchScrapeStatus(java.lang.String jobId)
Gets the status and results of a batch scrape job.- Parameters:
jobId- the batch scrape job ID- Returns:
- the batch scrape job status
-
batchScrape
public BatchScrapeJob batchScrape(java.util.List<java.lang.String> urls, BatchScrapeOptions options)
Batch-scrapes URLs and waits for completion (auto-polling).- Parameters:
urls- the URLs to scrapeoptions- batch scrape configuration options- Returns:
- the completed batch scrape job with all documents
-
batchScrape
public BatchScrapeJob batchScrape(java.util.List<java.lang.String> urls, BatchScrapeOptions options, int pollIntervalSec, int timeoutSec)
Batch-scrapes URLs and waits for completion with custom polling settings.- Parameters:
urls- the URLs to scrapeoptions- batch scrape configuration optionspollIntervalSec- seconds between status checkstimeoutSec- maximum seconds to wait- Returns:
- the completed batch scrape job with all documents
-
cancelBatchScrape
public java.util.Map<java.lang.String,java.lang.Object> cancelBatchScrape(java.lang.String jobId)
Cancels a running batch scrape job.- Parameters:
jobId- the batch scrape job ID- Returns:
- the cancellation response
-
map
public MapData map(java.lang.String url)
Discovers URLs on a website.- Parameters:
url- the URL to map- Returns:
- the discovered URLs
-
map
public MapData map(java.lang.String url, MapOptions options)
Discovers URLs on a website with options.- Parameters:
url- the URL to mapoptions- map configuration options- Returns:
- the discovered URLs
-
createMonitor
public Monitor createMonitor(java.util.Map<java.lang.String,java.lang.Object> request)
-
listMonitors
public java.util.List<Monitor> listMonitors()
-
listMonitors
public java.util.List<Monitor> listMonitors(java.lang.Integer limit, java.lang.Integer offset)
-
getMonitor
public Monitor getMonitor(java.lang.String monitorId)
-
updateMonitor
public Monitor updateMonitor(java.lang.String monitorId, java.util.Map<java.lang.String,java.lang.Object> request)
-
deleteMonitor
public boolean deleteMonitor(java.lang.String monitorId)
-
runMonitor
public MonitorCheck runMonitor(java.lang.String monitorId)
-
listMonitorChecks
public java.util.List<MonitorCheck> listMonitorChecks(java.lang.String monitorId)
-
listMonitorChecks
public java.util.List<MonitorCheck> listMonitorChecks(java.lang.String monitorId, java.lang.Integer limit, java.lang.Integer offset)
-
getMonitorCheck
public MonitorCheckDetail getMonitorCheck(java.lang.String monitorId, java.lang.String checkId)
-
getMonitorCheck
public MonitorCheckDetail getMonitorCheck(java.lang.String monitorId, java.lang.String checkId, java.lang.Integer limit, java.lang.Integer skip, java.lang.String status)
-
getMonitorCheck
public MonitorCheckDetail getMonitorCheck(java.lang.String monitorId, java.lang.String checkId, java.lang.Integer limit, java.lang.Integer skip, java.lang.String status, boolean autoPaginate)
-
search
public SearchData search(java.lang.String query)
Performs a web search.- Parameters:
query- the search query- Returns:
- search results
-
search
public SearchData search(java.lang.String query, SearchOptions options)
Performs a web search with options.- Parameters:
query- the search queryoptions- search configuration options- Returns:
- search results
-
startAgent
public AgentResponse startAgent(AgentOptions options)
Starts an async agent task.- Parameters:
options- agent configuration options- Returns:
- the agent response with job ID
-
getAgentStatus
public AgentStatusResponse getAgentStatus(java.lang.String jobId)
Gets the status of an agent task.- Parameters:
jobId- the agent job ID- Returns:
- the agent status response
-
agent
public AgentStatusResponse agent(AgentOptions options)
Runs an agent task and waits for completion (auto-polling).- Parameters:
options- agent configuration options- Returns:
- the completed agent status response
-
agent
public AgentStatusResponse agent(AgentOptions options, int pollIntervalSec, int timeoutSec)
Runs an agent task and waits for completion with custom polling settings.- Parameters:
options- agent configuration optionspollIntervalSec- seconds between status checkstimeoutSec- maximum seconds to wait- Returns:
- the completed agent status response
-
cancelAgent
public java.util.Map<java.lang.String,java.lang.Object> cancelAgent(java.lang.String jobId)
Cancels a running agent task.- Parameters:
jobId- the agent job ID- Returns:
- the cancellation response
-
browser
public BrowserCreateResponse browser()
Creates a new browser session with default settings.- Returns:
- the browser session details including id, CDP URL, and live view URL
-
browser
public BrowserCreateResponse browser(java.lang.Integer ttl, java.lang.Integer activityTtl, java.lang.Boolean streamWebView)
Creates a new browser session with options.- Parameters:
ttl- total session lifetime in seconds (30-3600), or null for defaultactivityTtl- idle timeout in seconds (10-3600), or null for defaultstreamWebView- whether to enable live view streaming, or null for default- Returns:
- the browser session details
-
browserExecute
public BrowserExecuteResponse browserExecute(java.lang.String sessionId, java.lang.String code)
Executes code in a browser session using the default language (bash).- Parameters:
sessionId- the browser session IDcode- the code to execute- Returns:
- the execution result including stdout, stderr, and exit code
-
browserExecute
public BrowserExecuteResponse browserExecute(java.lang.String sessionId, java.lang.String code, java.lang.String language, java.lang.Integer timeout)
Executes code in a browser session with options.- Parameters:
sessionId- the browser session IDcode- the code to executelanguage- the language: "python", "node", or "bash" (default: "bash")timeout- execution timeout in seconds (1-300), or null for default (30)- Returns:
- the execution result including stdout, stderr, and exit code
-
deleteBrowser
public BrowserDeleteResponse deleteBrowser(java.lang.String sessionId)
Deletes a browser session.- Parameters:
sessionId- the browser session ID- Returns:
- the deletion response with session duration and billing info
-
listBrowsers
public BrowserListResponse listBrowsers()
Lists all browser sessions.- Returns:
- the list of browser sessions
-
listBrowsers
public BrowserListResponse listBrowsers(java.lang.String status)
Lists browser sessions with optional status filter.- Parameters:
status- optional filter: "active" or "destroyed", or null for all- Returns:
- the list of browser sessions
-
getConcurrency
public ConcurrencyCheck getConcurrency()
Gets current concurrency usage.
-
getCreditUsage
public CreditUsage getCreditUsage()
Gets current credit usage.
-
scrapeAsync
public java.util.concurrent.CompletableFuture<Document> scrapeAsync(java.lang.String url, ScrapeOptions options)
Asynchronously scrapes a URL.- Parameters:
url- the URL to scrapeoptions- scrape configuration options- Returns:
- a CompletableFuture that resolves to the scraped Document
-
interactAsync
public java.util.concurrent.CompletableFuture<BrowserExecuteResponse> interactAsync(java.lang.String jobId, java.lang.String code)
Asynchronously executes code in a scrape-bound browser session.- Parameters:
jobId- the scrape job IDcode- the code to execute- Returns:
- a CompletableFuture that resolves to the BrowserExecuteResponse
-
interactAsync
public java.util.concurrent.CompletableFuture<BrowserExecuteResponse> interactAsync(java.lang.String jobId, java.lang.String code, java.lang.String language, java.lang.Integer timeout)
Asynchronously executes code in a scrape-bound browser session.- Parameters:
jobId- the scrape job IDcode- the code to executelanguage- the language: "python", "node", or "bash"timeout- execution timeout in seconds, or null for default- Returns:
- a CompletableFuture that resolves to the BrowserExecuteResponse
-
interactAsync
public java.util.concurrent.CompletableFuture<BrowserExecuteResponse> interactAsync(java.lang.String jobId, java.lang.String code, java.lang.String language, java.lang.Integer timeout, java.lang.String origin)
Asynchronously executes code in a scrape-bound browser session.- Parameters:
jobId- the scrape job IDcode- the code to executelanguage- the language: "python", "node", or "bash"timeout- execution timeout in seconds, or null for defaultorigin- optional origin tag for request attribution- Returns:
- a CompletableFuture that resolves to the BrowserExecuteResponse
-
stopInteractiveBrowserAsync
public java.util.concurrent.CompletableFuture<BrowserDeleteResponse> stopInteractiveBrowserAsync(java.lang.String jobId)
Asynchronously deletes a scrape-bound browser session.- Parameters:
jobId- the scrape job ID- Returns:
- a CompletableFuture that resolves to the BrowserDeleteResponse
-
scrapeExecuteAsync
@Deprecated public java.util.concurrent.CompletableFuture<BrowserExecuteResponse> scrapeExecuteAsync(java.lang.String jobId, java.lang.String code)
Deprecated.
-
scrapeExecuteAsync
@Deprecated public java.util.concurrent.CompletableFuture<BrowserExecuteResponse> scrapeExecuteAsync(java.lang.String jobId, java.lang.String code, java.lang.String language, java.lang.Integer timeout)
Deprecated.
-
scrapeExecuteAsync
@Deprecated public java.util.concurrent.CompletableFuture<BrowserExecuteResponse> scrapeExecuteAsync(java.lang.String jobId, java.lang.String code, java.lang.String language, java.lang.Integer timeout, java.lang.String origin)
Deprecated.
-
deleteScrapeBrowserAsync
@Deprecated public java.util.concurrent.CompletableFuture<BrowserDeleteResponse> deleteScrapeBrowserAsync(java.lang.String jobId)
Deprecated.
-
parseAsync
public java.util.concurrent.CompletableFuture<Document> parseAsync(ParseFile file)
Asynchronously parses an uploaded file with default options.- Parameters:
file- the file payload- Returns:
- a CompletableFuture that resolves to the parsed Document
-
parseAsync
public java.util.concurrent.CompletableFuture<Document> parseAsync(ParseFile file, ParseOptions options)
Asynchronously parses an uploaded file.- Parameters:
file- the file payloadoptions- parse options- Returns:
- a CompletableFuture that resolves to the parsed Document
-
crawlAsync
public java.util.concurrent.CompletableFuture<CrawlJob> crawlAsync(java.lang.String url, CrawlOptions options)
Asynchronously crawls a website and waits for completion.- Parameters:
url- the URL to crawloptions- crawl configuration options- Returns:
- a CompletableFuture that resolves to the completed CrawlJob
-
crawlAsync
public java.util.concurrent.CompletableFuture<CrawlJob> crawlAsync(java.lang.String url, CrawlOptions options, int pollIntervalSec, int timeoutSec)
Asynchronously crawls with custom polling settings.- Parameters:
url- the URL to crawloptions- crawl configuration optionspollIntervalSec- seconds between status checkstimeoutSec- maximum seconds to wait- Returns:
- a CompletableFuture that resolves to the completed CrawlJob
-
batchScrapeAsync
public java.util.concurrent.CompletableFuture<BatchScrapeJob> batchScrapeAsync(java.util.List<java.lang.String> urls, BatchScrapeOptions options)
Asynchronously batch-scrapes URLs and waits for completion.- Parameters:
urls- the URLs to scrapeoptions- batch scrape configuration options- Returns:
- a CompletableFuture that resolves to the completed BatchScrapeJob
-
searchAsync
public java.util.concurrent.CompletableFuture<SearchData> searchAsync(java.lang.String query, SearchOptions options)
Asynchronously runs a search.- Parameters:
query- the search queryoptions- search configuration options- Returns:
- a CompletableFuture that resolves to the SearchData
-
mapAsync
public java.util.concurrent.CompletableFuture<MapData> mapAsync(java.lang.String url, MapOptions options)
Asynchronously runs a map operation.- Parameters:
url- the URL to mapoptions- map configuration options- Returns:
- a CompletableFuture that resolves to the MapData
-
createMonitorAsync
public java.util.concurrent.CompletableFuture<Monitor> createMonitorAsync(java.util.Map<java.lang.String,java.lang.Object> request)
-
listMonitorsAsync
public java.util.concurrent.CompletableFuture<java.util.List<Monitor>> listMonitorsAsync(java.lang.Integer limit, java.lang.Integer offset)
-
getMonitorAsync
public java.util.concurrent.CompletableFuture<Monitor> getMonitorAsync(java.lang.String monitorId)
-
updateMonitorAsync
public java.util.concurrent.CompletableFuture<Monitor> updateMonitorAsync(java.lang.String monitorId, java.util.Map<java.lang.String,java.lang.Object> request)
-
deleteMonitorAsync
public java.util.concurrent.CompletableFuture<java.lang.Boolean> deleteMonitorAsync(java.lang.String monitorId)
-
runMonitorAsync
public java.util.concurrent.CompletableFuture<MonitorCheck> runMonitorAsync(java.lang.String monitorId)
-
listMonitorChecksAsync
public java.util.concurrent.CompletableFuture<java.util.List<MonitorCheck>> listMonitorChecksAsync(java.lang.String monitorId, java.lang.Integer limit, java.lang.Integer offset)
-
getMonitorCheckAsync
public java.util.concurrent.CompletableFuture<MonitorCheckDetail> getMonitorCheckAsync(java.lang.String monitorId, java.lang.String checkId, java.lang.Integer limit, java.lang.Integer skip, java.lang.String status)
-
getMonitorCheckAsync
public java.util.concurrent.CompletableFuture<MonitorCheckDetail> getMonitorCheckAsync(java.lang.String monitorId, java.lang.String checkId, java.lang.Integer limit, java.lang.Integer skip, java.lang.String status, boolean autoPaginate)
-
agentAsync
public java.util.concurrent.CompletableFuture<AgentStatusResponse> agentAsync(AgentOptions options)
Asynchronously runs an agent task and waits for completion.- Parameters:
options- agent configuration options- Returns:
- a CompletableFuture that resolves to the AgentStatusResponse
-
browserAsync
public java.util.concurrent.CompletableFuture<BrowserCreateResponse> browserAsync(java.lang.Integer ttl, java.lang.Integer activityTtl, java.lang.Boolean streamWebView)
Asynchronously creates a new browser session.- Parameters:
ttl- total session lifetime in seconds, or null for defaultactivityTtl- idle timeout in seconds, or null for defaultstreamWebView- whether to enable live view streaming, or null for default- Returns:
- a CompletableFuture that resolves to the BrowserCreateResponse
-
browserExecuteAsync
public java.util.concurrent.CompletableFuture<BrowserExecuteResponse> browserExecuteAsync(java.lang.String sessionId, java.lang.String code, java.lang.String language, java.lang.Integer timeout)
Asynchronously executes code in a browser session.- Parameters:
sessionId- the browser session IDcode- the code to executelanguage- the language: "python", "node", or "bash"timeout- execution timeout in seconds, or null for default- Returns:
- a CompletableFuture that resolves to the BrowserExecuteResponse
-
deleteBrowserAsync
public java.util.concurrent.CompletableFuture<BrowserDeleteResponse> deleteBrowserAsync(java.lang.String sessionId)
Asynchronously deletes a browser session.- Parameters:
sessionId- the browser session ID- Returns:
- a CompletableFuture that resolves to the BrowserDeleteResponse
-
listBrowsersAsync
public java.util.concurrent.CompletableFuture<BrowserListResponse> listBrowsersAsync(java.lang.String status)
Asynchronously lists browser sessions.- Parameters:
status- optional filter: "active" or "destroyed", or null for all- Returns:
- a CompletableFuture that resolves to the BrowserListResponse
-
startCrawlAsync
public java.util.concurrent.CompletableFuture<CrawlResponse> startCrawlAsync(java.lang.String url, CrawlOptions options)
Asynchronously starts a crawl job and returns immediately with the job reference.- Parameters:
url- the URL to start crawling fromoptions- crawl configuration options- Returns:
- a CompletableFuture that resolves to the CrawlResponse
-
getCrawlStatusAsync
public java.util.concurrent.CompletableFuture<CrawlJob> getCrawlStatusAsync(java.lang.String jobId)
Asynchronously gets the status of a crawl job.- Parameters:
jobId- the crawl job ID- Returns:
- a CompletableFuture that resolves to the CrawlJob
-
cancelCrawlAsync
public java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.Object>> cancelCrawlAsync(java.lang.String jobId)
Asynchronously cancels a crawl job.- Parameters:
jobId- the crawl job ID- Returns:
- a CompletableFuture that resolves to the cancellation response
-
startBatchScrapeAsync
public java.util.concurrent.CompletableFuture<BatchScrapeResponse> startBatchScrapeAsync(java.util.List<java.lang.String> urls, BatchScrapeOptions options)
Asynchronously starts a batch scrape job and returns immediately with the job reference.- Parameters:
urls- the URLs to scrapeoptions- batch scrape configuration options- Returns:
- a CompletableFuture that resolves to the BatchScrapeResponse
-
getBatchScrapeStatusAsync
public java.util.concurrent.CompletableFuture<BatchScrapeJob> getBatchScrapeStatusAsync(java.lang.String jobId)
Asynchronously gets the status of a batch scrape job.- Parameters:
jobId- the batch scrape job ID- Returns:
- a CompletableFuture that resolves to the BatchScrapeJob
-
cancelBatchScrapeAsync
public java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.Object>> cancelBatchScrapeAsync(java.lang.String jobId)
Asynchronously cancels a batch scrape job.- Parameters:
jobId- the batch scrape job ID- Returns:
- a CompletableFuture that resolves to the cancellation response
-
startAgentAsync
public java.util.concurrent.CompletableFuture<AgentResponse> startAgentAsync(AgentOptions options)
Asynchronously starts an agent task and returns immediately with the job reference.- Parameters:
options- agent configuration options- Returns:
- a CompletableFuture that resolves to the AgentResponse
-
getAgentStatusAsync
public java.util.concurrent.CompletableFuture<AgentStatusResponse> getAgentStatusAsync(java.lang.String jobId)
Asynchronously gets the status of an agent task.- Parameters:
jobId- the agent job ID- Returns:
- a CompletableFuture that resolves to the AgentStatusResponse
-
cancelAgentAsync
public java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.Object>> cancelAgentAsync(java.lang.String jobId)
Asynchronously cancels an agent task.- Parameters:
jobId- the agent job ID- Returns:
- a CompletableFuture that resolves to the cancellation response
-
getConcurrencyAsync
public java.util.concurrent.CompletableFuture<ConcurrencyCheck> getConcurrencyAsync()
Asynchronously gets concurrency info.- Returns:
- a CompletableFuture that resolves to the ConcurrencyCheck
-
getCreditUsageAsync
public java.util.concurrent.CompletableFuture<CreditUsage> getCreditUsageAsync()
Asynchronously gets credit usage.- Returns:
- a CompletableFuture that resolves to the CreditUsage
-
-