Now available for .NET 8.0+
Attio SDK for .NET
A comprehensive .NET SDK to interact with Attio via OAuth2 authentication and API v2. Build powerful integrations with objects, records, and advanced querying capabilities.
Get Started
Contributions will be available soon!
Quick Install
dotnet add package AttioSdkEverything you need to integrate with Attio
Built with modern .NET practices and designed for scalability, security, and developer experience.
OAuth2 Authentication
Secure authentication with authorization code flow and automatic token refresh management.
Object Management
Create, read, and manage custom objects in your Attio workspace with full CRUD operations.
Advanced Querying
Powerful query builder for complex filtering, sorting, and field selection with JSON support.
Developer Friendly
Clean, intuitive API design with comprehensive error handling and response management.
High Performance
Efficient HttpClient abstraction with built-in retry logic and connection pooling.
Type Safe
Full TypeScript-like experience with strongly typed models and compile-time safety.
Installation Methods
Choose your preferred method to install the Attio SDK for .NET
Package Manager
Via NuGet Package Manager
dotnet add package AttioSdkPackage Manager Console
Via Visual Studio Package Manager
Install-Package AttioSdkRequirements
- .NET 8.0 or later
- System.Text.Json (included in .NET 8.0+)
- HttpClient support
OAuth2 Authorization Flow
using AttioSdk.Auth;
var oauth = new OAuthClient(
clientId: "YOUR_CLIENT_ID",
clientSecret: "YOUR_CLIENT_SECRET",
redirectUri: "http://localhost:5000/oauth/callback",
scopes: new[] {
"object_configuration:read-write",
"records:read-write"
}
);
// Make sure that your redirectUri is same as in your app
// Start OAuth authorization
var token = await oauth.AuthorizeAsync();
// Apply token to HttpClient
var client = new AttioClient(token.AccessToken);Usage Examples
Learn how to use the SDK with practical examples for common scenarios
Creating Objects
Create custom objects in your Attio workspace
using AttioSdk.Models;
// Create object using parameters
var response = await client.Objects.CreateObjectAsync(
apiSlug: "contacts",
singular: "Contact",
plural: "Contacts"
);
// Create object using request object
var request = new CreateObjectRequest
{
ApiSlug = "companies",
SingularNoun = "Company",
PluralNoun = "Companies"
};
var response2 = await client.Objects.CreateObjectAsync(request);
if (response.IsSuccess)
{
Console.WriteLine("Object created successfully!");
}
else
{
Console.WriteLine($"Error: {response.ErrorMessage}");
}Error Handling
Robust error handling with detailed response information
AttioResponse Pattern
All SDK methods return an AttioResponse object with success status and error details
// Always check IsSuccess before using Data
var response = await client.Records.GetRecordsAsync("contacts");
if (!response.IsSuccess)
{
Console.WriteLine($"Error ({response.StatusCode}): {response.ErrorMessage}");
// Handle error appropriately
return;
}
// Safe to use response.Data
var records = response.Data;Best Practices
- • Always check IsSuccess before using Data
- • Log error messages for debugging
- • Handle different status codes appropriately
- • Implement retry logic for transient errors
Response Properties
- • IsSuccess - Boolean success indicator
- • Data - Response data (when successful)
- • ErrorMessage - Human-readable error
- • StatusCode - HTTP status code