A .NET library for interacting with the Firecrawl API.
Install the library via NuGet:
dotnet add package firecrawl-dotnetInstall optional library extensions for more functionality, depending on your use case.
Integrate firecrawl-dotnet and your DI container of choice. Install the extension library via NuGet:
dotnet add package firecrawl-dotnet-dependencyinjection- Obtain an API key from the Firecrawl Dashboard (requires a Firecrawl account).
- Pass the API key into a new instance of the
FirecrawlServiceclass or use a configuredHttpClientif advanced configuration (e.g., proxies) is required. - Use the methods available on
FirecrawlServiceto interact with the Firecrawl API.
The library can be initialized in three ways:
Pass in your API key directly:
var firecrawl = new FirecrawlService("YOUR_FIRECRAWL_API_KEY");Use an existing HttpClient, ensuring that BaseAddress and an Authorization header have been set:
var httpClient = new HttpClient
{
BaseAddress = new Uri("https://api.firecrawl.dev/v1/"),
Timeout = TimeSpan.FromSeconds(5)
};
httpClient.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", "YOUR_FIRECRAWL_API_KEY");
var firecrawl = new FirecrawlService(httpClient);If you've installed the appropriate extension library.
- Register
FirecrawlServicewith your dependency container:
services.AddFirecrawlHttpClient(options =>
{
options.BaseUrl = new Uri("https://api.firecrawl.dev/v1/");
options.ApiKey = "YOUR_FIRECRAWL_API_KEY";
});- Inject
IFirecrawlServicewhere needed:
public class MyClass
{
private readonly IFirecrawlService firecrawl;
public MyClass(IFirecrawlService firecrawl)
{
this.firecrawl = firecrawl;
}
}Refer to the Usage section above for a quick start, or consult the inline documentation while working in your IDE. For detailed information about the underlying API endpoints, parameters, and expected responses, refer to the official Firecrawl API documentation.
Contributions are welcome! To contribute, fork the repository, create a new branch, and submit a pull request with your changes. Please make sure all tests pass before submitting.
This project is licensed under the MIT license. See license.txt for full details.