Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@
{
"group": "Community",
"pages": [
"sdks/elixir",
"sdks/go",
"sdks/rust"
]
Expand Down Expand Up @@ -456,6 +457,7 @@
{
"group": "Community",
"pages": [
"sdks/elixir",
"sdks/go",
"sdks/rust"
]
Expand Down Expand Up @@ -751,6 +753,7 @@
{
"group": "Comunidad",
"pages": [
"es/sdks/elixir",
"es/sdks/go",
"es/sdks/rust"
]
Expand Down Expand Up @@ -983,6 +986,7 @@
{
"group": "Comunidad",
"pages": [
"es/sdks/elixir",
"es/sdks/go",
"es/sdks/rust"
]
Expand Down Expand Up @@ -1278,6 +1282,7 @@
{
"group": "Communauté",
"pages": [
"fr/sdks/elixir",
"fr/sdks/go",
"fr/sdks/rust"
]
Expand Down Expand Up @@ -1510,6 +1515,7 @@
{
"group": "Communauté",
"pages": [
"fr/sdks/elixir",
"fr/sdks/go",
"fr/sdks/rust"
]
Expand Down Expand Up @@ -1805,6 +1811,7 @@
{
"group": "コミュニティ",
"pages": [
"ja/sdks/elixir",
"ja/sdks/go",
"ja/sdks/rust"
]
Expand Down Expand Up @@ -2037,6 +2044,7 @@
{
"group": "コミュニティ",
"pages": [
"ja/sdks/elixir",
"ja/sdks/go",
"ja/sdks/rust"
]
Expand Down Expand Up @@ -2332,6 +2340,7 @@
{
"group": "Comunidade",
"pages": [
"pt-BR/sdks/elixir",
"pt-BR/sdks/go",
"pt-BR/sdks/rust"
]
Expand Down Expand Up @@ -2564,6 +2573,7 @@
{
"group": "Comunidade",
"pages": [
"pt-BR/sdks/elixir",
"pt-BR/sdks/go",
"pt-BR/sdks/rust"
]
Expand Down Expand Up @@ -2859,6 +2869,7 @@
{
"group": "社区",
"pages": [
"zh/sdks/elixir",
"zh/sdks/go",
"zh/sdks/rust"
]
Expand Down Expand Up @@ -3091,6 +3102,7 @@
{
"group": "社区",
"pages": [
"zh/sdks/elixir",
"zh/sdks/go",
"zh/sdks/rust"
]
Expand Down
129 changes: 129 additions & 0 deletions sdks/elixir.mdx
Original file line number Diff line number Diff line change
@@ -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.
5 changes: 4 additions & 1 deletion sdks/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ Use an SDK to scrape, crawl, and extract structured data from websites without m
</Card>
</CardGroup>

## Community SDKs (v1 only)
## Community SDKs
<CardGroup cols={2}>
<Card title="Elixir SDK" icon="droplet" href="elixir">
Call the Firecrawl API from Elixir applications.
</Card>
<Card title="Go SDK" icon="golang" href="go">
Call the Firecrawl API from Go applications.
</Card>
Expand Down