@mendable/firecrawl-js 4.42.4 → 4.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -191,7 +191,7 @@ const scraped = await app.search('firecrawl changelog', {
191
191
  ```
192
192
 
193
193
  Results are grouped by source: `.web`, `.news` and `.images`. Developer
194
- category results are served inside `.web`.
194
+ and gov category results are served inside `.web`.
195
195
 
196
196
  Use `categories` to narrow web search to a kind of site:
197
197
 
@@ -236,6 +236,26 @@ console.log(evidence.repos); // indexed-status echoes for requested repos
236
236
  `archived`, `fork`, and `skills: 'only'`. Supplying both `repos` and `sources`
237
237
  OR-combines GitHub-backed and documentation results.
238
238
 
239
+ ### Government search
240
+
241
+ Use `govSearch` to search the Firecrawl Government Index: primary
242
+ law and regulatory material from US federal, state, and local government
243
+ sources, including statutes, regulations, codes, court opinions, and other
244
+ government publications. Results come back in the ordinary web-result shape.
245
+ Generic `search('food labeling requirements', { categories: ['gov'] })`
246
+ returns index results inside `.web`; like `developer`, it cannot be combined
247
+ with other categories.
248
+
249
+ ```js
250
+ const law = await app.govSearch('food labeling requirements', {
251
+ k: 5,
252
+ });
253
+
254
+ for (const result of law.data.web) {
255
+ console.log(result.position, result.title, result.url);
256
+ }
257
+ ```
258
+
239
259
  ### Research / paper search
240
260
 
241
261
  Use `app.research` to search Firecrawl's research paper index: ~43M paper
package/audit-ci.jsonc CHANGED
@@ -1,4 +1,19 @@
1
1
  {
2
2
  "$schema": "https://github.com/IBM/audit-ci/raw/main/docs/schema.json",
3
- "low": true
3
+ "low": true,
4
+ "allowlist": [
5
+ // GHSA-vfj7-8cjw-p6xm (braces):
6
+ // Latest published braces is 3.0.3; advisory range is <=3.0.3 and
7
+ // no 3.0.4+ exists on npm. Same-major jest 30.x still resolves
8
+ // 3.0.3 via micromatch. Cannot override to a non-existent version.
9
+ // Owner: team-engineering-reviewers. Tracking: create internal ticket.
10
+ // Expires: 2026-10-17.
11
+ "GHSA-vfj7-8cjw-p6xm",
12
+ // GHSA-hp3w-g68c-fv3c (sprintf-js):
13
+ // Advisory asks for >=1.1.4; latest published sprintf-js is
14
+ // 1.1.3. Cannot override to a non-existent version.
15
+ // Owner: team-engineering-reviewers. Tracking: create internal ticket.
16
+ // Expires: 2026-10-20.
17
+ "GHSA-hp3w-g68c-fv3c"
18
+ ]
4
19
  }
@@ -12,7 +12,7 @@ var require_package = __commonJS({
12
12
  "package.json"(exports, module) {
13
13
  module.exports = {
14
14
  name: "@mendable/firecrawl-js",
15
- version: "4.42.4",
15
+ version: "4.44.0",
16
16
  description: "JavaScript SDK for the Firecrawl API: web scraping, crawling, web search, and scientific literature search over a research paper index of PubMed, bioRxiv, medRxiv and arXiv abstracts",
17
17
  main: "dist/index.js",
18
18
  types: "dist/index.d.ts",
package/dist/index.cjs CHANGED
@@ -39,7 +39,7 @@ var require_package = __commonJS({
39
39
  "package.json"(exports2, module2) {
40
40
  module2.exports = {
41
41
  name: "@mendable/firecrawl-js",
42
- version: "4.42.4",
42
+ version: "4.44.0",
43
43
  description: "JavaScript SDK for the Firecrawl API: web scraping, crawling, web search, and scientific literature search over a research paper index of PubMed, bioRxiv, medRxiv and arXiv abstracts",
44
44
  main: "dist/index.js",
45
45
  types: "dist/index.d.ts",
@@ -1023,6 +1023,27 @@ async function developerSearch(http, query, options = {}) {
1023
1023
  }
1024
1024
  }
1025
1025
 
1026
+ // src/v2/methods/gov.ts
1027
+ var ENDPOINT2 = "/v2/search/gov";
1028
+ async function govSearch(http, query, options = {}) {
1029
+ if (!query || !query.trim()) throw new Error("query cannot be empty");
1030
+ try {
1031
+ const response = await http.post(ENDPOINT2, {
1032
+ query,
1033
+ ...options.k !== void 0 ? { k: options.k } : {}
1034
+ });
1035
+ if (response.status !== 200 || !response.data?.success) {
1036
+ throwForBadResponse(response, "search the Government Index");
1037
+ }
1038
+ return response.data;
1039
+ } catch (error) {
1040
+ if (error?.isAxiosError) {
1041
+ return normalizeAxiosError(error, "search the Government Index");
1042
+ }
1043
+ throw error;
1044
+ }
1045
+ }
1046
+
1026
1047
  // src/v2/methods/map.ts
1027
1048
  function prepareMapPayload(url, options) {
1028
1049
  if (!url || !url.trim()) throw new Error("URL cannot be empty");
@@ -1642,6 +1663,7 @@ async function browser(http, args = {}) {
1642
1663
  if (args.ttl != null) body.ttl = args.ttl;
1643
1664
  if (args.activityTtl != null) body.activityTtl = args.activityTtl;
1644
1665
  if (args.streamWebView != null) body.streamWebView = args.streamWebView;
1666
+ if (args.blockAds != null) body.blockAds = args.blockAds;
1645
1667
  if (args.profile != null) body.profile = args.profile;
1646
1668
  if (args.integration != null) body.integration = args.integration;
1647
1669
  if (args.origin) body.origin = args.origin;
@@ -2404,6 +2426,13 @@ var FirecrawlClient = class {
2404
2426
  async developerSearch(query, options = {}) {
2405
2427
  return developerSearch(this.http, query, options);
2406
2428
  }
2429
+ /**
2430
+ * Search the Government Index: primary law and regulatory material
2431
+ * from US federal, state, and local government sources.
2432
+ */
2433
+ async govSearch(query, options = {}) {
2434
+ return govSearch(this.http, query, options);
2435
+ }
2407
2436
  /**
2408
2437
  * Submit feedback for a v2 job.
2409
2438
  * @param request Feedback payload with endpoint, job id, rating, and supporting signals.
@@ -2699,7 +2728,7 @@ var FirecrawlClient = class {
2699
2728
  // Browser
2700
2729
  /**
2701
2730
  * Create a new browser session.
2702
- * @param args Session options (ttl, activityTtl, streamWebView, profile).
2731
+ * @param args Session options (ttl, activityTtl, streamWebView, blockAds, profile).
2703
2732
  * @returns Session id, CDP URL, live view URL, and expiration time.
2704
2733
  */
2705
2734
  async browser(args = {}) {
package/dist/index.d.cts CHANGED
@@ -659,6 +659,16 @@ interface DeveloperSearchResponse {
659
659
  /** Present only when sources were requested. */
660
660
  sources?: DeveloperSearchSourceStatus[];
661
661
  }
662
+ interface GovSearchOptions {
663
+ /** Total ranked results, 1–100 (default 10). */
664
+ k?: number;
665
+ }
666
+ interface GovSearchResponse {
667
+ success: boolean;
668
+ data: {
669
+ web: SearchResultWeb[];
670
+ };
671
+ }
662
672
  interface SearchResultWeb {
663
673
  url: string;
664
674
  title?: string;
@@ -814,6 +824,8 @@ interface AlexandriaOptions {
814
824
  * - `pdf` — restrict results to PDFs (adds `filetype:pdf`).
815
825
  * - `developer` — developer-index results (issues, pull requests, READMEs and
816
826
  * documentation) served in `web`; cannot be combined with other categories.
827
+ * - `gov` — Government Index results served in `web`; cannot be combined
828
+ * with other categories.
817
829
  *
818
830
  * ⚠️ `categories: ["research"]` is **not** Firecrawl's research paper index.
819
831
  * To search papers themselves — ~43M abstracts, roughly 90% biomedical
@@ -825,7 +837,7 @@ interface AlexandriaOptions {
825
837
  * happen to live on academic domains → `search({ categories: ["research"] })`.
826
838
  */
827
839
  interface CategoryOption {
828
- type: "github" | "research" | "pdf" | "developer";
840
+ type: "github" | "research" | "pdf" | "developer" | "gov";
829
841
  }
830
842
  interface SearchRequest {
831
843
  query: string;
@@ -844,7 +856,7 @@ interface SearchRequest {
844
856
  * over ~43M paper abstracts (PubMed / bioRxiv / medRxiv / arXiv) use
845
857
  * `firecrawl.research.searchPapers()` instead.
846
858
  */
847
- categories?: Array<"github" | "research" | "pdf" | "developer" | CategoryOption>;
859
+ categories?: Array<"github" | "research" | "pdf" | "developer" | "gov" | CategoryOption>;
848
860
  includeDomains?: string[];
849
861
  excludeDomains?: string[];
850
862
  limit?: number;
@@ -2093,6 +2105,8 @@ declare function browser(http: HttpClient, args?: {
2093
2105
  ttl?: number;
2094
2106
  activityTtl?: number;
2095
2107
  streamWebView?: boolean;
2108
+ /** Block ads, trackers and cookie notices, as in scrape (default true). */
2109
+ blockAds?: boolean;
2096
2110
  profile?: {
2097
2111
  name: string;
2098
2112
  saveChanges?: boolean;
@@ -2323,6 +2337,11 @@ declare class FirecrawlClient {
2323
2337
  * requested passages, citations, license disclosures, and indexing echoes.
2324
2338
  */
2325
2339
  developerSearch(query: string, options?: DeveloperSearchOptions): Promise<DeveloperSearchResponse>;
2340
+ /**
2341
+ * Search the Government Index: primary law and regulatory material
2342
+ * from US federal, state, and local government sources.
2343
+ */
2344
+ govSearch(query: string, options?: GovSearchOptions): Promise<GovSearchResponse>;
2326
2345
  /**
2327
2346
  * Submit feedback for a v2 job.
2328
2347
  * @param request Feedback payload with endpoint, job id, rating, and supporting signals.
@@ -2555,7 +2574,7 @@ declare class FirecrawlClient {
2555
2574
  }): Promise<AgentThreadResponse>;
2556
2575
  /**
2557
2576
  * Create a new browser session.
2558
- * @param args Session options (ttl, activityTtl, streamWebView, profile).
2577
+ * @param args Session options (ttl, activityTtl, streamWebView, blockAds, profile).
2559
2578
  * @returns Session id, CDP URL, live view URL, and expiration time.
2560
2579
  */
2561
2580
  browser(args?: Parameters<typeof browser>[1]): Promise<BrowserCreateResponse>;
@@ -3557,4 +3576,4 @@ declare class Firecrawl extends FirecrawlClient {
3557
3576
  get v1(): FirecrawlApp;
3558
3577
  }
3559
3578
 
3560
- export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AgentEffort, type AgentExchangeOptions, type AgentExchangeSummary, type AgentListItem, type AgentListOptions, type AgentListResponse, type AgentMode, type AgentOnTermsRequired, type AgentOptions$1 as AgentOptions, type AgentResponse, type AgentSkippedProvider, type AgentSnapshotResponse, type AgentStatusResponse, type AgentSuggestion, type AgentTermsGate, type AgentTermsRequiredAction, type AgentThread, type AgentThreadResponse, type AgentThreadRun, type AgentTraceActiveBrowserSession, type AgentTraceAgentFinishedEvent, type AgentTraceAgentIdentity, type AgentTraceAgentRole, type AgentTraceAgentStartedEvent, type AgentTraceArtifactChange, type AgentTraceArtifactUpdatedEvent, type AgentTraceBrowserSessionFinishedEvent, type AgentTraceBrowserSessionStartedEvent, type AgentTraceError, type AgentTraceErrorOccurredEvent, type AgentTraceEvent, type AgentTraceProgressReportedEvent, type AgentTraceReasoningSummaryEvent, type AgentTraceResponse, type AgentTraceRunCancelRequestedEvent, type AgentTraceRunFinishedEvent, type AgentTraceRunStartedEvent, type AgentTraceToolCallFinishedEvent, type AgentTraceToolCallStartedEvent, type AgentWebhookConfig, type AgentWebhookEvent, type AlexandriaCall, type AlexandriaOptions, type AlexandriaScrapeData, type AlexandriaScrapeError, type AlexandriaScrapeRequest, type AlexandriaScrapeResult, type AttributesFormat, type AuditMetadata$1 as AuditMetadata, type BatchScrapeJob, type BatchScrapeOptions, type BatchScrapeResponse$1 as BatchScrapeResponse, type BrandingProfile, type BrowserCreateResponse, type BrowserDeleteResponse, type BrowserExecuteResponse, type BrowserListResponse, type BrowserSession, type CategoryOption, type ChangeTrackingFormat, type ClickAction, type ConcurrencyCheck, type CrawlErrorsResponse$1 as CrawlErrorsResponse, type CrawlJob, type CrawlOptions, type CrawlResponse$1 as CrawlResponse, type CreateMonitorRequest, type CreditUsage, type CreditUsageHistoricalPeriod, type CreditUsageHistoricalResponse, type DeveloperSearchLicenseDisclosure, type DeveloperSearchOptions, type DeveloperSearchPassage, type DeveloperSearchRepoStatus, type DeveloperSearchResponse, type DeveloperSearchResult, type DeveloperSearchSourceStatus, type DeveloperSearchType, type DiscoveredTool, type Document, type DocumentMetadata, type EndpointFeedbackEndpoint, type EndpointFeedbackRequest, type ErrorDetails, type ExecuteJavascriptAction, type ExtractResponse$1 as ExtractResponse, type FeedbackMissingContent, type FeedbackRating, type FeedbackResponse, type FeedbackValuableSource, type FindToolsData, type FindToolsOptions, Firecrawl, FirecrawlApp as FirecrawlAppV1, FirecrawlClient, type FirecrawlClientInput, type FirecrawlClientOptions, type Format, type FormatOption, type FormatString, type GetMonitorCheckOptions, type GetPaperOptions, type GitHubScoreBreakdown, type GitHubSearchItem, type GitHubSearchResponse, type HighlightsFormat, type IdMap, type ImageParser, JobTimeoutError, type JsonFormat, type ListMonitorChecksOptions, type ListMonitorsOptions, type LocationConfig$1 as LocationConfig, type MapData, type MapOptions, type MenuAvailability, type MenuImage, type MenuItem, type MenuItemIdentifiers, type MenuMerchant, type MenuPrice, type MenuProfile, type MenuSection, type Monitor, type MonitorCheck, type MonitorCheckDetail, type MonitorCheckPage, type MonitorCrawlTarget, type MonitorCrawlTargetResult, type MonitorEmailNotification, type MonitorEmailRecipientSubscription, type MonitorJsonFieldDiff, type MonitorNotification, type MonitorPageDiff, type MonitorPageJudgment, type MonitorPageSnapshot, type MonitorSchedule, type MonitorScrapeTarget, type MonitorScrapeTargetResult, type MonitorSearchTarget, type MonitorSearchTargetResult, type MonitorSummary, type MonitorTarget, type MonitorTargetResult, type MonitorWebhookConfig, type PDFAction, type PDFParser, type PaginationConfig, type PaperMetadata, type PaperMetadataResponse, type PaperResult, type PaperSignals, type ParseFile, type ParseFileData, type ParseFormat, type ParseFormatInfo, type ParseFormatOption, type ParseFormatString, type ParseOptions, type Passage, type PdfBlockConfidence, type PdfBlockItem, type PdfPage, type PdfPageBlocks, type PendingApproval, type PendingApprovalCall, type PendingCallsApproval, type PendingTermsApproval, type PressAction, type ProductAvailability, type ProductImage, type ProductPrice, type ProductProfile, type ProductSale, type ProductVariant, type QueryFormat, type QuestionFormat, type QueueStatusResponse$1 as QueueStatusResponse, type ReadPaperResponse, type RedactPIIEntity, type RedactPIIOptions, type RequiresAction, ResearchClient, type ScrapeAction, type ScrapeBrowserDeleteResponse, type ScrapeExecuteRequest, type ScrapeExecuteResponse, type ScrapeOptions, type ScreenshotAction, type ScreenshotFormat, type ScrollAction, SdkError, type SearchData, type SearchFeedbackRequest, type SearchGithubOptions, type SearchPapersOptions, type SearchPapersResponse, type SearchRequest, type SearchResultImages, type SearchResultNews, type SearchResultWeb, type SimilarPapersOptions, type SimilarPapersResponse, type ThreatProtectionOptions, type TokenUsage, type TokenUsageHistoricalPeriod, type TokenUsageHistoricalResponse, type UpdateMonitorRequest, type Viewport, type WaitAction, Watcher, type WatcherOptions, type WebhookConfig, type WriteAction, Firecrawl as default, parseRequiresAction };
3579
+ export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AgentEffort, type AgentExchangeOptions, type AgentExchangeSummary, type AgentListItem, type AgentListOptions, type AgentListResponse, type AgentMode, type AgentOnTermsRequired, type AgentOptions$1 as AgentOptions, type AgentResponse, type AgentSkippedProvider, type AgentSnapshotResponse, type AgentStatusResponse, type AgentSuggestion, type AgentTermsGate, type AgentTermsRequiredAction, type AgentThread, type AgentThreadResponse, type AgentThreadRun, type AgentTraceActiveBrowserSession, type AgentTraceAgentFinishedEvent, type AgentTraceAgentIdentity, type AgentTraceAgentRole, type AgentTraceAgentStartedEvent, type AgentTraceArtifactChange, type AgentTraceArtifactUpdatedEvent, type AgentTraceBrowserSessionFinishedEvent, type AgentTraceBrowserSessionStartedEvent, type AgentTraceError, type AgentTraceErrorOccurredEvent, type AgentTraceEvent, type AgentTraceProgressReportedEvent, type AgentTraceReasoningSummaryEvent, type AgentTraceResponse, type AgentTraceRunCancelRequestedEvent, type AgentTraceRunFinishedEvent, type AgentTraceRunStartedEvent, type AgentTraceToolCallFinishedEvent, type AgentTraceToolCallStartedEvent, type AgentWebhookConfig, type AgentWebhookEvent, type AlexandriaCall, type AlexandriaOptions, type AlexandriaScrapeData, type AlexandriaScrapeError, type AlexandriaScrapeRequest, type AlexandriaScrapeResult, type AttributesFormat, type AuditMetadata$1 as AuditMetadata, type BatchScrapeJob, type BatchScrapeOptions, type BatchScrapeResponse$1 as BatchScrapeResponse, type BrandingProfile, type BrowserCreateResponse, type BrowserDeleteResponse, type BrowserExecuteResponse, type BrowserListResponse, type BrowserSession, type CategoryOption, type ChangeTrackingFormat, type ClickAction, type ConcurrencyCheck, type CrawlErrorsResponse$1 as CrawlErrorsResponse, type CrawlJob, type CrawlOptions, type CrawlResponse$1 as CrawlResponse, type CreateMonitorRequest, type CreditUsage, type CreditUsageHistoricalPeriod, type CreditUsageHistoricalResponse, type DeveloperSearchLicenseDisclosure, type DeveloperSearchOptions, type DeveloperSearchPassage, type DeveloperSearchRepoStatus, type DeveloperSearchResponse, type DeveloperSearchResult, type DeveloperSearchSourceStatus, type DeveloperSearchType, type DiscoveredTool, type Document, type DocumentMetadata, type EndpointFeedbackEndpoint, type EndpointFeedbackRequest, type ErrorDetails, type ExecuteJavascriptAction, type ExtractResponse$1 as ExtractResponse, type FeedbackMissingContent, type FeedbackRating, type FeedbackResponse, type FeedbackValuableSource, type FindToolsData, type FindToolsOptions, Firecrawl, FirecrawlApp as FirecrawlAppV1, FirecrawlClient, type FirecrawlClientInput, type FirecrawlClientOptions, type Format, type FormatOption, type FormatString, type GetMonitorCheckOptions, type GetPaperOptions, type GitHubScoreBreakdown, type GitHubSearchItem, type GitHubSearchResponse, type GovSearchOptions, type GovSearchResponse, type HighlightsFormat, type IdMap, type ImageParser, JobTimeoutError, type JsonFormat, type ListMonitorChecksOptions, type ListMonitorsOptions, type LocationConfig$1 as LocationConfig, type MapData, type MapOptions, type MenuAvailability, type MenuImage, type MenuItem, type MenuItemIdentifiers, type MenuMerchant, type MenuPrice, type MenuProfile, type MenuSection, type Monitor, type MonitorCheck, type MonitorCheckDetail, type MonitorCheckPage, type MonitorCrawlTarget, type MonitorCrawlTargetResult, type MonitorEmailNotification, type MonitorEmailRecipientSubscription, type MonitorJsonFieldDiff, type MonitorNotification, type MonitorPageDiff, type MonitorPageJudgment, type MonitorPageSnapshot, type MonitorSchedule, type MonitorScrapeTarget, type MonitorScrapeTargetResult, type MonitorSearchTarget, type MonitorSearchTargetResult, type MonitorSummary, type MonitorTarget, type MonitorTargetResult, type MonitorWebhookConfig, type PDFAction, type PDFParser, type PaginationConfig, type PaperMetadata, type PaperMetadataResponse, type PaperResult, type PaperSignals, type ParseFile, type ParseFileData, type ParseFormat, type ParseFormatInfo, type ParseFormatOption, type ParseFormatString, type ParseOptions, type Passage, type PdfBlockConfidence, type PdfBlockItem, type PdfPage, type PdfPageBlocks, type PendingApproval, type PendingApprovalCall, type PendingCallsApproval, type PendingTermsApproval, type PressAction, type ProductAvailability, type ProductImage, type ProductPrice, type ProductProfile, type ProductSale, type ProductVariant, type QueryFormat, type QuestionFormat, type QueueStatusResponse$1 as QueueStatusResponse, type ReadPaperResponse, type RedactPIIEntity, type RedactPIIOptions, type RequiresAction, ResearchClient, type ScrapeAction, type ScrapeBrowserDeleteResponse, type ScrapeExecuteRequest, type ScrapeExecuteResponse, type ScrapeOptions, type ScreenshotAction, type ScreenshotFormat, type ScrollAction, SdkError, type SearchData, type SearchFeedbackRequest, type SearchGithubOptions, type SearchPapersOptions, type SearchPapersResponse, type SearchRequest, type SearchResultImages, type SearchResultNews, type SearchResultWeb, type SimilarPapersOptions, type SimilarPapersResponse, type ThreatProtectionOptions, type TokenUsage, type TokenUsageHistoricalPeriod, type TokenUsageHistoricalResponse, type UpdateMonitorRequest, type Viewport, type WaitAction, Watcher, type WatcherOptions, type WebhookConfig, type WriteAction, Firecrawl as default, parseRequiresAction };
package/dist/index.d.ts CHANGED
@@ -659,6 +659,16 @@ interface DeveloperSearchResponse {
659
659
  /** Present only when sources were requested. */
660
660
  sources?: DeveloperSearchSourceStatus[];
661
661
  }
662
+ interface GovSearchOptions {
663
+ /** Total ranked results, 1–100 (default 10). */
664
+ k?: number;
665
+ }
666
+ interface GovSearchResponse {
667
+ success: boolean;
668
+ data: {
669
+ web: SearchResultWeb[];
670
+ };
671
+ }
662
672
  interface SearchResultWeb {
663
673
  url: string;
664
674
  title?: string;
@@ -814,6 +824,8 @@ interface AlexandriaOptions {
814
824
  * - `pdf` — restrict results to PDFs (adds `filetype:pdf`).
815
825
  * - `developer` — developer-index results (issues, pull requests, READMEs and
816
826
  * documentation) served in `web`; cannot be combined with other categories.
827
+ * - `gov` — Government Index results served in `web`; cannot be combined
828
+ * with other categories.
817
829
  *
818
830
  * ⚠️ `categories: ["research"]` is **not** Firecrawl's research paper index.
819
831
  * To search papers themselves — ~43M abstracts, roughly 90% biomedical
@@ -825,7 +837,7 @@ interface AlexandriaOptions {
825
837
  * happen to live on academic domains → `search({ categories: ["research"] })`.
826
838
  */
827
839
  interface CategoryOption {
828
- type: "github" | "research" | "pdf" | "developer";
840
+ type: "github" | "research" | "pdf" | "developer" | "gov";
829
841
  }
830
842
  interface SearchRequest {
831
843
  query: string;
@@ -844,7 +856,7 @@ interface SearchRequest {
844
856
  * over ~43M paper abstracts (PubMed / bioRxiv / medRxiv / arXiv) use
845
857
  * `firecrawl.research.searchPapers()` instead.
846
858
  */
847
- categories?: Array<"github" | "research" | "pdf" | "developer" | CategoryOption>;
859
+ categories?: Array<"github" | "research" | "pdf" | "developer" | "gov" | CategoryOption>;
848
860
  includeDomains?: string[];
849
861
  excludeDomains?: string[];
850
862
  limit?: number;
@@ -2093,6 +2105,8 @@ declare function browser(http: HttpClient, args?: {
2093
2105
  ttl?: number;
2094
2106
  activityTtl?: number;
2095
2107
  streamWebView?: boolean;
2108
+ /** Block ads, trackers and cookie notices, as in scrape (default true). */
2109
+ blockAds?: boolean;
2096
2110
  profile?: {
2097
2111
  name: string;
2098
2112
  saveChanges?: boolean;
@@ -2323,6 +2337,11 @@ declare class FirecrawlClient {
2323
2337
  * requested passages, citations, license disclosures, and indexing echoes.
2324
2338
  */
2325
2339
  developerSearch(query: string, options?: DeveloperSearchOptions): Promise<DeveloperSearchResponse>;
2340
+ /**
2341
+ * Search the Government Index: primary law and regulatory material
2342
+ * from US federal, state, and local government sources.
2343
+ */
2344
+ govSearch(query: string, options?: GovSearchOptions): Promise<GovSearchResponse>;
2326
2345
  /**
2327
2346
  * Submit feedback for a v2 job.
2328
2347
  * @param request Feedback payload with endpoint, job id, rating, and supporting signals.
@@ -2555,7 +2574,7 @@ declare class FirecrawlClient {
2555
2574
  }): Promise<AgentThreadResponse>;
2556
2575
  /**
2557
2576
  * Create a new browser session.
2558
- * @param args Session options (ttl, activityTtl, streamWebView, profile).
2577
+ * @param args Session options (ttl, activityTtl, streamWebView, blockAds, profile).
2559
2578
  * @returns Session id, CDP URL, live view URL, and expiration time.
2560
2579
  */
2561
2580
  browser(args?: Parameters<typeof browser>[1]): Promise<BrowserCreateResponse>;
@@ -3557,4 +3576,4 @@ declare class Firecrawl extends FirecrawlClient {
3557
3576
  get v1(): FirecrawlApp;
3558
3577
  }
3559
3578
 
3560
- export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AgentEffort, type AgentExchangeOptions, type AgentExchangeSummary, type AgentListItem, type AgentListOptions, type AgentListResponse, type AgentMode, type AgentOnTermsRequired, type AgentOptions$1 as AgentOptions, type AgentResponse, type AgentSkippedProvider, type AgentSnapshotResponse, type AgentStatusResponse, type AgentSuggestion, type AgentTermsGate, type AgentTermsRequiredAction, type AgentThread, type AgentThreadResponse, type AgentThreadRun, type AgentTraceActiveBrowserSession, type AgentTraceAgentFinishedEvent, type AgentTraceAgentIdentity, type AgentTraceAgentRole, type AgentTraceAgentStartedEvent, type AgentTraceArtifactChange, type AgentTraceArtifactUpdatedEvent, type AgentTraceBrowserSessionFinishedEvent, type AgentTraceBrowserSessionStartedEvent, type AgentTraceError, type AgentTraceErrorOccurredEvent, type AgentTraceEvent, type AgentTraceProgressReportedEvent, type AgentTraceReasoningSummaryEvent, type AgentTraceResponse, type AgentTraceRunCancelRequestedEvent, type AgentTraceRunFinishedEvent, type AgentTraceRunStartedEvent, type AgentTraceToolCallFinishedEvent, type AgentTraceToolCallStartedEvent, type AgentWebhookConfig, type AgentWebhookEvent, type AlexandriaCall, type AlexandriaOptions, type AlexandriaScrapeData, type AlexandriaScrapeError, type AlexandriaScrapeRequest, type AlexandriaScrapeResult, type AttributesFormat, type AuditMetadata$1 as AuditMetadata, type BatchScrapeJob, type BatchScrapeOptions, type BatchScrapeResponse$1 as BatchScrapeResponse, type BrandingProfile, type BrowserCreateResponse, type BrowserDeleteResponse, type BrowserExecuteResponse, type BrowserListResponse, type BrowserSession, type CategoryOption, type ChangeTrackingFormat, type ClickAction, type ConcurrencyCheck, type CrawlErrorsResponse$1 as CrawlErrorsResponse, type CrawlJob, type CrawlOptions, type CrawlResponse$1 as CrawlResponse, type CreateMonitorRequest, type CreditUsage, type CreditUsageHistoricalPeriod, type CreditUsageHistoricalResponse, type DeveloperSearchLicenseDisclosure, type DeveloperSearchOptions, type DeveloperSearchPassage, type DeveloperSearchRepoStatus, type DeveloperSearchResponse, type DeveloperSearchResult, type DeveloperSearchSourceStatus, type DeveloperSearchType, type DiscoveredTool, type Document, type DocumentMetadata, type EndpointFeedbackEndpoint, type EndpointFeedbackRequest, type ErrorDetails, type ExecuteJavascriptAction, type ExtractResponse$1 as ExtractResponse, type FeedbackMissingContent, type FeedbackRating, type FeedbackResponse, type FeedbackValuableSource, type FindToolsData, type FindToolsOptions, Firecrawl, FirecrawlApp as FirecrawlAppV1, FirecrawlClient, type FirecrawlClientInput, type FirecrawlClientOptions, type Format, type FormatOption, type FormatString, type GetMonitorCheckOptions, type GetPaperOptions, type GitHubScoreBreakdown, type GitHubSearchItem, type GitHubSearchResponse, type HighlightsFormat, type IdMap, type ImageParser, JobTimeoutError, type JsonFormat, type ListMonitorChecksOptions, type ListMonitorsOptions, type LocationConfig$1 as LocationConfig, type MapData, type MapOptions, type MenuAvailability, type MenuImage, type MenuItem, type MenuItemIdentifiers, type MenuMerchant, type MenuPrice, type MenuProfile, type MenuSection, type Monitor, type MonitorCheck, type MonitorCheckDetail, type MonitorCheckPage, type MonitorCrawlTarget, type MonitorCrawlTargetResult, type MonitorEmailNotification, type MonitorEmailRecipientSubscription, type MonitorJsonFieldDiff, type MonitorNotification, type MonitorPageDiff, type MonitorPageJudgment, type MonitorPageSnapshot, type MonitorSchedule, type MonitorScrapeTarget, type MonitorScrapeTargetResult, type MonitorSearchTarget, type MonitorSearchTargetResult, type MonitorSummary, type MonitorTarget, type MonitorTargetResult, type MonitorWebhookConfig, type PDFAction, type PDFParser, type PaginationConfig, type PaperMetadata, type PaperMetadataResponse, type PaperResult, type PaperSignals, type ParseFile, type ParseFileData, type ParseFormat, type ParseFormatInfo, type ParseFormatOption, type ParseFormatString, type ParseOptions, type Passage, type PdfBlockConfidence, type PdfBlockItem, type PdfPage, type PdfPageBlocks, type PendingApproval, type PendingApprovalCall, type PendingCallsApproval, type PendingTermsApproval, type PressAction, type ProductAvailability, type ProductImage, type ProductPrice, type ProductProfile, type ProductSale, type ProductVariant, type QueryFormat, type QuestionFormat, type QueueStatusResponse$1 as QueueStatusResponse, type ReadPaperResponse, type RedactPIIEntity, type RedactPIIOptions, type RequiresAction, ResearchClient, type ScrapeAction, type ScrapeBrowserDeleteResponse, type ScrapeExecuteRequest, type ScrapeExecuteResponse, type ScrapeOptions, type ScreenshotAction, type ScreenshotFormat, type ScrollAction, SdkError, type SearchData, type SearchFeedbackRequest, type SearchGithubOptions, type SearchPapersOptions, type SearchPapersResponse, type SearchRequest, type SearchResultImages, type SearchResultNews, type SearchResultWeb, type SimilarPapersOptions, type SimilarPapersResponse, type ThreatProtectionOptions, type TokenUsage, type TokenUsageHistoricalPeriod, type TokenUsageHistoricalResponse, type UpdateMonitorRequest, type Viewport, type WaitAction, Watcher, type WatcherOptions, type WebhookConfig, type WriteAction, Firecrawl as default, parseRequiresAction };
3579
+ export { type ActionOption, type ActiveCrawl, type ActiveCrawlsResponse, type AgentEffort, type AgentExchangeOptions, type AgentExchangeSummary, type AgentListItem, type AgentListOptions, type AgentListResponse, type AgentMode, type AgentOnTermsRequired, type AgentOptions$1 as AgentOptions, type AgentResponse, type AgentSkippedProvider, type AgentSnapshotResponse, type AgentStatusResponse, type AgentSuggestion, type AgentTermsGate, type AgentTermsRequiredAction, type AgentThread, type AgentThreadResponse, type AgentThreadRun, type AgentTraceActiveBrowserSession, type AgentTraceAgentFinishedEvent, type AgentTraceAgentIdentity, type AgentTraceAgentRole, type AgentTraceAgentStartedEvent, type AgentTraceArtifactChange, type AgentTraceArtifactUpdatedEvent, type AgentTraceBrowserSessionFinishedEvent, type AgentTraceBrowserSessionStartedEvent, type AgentTraceError, type AgentTraceErrorOccurredEvent, type AgentTraceEvent, type AgentTraceProgressReportedEvent, type AgentTraceReasoningSummaryEvent, type AgentTraceResponse, type AgentTraceRunCancelRequestedEvent, type AgentTraceRunFinishedEvent, type AgentTraceRunStartedEvent, type AgentTraceToolCallFinishedEvent, type AgentTraceToolCallStartedEvent, type AgentWebhookConfig, type AgentWebhookEvent, type AlexandriaCall, type AlexandriaOptions, type AlexandriaScrapeData, type AlexandriaScrapeError, type AlexandriaScrapeRequest, type AlexandriaScrapeResult, type AttributesFormat, type AuditMetadata$1 as AuditMetadata, type BatchScrapeJob, type BatchScrapeOptions, type BatchScrapeResponse$1 as BatchScrapeResponse, type BrandingProfile, type BrowserCreateResponse, type BrowserDeleteResponse, type BrowserExecuteResponse, type BrowserListResponse, type BrowserSession, type CategoryOption, type ChangeTrackingFormat, type ClickAction, type ConcurrencyCheck, type CrawlErrorsResponse$1 as CrawlErrorsResponse, type CrawlJob, type CrawlOptions, type CrawlResponse$1 as CrawlResponse, type CreateMonitorRequest, type CreditUsage, type CreditUsageHistoricalPeriod, type CreditUsageHistoricalResponse, type DeveloperSearchLicenseDisclosure, type DeveloperSearchOptions, type DeveloperSearchPassage, type DeveloperSearchRepoStatus, type DeveloperSearchResponse, type DeveloperSearchResult, type DeveloperSearchSourceStatus, type DeveloperSearchType, type DiscoveredTool, type Document, type DocumentMetadata, type EndpointFeedbackEndpoint, type EndpointFeedbackRequest, type ErrorDetails, type ExecuteJavascriptAction, type ExtractResponse$1 as ExtractResponse, type FeedbackMissingContent, type FeedbackRating, type FeedbackResponse, type FeedbackValuableSource, type FindToolsData, type FindToolsOptions, Firecrawl, FirecrawlApp as FirecrawlAppV1, FirecrawlClient, type FirecrawlClientInput, type FirecrawlClientOptions, type Format, type FormatOption, type FormatString, type GetMonitorCheckOptions, type GetPaperOptions, type GitHubScoreBreakdown, type GitHubSearchItem, type GitHubSearchResponse, type GovSearchOptions, type GovSearchResponse, type HighlightsFormat, type IdMap, type ImageParser, JobTimeoutError, type JsonFormat, type ListMonitorChecksOptions, type ListMonitorsOptions, type LocationConfig$1 as LocationConfig, type MapData, type MapOptions, type MenuAvailability, type MenuImage, type MenuItem, type MenuItemIdentifiers, type MenuMerchant, type MenuPrice, type MenuProfile, type MenuSection, type Monitor, type MonitorCheck, type MonitorCheckDetail, type MonitorCheckPage, type MonitorCrawlTarget, type MonitorCrawlTargetResult, type MonitorEmailNotification, type MonitorEmailRecipientSubscription, type MonitorJsonFieldDiff, type MonitorNotification, type MonitorPageDiff, type MonitorPageJudgment, type MonitorPageSnapshot, type MonitorSchedule, type MonitorScrapeTarget, type MonitorScrapeTargetResult, type MonitorSearchTarget, type MonitorSearchTargetResult, type MonitorSummary, type MonitorTarget, type MonitorTargetResult, type MonitorWebhookConfig, type PDFAction, type PDFParser, type PaginationConfig, type PaperMetadata, type PaperMetadataResponse, type PaperResult, type PaperSignals, type ParseFile, type ParseFileData, type ParseFormat, type ParseFormatInfo, type ParseFormatOption, type ParseFormatString, type ParseOptions, type Passage, type PdfBlockConfidence, type PdfBlockItem, type PdfPage, type PdfPageBlocks, type PendingApproval, type PendingApprovalCall, type PendingCallsApproval, type PendingTermsApproval, type PressAction, type ProductAvailability, type ProductImage, type ProductPrice, type ProductProfile, type ProductSale, type ProductVariant, type QueryFormat, type QuestionFormat, type QueueStatusResponse$1 as QueueStatusResponse, type ReadPaperResponse, type RedactPIIEntity, type RedactPIIOptions, type RequiresAction, ResearchClient, type ScrapeAction, type ScrapeBrowserDeleteResponse, type ScrapeExecuteRequest, type ScrapeExecuteResponse, type ScrapeOptions, type ScreenshotAction, type ScreenshotFormat, type ScrollAction, SdkError, type SearchData, type SearchFeedbackRequest, type SearchGithubOptions, type SearchPapersOptions, type SearchPapersResponse, type SearchRequest, type SearchResultImages, type SearchResultNews, type SearchResultWeb, type SimilarPapersOptions, type SimilarPapersResponse, type ThreatProtectionOptions, type TokenUsage, type TokenUsageHistoricalPeriod, type TokenUsageHistoricalResponse, type UpdateMonitorRequest, type Viewport, type WaitAction, Watcher, type WatcherOptions, type WebhookConfig, type WriteAction, Firecrawl as default, parseRequiresAction };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  require_package
3
- } from "./chunk-TALYWLKJ.js";
3
+ } from "./chunk-BD2TNHAD.js";
4
4
 
5
5
  // src/v2/utils/httpClient.ts
6
6
  import axios from "axios";
@@ -891,6 +891,27 @@ async function developerSearch(http, query, options = {}) {
891
891
  }
892
892
  }
893
893
 
894
+ // src/v2/methods/gov.ts
895
+ var ENDPOINT2 = "/v2/search/gov";
896
+ async function govSearch(http, query, options = {}) {
897
+ if (!query || !query.trim()) throw new Error("query cannot be empty");
898
+ try {
899
+ const response = await http.post(ENDPOINT2, {
900
+ query,
901
+ ...options.k !== void 0 ? { k: options.k } : {}
902
+ });
903
+ if (response.status !== 200 || !response.data?.success) {
904
+ throwForBadResponse(response, "search the Government Index");
905
+ }
906
+ return response.data;
907
+ } catch (error) {
908
+ if (error?.isAxiosError) {
909
+ return normalizeAxiosError(error, "search the Government Index");
910
+ }
911
+ throw error;
912
+ }
913
+ }
914
+
894
915
  // src/v2/methods/map.ts
895
916
  function prepareMapPayload(url, options) {
896
917
  if (!url || !url.trim()) throw new Error("URL cannot be empty");
@@ -1510,6 +1531,7 @@ async function browser(http, args = {}) {
1510
1531
  if (args.ttl != null) body.ttl = args.ttl;
1511
1532
  if (args.activityTtl != null) body.activityTtl = args.activityTtl;
1512
1533
  if (args.streamWebView != null) body.streamWebView = args.streamWebView;
1534
+ if (args.blockAds != null) body.blockAds = args.blockAds;
1513
1535
  if (args.profile != null) body.profile = args.profile;
1514
1536
  if (args.integration != null) body.integration = args.integration;
1515
1537
  if (args.origin) body.origin = args.origin;
@@ -2272,6 +2294,13 @@ var FirecrawlClient = class {
2272
2294
  async developerSearch(query, options = {}) {
2273
2295
  return developerSearch(this.http, query, options);
2274
2296
  }
2297
+ /**
2298
+ * Search the Government Index: primary law and regulatory material
2299
+ * from US federal, state, and local government sources.
2300
+ */
2301
+ async govSearch(query, options = {}) {
2302
+ return govSearch(this.http, query, options);
2303
+ }
2275
2304
  /**
2276
2305
  * Submit feedback for a v2 job.
2277
2306
  * @param request Feedback payload with endpoint, job id, rating, and supporting signals.
@@ -2567,7 +2596,7 @@ var FirecrawlClient = class {
2567
2596
  // Browser
2568
2597
  /**
2569
2598
  * Create a new browser session.
2570
- * @param args Session options (ttl, activityTtl, streamWebView, profile).
2599
+ * @param args Session options (ttl, activityTtl, streamWebView, blockAds, profile).
2571
2600
  * @returns Session id, CDP URL, live view URL, and expiration time.
2572
2601
  */
2573
2602
  async browser(args = {}) {
@@ -2706,7 +2735,7 @@ var FirecrawlApp = class {
2706
2735
  if (typeof process !== "undefined" && process.env && process.env.npm_package_version) {
2707
2736
  return process.env.npm_package_version;
2708
2737
  }
2709
- const packageJson = await import("./package-NTEZDZT4.js");
2738
+ const packageJson = await import("./package-WSFVH42J.js");
2710
2739
  return packageJson.default.version;
2711
2740
  } catch (error) {
2712
2741
  const isTest = typeof process !== "undefined" && (process.env.JEST_WORKER_ID != null || false);
@@ -1,4 +1,4 @@
1
1
  import {
2
2
  require_package
3
- } from "./chunk-TALYWLKJ.js";
3
+ } from "./chunk-BD2TNHAD.js";
4
4
  export default require_package();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mendable/firecrawl-js",
3
- "version": "4.42.4",
3
+ "version": "4.44.0",
4
4
  "description": "JavaScript SDK for the Firecrawl API: web scraping, crawling, web search, and scientific literature search over a research paper index of PubMed, bioRxiv, medRxiv and arXiv abstracts",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,66 @@
1
+ import { describe, expect, jest, test } from "@jest/globals";
2
+ import { FirecrawlClient } from "../../../v2/client";
3
+
4
+ const response = {
5
+ success: true,
6
+ data: {
7
+ web: [
8
+ {
9
+ url: "https://www.ecfr.gov/current/title-21/chapter-I/subchapter-B/part-101",
10
+ title: "21 CFR Part 101 -- Food Labeling",
11
+ description: "matched snippet",
12
+ position: 1,
13
+ },
14
+ ],
15
+ },
16
+ };
17
+
18
+ function clientWith(http: any) {
19
+ const client = new FirecrawlClient({
20
+ apiKey: "test",
21
+ apiUrl: "http://localhost",
22
+ });
23
+ (client as any).http = http;
24
+ return client;
25
+ }
26
+
27
+ describe("govSearch", () => {
28
+ test.each([
29
+ [{ k: 5 }, { query: "food labeling requirements", k: 5 }],
30
+ [undefined, { query: "food labeling requirements" }],
31
+ ])("posts %p and returns web results", async (options, body) => {
32
+ const http = {
33
+ post: jest.fn(async () => ({ status: 200, data: response })),
34
+ } as any;
35
+
36
+ const result = await clientWith(http).govSearch(
37
+ "food labeling requirements",
38
+ options,
39
+ );
40
+
41
+ expect(http.post).toHaveBeenCalledWith("/v2/search/gov", body);
42
+ expect(result).toEqual(response);
43
+ });
44
+
45
+ test("rejects an empty query", async () => {
46
+ const http = { post: jest.fn() } as any;
47
+
48
+ await expect(clientWith(http).govSearch(" ")).rejects.toThrow(
49
+ "query cannot be empty",
50
+ );
51
+ expect(http.post).not.toHaveBeenCalled();
52
+ });
53
+
54
+ test("throws on an unsuccessful response body", async () => {
55
+ const http = {
56
+ post: jest.fn(async () => ({
57
+ status: 200,
58
+ data: { success: false, error: "Search failed" },
59
+ })),
60
+ } as any;
61
+
62
+ await expect(clientWith(http).govSearch("zoning variance")).rejects.toThrow(
63
+ "Search failed",
64
+ );
65
+ });
66
+ });
package/src/v2/client.ts CHANGED
@@ -8,6 +8,7 @@ import { parse as parseMethod, getParseFormats } from "./methods/parse";
8
8
  import { search } from "./methods/search";
9
9
  import { scrapeAlexandria, findTools } from "./methods/tools";
10
10
  import { developerSearch as developerSearchMethod } from "./methods/developer";
11
+ import { govSearch as govSearchMethod } from "./methods/gov";
11
12
  import { map as mapMethod } from "./methods/map";
12
13
  import { feedback as feedbackMethod, searchFeedback as searchFeedbackMethod } from "./methods/feedback";
13
14
  import {
@@ -60,6 +61,8 @@ import type {
60
61
  SearchRequest,
61
62
  DeveloperSearchOptions,
62
63
  DeveloperSearchResponse,
64
+ GovSearchOptions,
65
+ GovSearchResponse,
63
66
  EndpointFeedbackRequest,
64
67
  FeedbackResponse,
65
68
  SearchFeedbackRequest,
@@ -306,6 +309,17 @@ export class FirecrawlClient {
306
309
  return developerSearchMethod(this.http, query, options);
307
310
  }
308
311
 
312
+ /**
313
+ * Search the Government Index: primary law and regulatory material
314
+ * from US federal, state, and local government sources.
315
+ */
316
+ async govSearch(
317
+ query: string,
318
+ options: GovSearchOptions = {},
319
+ ): Promise<GovSearchResponse> {
320
+ return govSearchMethod(this.http, query, options);
321
+ }
322
+
309
323
  /**
310
324
  * Submit feedback for a v2 job.
311
325
  * @param request Feedback payload with endpoint, job id, rating, and supporting signals.
@@ -627,7 +641,7 @@ export class FirecrawlClient {
627
641
  // Browser
628
642
  /**
629
643
  * Create a new browser session.
630
- * @param args Session options (ttl, activityTtl, streamWebView, profile).
644
+ * @param args Session options (ttl, activityTtl, streamWebView, blockAds, profile).
631
645
  * @returns Session id, CDP URL, live view URL, and expiration time.
632
646
  */
633
647
  async browser(
@@ -16,6 +16,8 @@ export async function browser(
16
16
  ttl?: number;
17
17
  activityTtl?: number;
18
18
  streamWebView?: boolean;
19
+ /** Block ads, trackers and cookie notices, as in scrape (default true). */
20
+ blockAds?: boolean;
19
21
  profile?: {
20
22
  name: string;
21
23
  saveChanges?: boolean;
@@ -28,6 +30,7 @@ export async function browser(
28
30
  if (args.ttl != null) body.ttl = args.ttl;
29
31
  if (args.activityTtl != null) body.activityTtl = args.activityTtl;
30
32
  if (args.streamWebView != null) body.streamWebView = args.streamWebView;
33
+ if (args.blockAds != null) body.blockAds = args.blockAds;
31
34
  if (args.profile != null) body.profile = args.profile;
32
35
  if (args.integration != null) body.integration = args.integration;
33
36
  if (args.origin) body.origin = args.origin;
@@ -0,0 +1,34 @@
1
+ import type { GovSearchOptions, GovSearchResponse } from "../types";
2
+ import { HttpClient } from "../utils/httpClient";
3
+ import {
4
+ normalizeAxiosError,
5
+ throwForBadResponse,
6
+ } from "../utils/errorHandler";
7
+
8
+ const ENDPOINT = "/v2/search/gov";
9
+
10
+ /** Search the Government Index. */
11
+ export async function govSearch(
12
+ http: HttpClient,
13
+ query: string,
14
+ options: GovSearchOptions = {},
15
+ ): Promise<GovSearchResponse> {
16
+ if (!query || !query.trim()) throw new Error("query cannot be empty");
17
+
18
+ try {
19
+ const response = await http.post<GovSearchResponse>(ENDPOINT, {
20
+ query,
21
+ ...(options.k !== undefined ? { k: options.k } : {}),
22
+ });
23
+
24
+ if (response.status !== 200 || !response.data?.success) {
25
+ throwForBadResponse(response, "search the Government Index");
26
+ }
27
+ return response.data;
28
+ } catch (error: any) {
29
+ if (error?.isAxiosError) {
30
+ return normalizeAxiosError(error, "search the Government Index");
31
+ }
32
+ throw error;
33
+ }
34
+ }
package/src/v2/types.ts CHANGED
@@ -806,6 +806,16 @@ export interface DeveloperSearchResponse {
806
806
  sources?: DeveloperSearchSourceStatus[];
807
807
  }
808
808
 
809
+ export interface GovSearchOptions {
810
+ /** Total ranked results, 1–100 (default 10). */
811
+ k?: number;
812
+ }
813
+
814
+ export interface GovSearchResponse {
815
+ success: boolean;
816
+ data: { web: SearchResultWeb[] };
817
+ }
818
+
809
819
  export interface SearchResultWeb {
810
820
  url: string;
811
821
  title?: string;
@@ -973,6 +983,8 @@ export interface AlexandriaOptions {
973
983
  * - `pdf` — restrict results to PDFs (adds `filetype:pdf`).
974
984
  * - `developer` — developer-index results (issues, pull requests, READMEs and
975
985
  * documentation) served in `web`; cannot be combined with other categories.
986
+ * - `gov` — Government Index results served in `web`; cannot be combined
987
+ * with other categories.
976
988
  *
977
989
  * ⚠️ `categories: ["research"]` is **not** Firecrawl's research paper index.
978
990
  * To search papers themselves — ~43M abstracts, roughly 90% biomedical
@@ -984,7 +996,7 @@ export interface AlexandriaOptions {
984
996
  * happen to live on academic domains → `search({ categories: ["research"] })`.
985
997
  */
986
998
  export interface CategoryOption {
987
- type: "github" | "research" | "pdf" | "developer";
999
+ type: "github" | "research" | "pdf" | "developer" | "gov";
988
1000
  }
989
1001
 
990
1002
  export interface SearchRequest {
@@ -1006,7 +1018,7 @@ export interface SearchRequest {
1006
1018
  * `firecrawl.research.searchPapers()` instead.
1007
1019
  */
1008
1020
  categories?: Array<
1009
- "github" | "research" | "pdf" | "developer" | CategoryOption
1021
+ "github" | "research" | "pdf" | "developer" | "gov" | CategoryOption
1010
1022
  >;
1011
1023
  includeDomains?: string[];
1012
1024
  excludeDomains?: string[];