diff --git a/docs.json b/docs.json index 626845a7..20f0cea5 100755 --- a/docs.json +++ b/docs.json @@ -224,6 +224,7 @@ { "group": "Community", "pages": [ + "sdks/elixir", "sdks/go", "sdks/rust" ] @@ -456,6 +457,7 @@ { "group": "Community", "pages": [ + "sdks/elixir", "sdks/go", "sdks/rust" ] @@ -751,6 +753,7 @@ { "group": "Comunidad", "pages": [ + "es/sdks/elixir", "es/sdks/go", "es/sdks/rust" ] @@ -983,6 +986,7 @@ { "group": "Comunidad", "pages": [ + "es/sdks/elixir", "es/sdks/go", "es/sdks/rust" ] @@ -1278,6 +1282,7 @@ { "group": "Communauté", "pages": [ + "fr/sdks/elixir", "fr/sdks/go", "fr/sdks/rust" ] @@ -1510,6 +1515,7 @@ { "group": "Communauté", "pages": [ + "fr/sdks/elixir", "fr/sdks/go", "fr/sdks/rust" ] @@ -1805,6 +1811,7 @@ { "group": "コミュニティ", "pages": [ + "ja/sdks/elixir", "ja/sdks/go", "ja/sdks/rust" ] @@ -2037,6 +2044,7 @@ { "group": "コミュニティ", "pages": [ + "ja/sdks/elixir", "ja/sdks/go", "ja/sdks/rust" ] @@ -2332,6 +2340,7 @@ { "group": "Comunidade", "pages": [ + "pt-BR/sdks/elixir", "pt-BR/sdks/go", "pt-BR/sdks/rust" ] @@ -2564,6 +2573,7 @@ { "group": "Comunidade", "pages": [ + "pt-BR/sdks/elixir", "pt-BR/sdks/go", "pt-BR/sdks/rust" ] @@ -2859,6 +2869,7 @@ { "group": "社区", "pages": [ + "zh/sdks/elixir", "zh/sdks/go", "zh/sdks/rust" ] @@ -3091,6 +3102,7 @@ { "group": "社区", "pages": [ + "zh/sdks/elixir", "zh/sdks/go", "zh/sdks/rust" ] diff --git a/sdks/elixir.mdx b/sdks/elixir.mdx new file mode 100644 index 00000000..5be4066a --- /dev/null +++ b/sdks/elixir.mdx @@ -0,0 +1,129 @@ +--- +title: 'Elixir' +description: 'Firecrawl Elixir SDK is an auto-generated client for the Firecrawl API v2, built with Req and NimbleOptions validation.' +icon: 'droplet' +og:title: "Elixir SDK | Firecrawl" +og:description: "Firecrawl Elixir SDK is an auto-generated client for the Firecrawl API v2, built with Req and NimbleOptions validation." +--- + +## Installation + +Add `firecrawl` to your list of dependencies in `mix.exs`: + +```elixir +def deps do + [ + {:firecrawl, "~> 0.1.1"} + ] +end +``` + +## Configuration + +Set your API key in application config: + +```elixir +config :firecrawl, api_key: "fc-your-api-key" +``` + +Or pass it as an option to any function: + +```elixir +Firecrawl.scrape_and_extract_from_url( + [url: "https://example.com"], + api_key: "fc-your-api-key" +) +``` + +If no API key is found in config or options, a `RuntimeError` is raised with instructions. + +## Usage + +All params are passed as keyword lists with `snake_case` keys. Invalid keys, missing required params, and type errors are caught immediately by [NimbleOptions](https://hexdocs.pm/nimble_options). + +### Scraping a URL + +To scrape a single URL, use the `scrape_and_extract_from_url` function: + +```elixir +{:ok, response} = Firecrawl.scrape_and_extract_from_url( + url: "https://example.com", + formats: ["markdown"] +) +``` + +### Crawling a Website + +To crawl a website, use the `crawl_urls` function. You can specify options like the page limit and sitemap handling: + +```elixir +{:ok, response} = Firecrawl.crawl_urls( + url: "https://example.com", + limit: 100, + sitemap: :skip +) +``` + +### Checking Crawl Status + +To check the status of a crawl job, use the `get_crawl_status` function with the job ID: + +```elixir +{:ok, response} = Firecrawl.get_crawl_status("job-uuid") +``` + +### Map a Website + +Use `map_urls` to generate a list of URLs from a website: + +```elixir +{:ok, response} = Firecrawl.map_urls(url: "https://example.com") +``` + +### Search + +Search the web and scrape the results: + +```elixir +{:ok, response} = Firecrawl.search_and_scrape(query: "firecrawl web scraping") +``` + +### Extract Structured Data + +Extract structured data from one or more URLs using a prompt: + +```elixir +{:ok, response} = Firecrawl.extract_data( + urls: ["https://example.com"], + prompt: "Extract the main heading and description" +) +``` + +### Self-Hosted Instances + +You can point the SDK at a self-hosted Firecrawl instance: + +```elixir +{:ok, response} = Firecrawl.scrape_and_extract_from_url( + [url: "https://example.com"], + base_url: "https://your-instance.com/v2" +) +``` + +### Bang Variants + +Every function has a `!` variant that raises on error instead of returning `{:error, _}`: + +```elixir +response = Firecrawl.scrape_and_extract_from_url!(url: "https://example.com") +``` + +## Error Handling + +The SDK returns standard Elixir `{:ok, result}` / `{:error, reason}` tuples. Use the bang (`!`) variants when you want exceptions on failure. + +## Repository + +The Elixir SDK is open source and available on [GitHub](https://github.com/charifmews/firecrawl) and [Hex](https://hex.pm/packages/firecrawl). + +> Are you an AI agent that needs a Firecrawl API key? See [firecrawl.dev/agent-onboarding/SKILL.md](https://www.firecrawl.dev/agent-onboarding/SKILL.md) for automated onboarding instructions. diff --git a/sdks/overview.mdx b/sdks/overview.mdx index c849dfb7..8916f15d 100644 --- a/sdks/overview.mdx +++ b/sdks/overview.mdx @@ -23,8 +23,11 @@ Use an SDK to scrape, crawl, and extract structured data from websites without m -## Community SDKs (v1 only) +## Community SDKs + + Call the Firecrawl API from Elixir applications. + Call the Firecrawl API from Go applications.