ScrapeGraphAI.Client
1.0.1-preview.7
See the version list below for details.
dotnet add package ScrapeGraphAI.Client --version 1.0.1-preview.7
NuGet\Install-Package ScrapeGraphAI.Client -Version 1.0.1-preview.7
<PackageReference Include="ScrapeGraphAI.Client" Version="1.0.1-preview.7" />
<PackageVersion Include="ScrapeGraphAI.Client" Version="1.0.1-preview.7" />
<PackageReference Include="ScrapeGraphAI.Client" />
paket add ScrapeGraphAI.Client --version 1.0.1-preview.7
#r "nuget: ScrapeGraphAI.Client, 1.0.1-preview.7"
#:package ScrapeGraphAI.Client@1.0.1-preview.7
#addin nuget:?package=ScrapeGraphAI.Client&version=1.0.1-preview.7&prerelease
#tool nuget:?package=ScrapeGraphAI.Client&version=1.0.1-preview.7&prerelease
ScrapeGraphAI .NET SDK
Typed .NET SDK for the ScrapeGraphAI v2 API.
The SDK is built around IHttpClientFactory, dependency injection, typed request and response models, optional resilience policies, structured diagnostics, and optional Microsoft Agent Framework tool integration.
Packages
dotnet add package ScrapeGraphAI.Client
dotnet add package ScrapeGraphAI.AgentFramework
Preview packages are available with:
dotnet add package ScrapeGraphAI.Client --prerelease
dotnet add package ScrapeGraphAI.AgentFramework --prerelease
Requirements
- .NET 10
- A ScrapeGraphAI API key
Quick Start
Register the typed client:
using ScrapeGraphAI;
builder.Services.AddScrapeGraphAI(options =>
{
options.ApiKey = builder.Configuration["ScrapeGraphAI:ApiKey"];
});
Call the API:
var client = serviceProvider.GetRequiredService<IScrapeGraphClient>();
var result = await client.ScrapeAsync(new ScrapeRequest
{
Url = "https://example.com",
Formats = [FormatConfig.Markdown(ScrapeContentMode.Reader)]
});
if (result.IsSuccess)
{
Console.WriteLine(result.Data?.Results["markdown"].Data);
}
else
{
Console.Error.WriteLine(result.Error?.Message);
}
Configuration
AddScrapeGraphAI registers IScrapeGraphClient as a typed HttpClient, configures the ScrapeGraphAI base URL, sets the SGAI-APIKEY header, and adds a SDK user agent.
The default base URL is:
https://v2-api.scrapegraphai.com/api/
You can bind configuration through the normal .NET options pipeline:
builder.Services.Configure<ScrapeGraphOptions>(
builder.Configuration.GetSection("ScrapeGraphAI"));
builder.Services.AddScrapeGraphAI();
Example environment variable for typical .NET configuration providers:
$env:ScrapeGraphAI__ApiKey = "<your-api-key>"
ScrapeGraphOptions contains:
ApiKeyBaseUrl
The SDK validates options when the typed client is resolved. ApiKey must be non-empty, and BaseUrl must be an absolute HTTP or HTTPS URI.
HttpClient Customization
AddScrapeGraphAI returns IHttpClientBuilder, so you can use normal HttpClient customization:
builder.Services
.AddScrapeGraphAI()
.ConfigureHttpClient(client =>
{
client.Timeout = TimeSpan.FromSeconds(90);
});
Resilience
The SDK includes an opt-in retry and timeout pipeline built on Microsoft.Extensions.Http.Resilience:
builder.Services
.AddScrapeGraphAI()
.AddScrapeGraphAIStandardResilience();
You can configure resilience separately from API identity settings:
builder.Services.Configure<ScrapeGraphResilienceOptions>(
builder.Configuration.GetSection("ScrapeGraphAI:Resilience"));
ScrapeGraphResilienceOptions contains:
TotalRequestTimeoutAttemptTimeoutMaxRetryAttemptsRetryBackoff
Resilience options are validated when the pipeline is used. Timeouts and backoff must be positive, AttemptTimeout cannot exceed TotalRequestTimeout, and MaxRetryAttempts must be greater than zero.
API Surface
The core client exposes:
HealthAsyncCreditsAsyncScrapeAsyncExtractAsyncSearchAsyncCrawl.StartAsync,Crawl.GetAsync,Crawl.PagesAsync,Crawl.StopAsync,Crawl.ResumeAsync,Crawl.DeleteAsyncMonitor.CreateAsync,Monitor.ListAsync,Monitor.GetAsync,Monitor.UpdateAsync,Monitor.PauseAsync,Monitor.ResumeAsync,Monitor.ActivityAsync,Monitor.DeleteAsyncHistory.ListAsync,History.GetAsync
All API calls return ApiResult<T>, so callers can handle successful responses and API errors without relying on exceptions for normal error payloads.
Agent Framework Tools
Agent integration lives in ScrapeGraphAI.AgentFramework, keeping the core SDK free of agent dependencies.
using ScrapeGraphAI.AgentFramework;
builder.Services.AddScrapeGraphAI();
builder.Services.AddScrapeGraphAgentTools(options =>
{
options.IncludedTools =
[
ScrapeGraphAgentToolNames.ScrapePage,
ScrapeGraphAgentToolNames.ExtractFromPage,
ScrapeGraphAgentToolNames.GetCredits,
ScrapeGraphAgentToolNames.HealthCheck
];
options.ApprovalRequiredTools =
[
ScrapeGraphAgentToolNames.ScrapePage,
ScrapeGraphAgentToolNames.ExtractFromPage
];
});
var tools = serviceProvider
.GetRequiredService<ScrapeGraphAgentTools>()
.AsAITools();
Attach the returned tools to a Microsoft Agent Framework agent, or choose a smaller tool set per agent:
var researchTools = serviceProvider
.GetRequiredService<ScrapeGraphAgentTools>()
.AsAITools(
ScrapeGraphAgentToolNames.ScrapePage,
ScrapeGraphAgentToolNames.SearchWeb,
ScrapeGraphAgentToolNames.HealthCheck);
Diagnostics
The SDK emits structured logs through ILogger and client spans through an ActivitySource named ScrapeGraphAI.
Diagnostics are designed to be safe by default. They include endpoint names, HTTP methods, status codes, and elapsed time. They do not log API keys, prompts, schemas, request bodies, response bodies, cookies, headers, or scraped content.
Samples
- Core SDK sample: dependency injection, configuration, resilience, scrape, extract, search, crawl, monitor, and history APIs.
- Agent Framework sample: registers ScrapeGraphAI tools and runs them from a Microsoft Agent Framework agent through an OpenAI-compatible chat endpoint.
Releases
Stable packages are published to NuGet from GitHub releases. Preview packages are published from the main branch and can be installed with --prerelease.
Versions follow semantic versioning. Patch releases include fixes, minor releases add features, and major releases may include breaking changes.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.Configuration (>= 10.0.8)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.8)
- Microsoft.Extensions.DependencyInjection (>= 10.0.8)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.8)
- Microsoft.Extensions.Http (>= 10.0.0)
- Microsoft.Extensions.Http.Resilience (>= 10.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.8)
- Microsoft.Extensions.Options (>= 10.0.3)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on ScrapeGraphAI.Client:
| Package | Downloads |
|---|---|
|
ScrapeGraphAI.AgentFramework
Microsoft Agent Framework tools for the ScrapeGraphAI .NET SDK. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.1-preview.8 | 71 | 7/9/2026 |
| 1.0.1-preview.7 | 72 | 7/9/2026 |
| 1.0.1-preview.6 | 66 | 7/9/2026 |
| 1.0.1-preview.5 | 61 | 7/6/2026 |
| 1.0.0 | 127 | 6/6/2026 |
| 1.0.0-preview.3 | 64 | 6/6/2026 |