.NET library for the DeepXL API: fraud detection, document parsing, and ID verification.
Requirements
Installation
From source
cd sdks/dotnet/DeepXL
dotnet pack
Reference the built package or add a project reference to DeepXL/DeepXL.csproj.
NuGet (when published)
<PackageReference Include="DeepXL" Version="1.0.0" />
Example
Create an API key in the DeepXL Dashboard (Settings → API Keys).
Treat your API key like any environment secret. Do not commit to a public repository or store in plain text.
using DeepXL;
using System.Text.Json;
var apiKey = Environment.GetEnvironmentVariable("DEEPXL_API_KEY")
?? throw new InvalidOperationException("Set DEEPXL_API_KEY environment variable.");
var client = new DeepXLClient(apiKey);
var usage = await client.CheckUsageAsync();
using var detection = await client.DetectFileAsync("document", "./file.pdf");
using var parsed = await client.ParseFileAsync("light", "./id.pdf");
using var verification = await client.VerifyFilesAsync("./id.jpg", "./selfie.jpg");
Console.WriteLine(detection.RootElement.GetProperty("likelihood").GetDouble());
Console.WriteLine(parsed.RootElement.GetProperty("documentType").GetString());
Console.WriteLine(verification.RootElement.GetProperty("verified").GetBoolean());
For long-running requests (e.g. large files), use a custom HttpClient with a longer timeout:
var apiKey = Environment.GetEnvironmentVariable("DEEPXL_API_KEY")
?? throw new InvalidOperationException("Set DEEPXL_API_KEY environment variable.");
var http = new HttpClient { BaseAddress = new Uri("https://api.deepxl.ai/v1/"), Timeout = TimeSpan.FromSeconds(120) };
http.DefaultRequestHeaders.Add("x-api-key", apiKey);
var client = new DeepXLClient(http);
Client methods
Account
- CheckUsageAsync() – GET /v1/account. Returns
UsageResponse (usage and limits per media type). Optional fields: parsingUsageLimit, parsingUsage.
Models
- GetDetectionModelsAsync() – GET /v1/detection-models. Returns
JsonDocument.
- GetParsingModelsAsync() – GET /v1/parsing-models. Returns
JsonDocument.
Fraud detection
- DetectAsync(modelName, fileName, fileData [, tags]) / DetectFileAsync(modelName, filePath [, tags]) – POST /v1/detection. Models:
document, object. Returns JsonDocument.
- GetDetectionAsync(detectionId) – GET /v1/detection/. Returns
JsonDocument.
- ListDetectionsAsync([param]) – GET /v1/detection. Params:
ListParams with limit, offset, sortBy, direction, tagFilter. Returns JsonDocument with totalCount, count, data.
Document parsing
- ParseAsync(modelName, fileName, fileData [, tags]) / ParseFileAsync(modelName, filePath [, tags]) – POST /v1/parse. Models:
light, performance. Returns JsonDocument.
- GetParseAsync(parseId) – GET /v1/parse/. Returns
JsonDocument.
- ListParsesAsync([param]) – GET /v1/parse. Returns
JsonDocument with totalCount, count, data.
ID verification
- VerifyAsync(idFileName, idFileData, selfieFileName, selfieFileData [, tags]) / VerifyFilesAsync(idFilePath, selfieFilePath [, tags]) – POST /v1/verification. Returns
JsonDocument.
- GetVerificationAsync(verificationId) – GET /v1/verification/. Returns
JsonDocument.
- ListVerificationsAsync([param]) – GET /v1/verification. Returns
JsonDocument with totalCount, count, data.
File retrieval
- GetFileAsync(fileName) – GET /v1/files/. Returns
byte[]. Use the file name from the files array in any analysis response.
Types
- UsageResponse –
ImageUsageLimit, ImageUsage, VideoUsageLimit, VideoUsage, AudioUsageLimit, AudioUsage, DocumentUsageLimit, DocumentUsage, and optionally ParsingUsageLimit, ParsingUsage.
- ListParams –
Limit, Offset, SortBy, Direction, TagFilter.
Errors
On API or network failure the client throws DeepXLException with an optional StatusCode. Parse error responses from the API when present.