AtlasCms.Sdk 1.0.2

dotnet add package AtlasCms.Sdk --version 1.0.2
                    
NuGet\Install-Package AtlasCms.Sdk -Version 1.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AtlasCms.Sdk" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AtlasCms.Sdk" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="AtlasCms.Sdk" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AtlasCms.Sdk --version 1.0.2
                    
#r "nuget: AtlasCms.Sdk, 1.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AtlasCms.Sdk@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AtlasCms.Sdk&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=AtlasCms.Sdk&version=1.0.2
                    
Install as a Cake Tool

Atlas CMS .NET SDK

Simple .NET SDK for Atlas CMS with full async support and ASP.NET Core integration.

Compatibility

Core SDK (AtlasCms.Sdk)

  • .NET: 10.0, 9.0, 8.0, 7.0
  • C#: 11.0+

ASP.NET Core Extensions (AtlasCms.Sdk.AspnetCore)

  • .NET: 10.0, 9.0, 8.0, 7.0
  • C#: 11.0+

Features

  • REST modules for Contents, Media Library, Users, Roles, Models, and Components
  • GraphQL client helper
  • Centralized HTTP client with consistent error handling
  • Fluent query builders for query string DSL:
    • filter[{path}][{operator}]={value}
  • Request-level API key override
  • Fully typed APIs and test suite
  • ASP.NET Core DI integration

Install

dotnet add package AtlasCms.Sdk

ASP.NET Core extensions (optional):

dotnet add package AtlasCms.Sdk.AspnetCore

Quick Start

using AtlasCms.Sdk;
using AtlasCms.Sdk.QueryBuilder;

var client = AtlasCmsClient.Create(new AtlasClientConfig
{
    ProjectId = "my-project-id",
    ApiKey = "YOUR_BEARER_TOKEN"
});

var query = new ContentsQueryBuilder()
    .Page(1)
    .Size(20)
    .Status(QueryStatus.Published)
    .Locale("en-US")
    .Filter("createdAt", "gte", "2026-01-01T00:00:00.000Z")
    .Sort("createdAt", SortDirection.Desc)
    .Build();

var result = await client.Contents.ListAsync("pages", query);

The SDK uses https://api.atlascms.io as the default base URL. Derived endpoints:

Type URL
REST https://api.atlascms.io/{projectId}
GraphQL https://api.atlascms.io/{projectId}/graphql

API Overview

AtlasCmsClient.Create(config)

public class AtlasClientConfig
{
    public required string ProjectId { get; init; }
    public required string ApiKey { get; init; }
    /// <summary>Defaults to "https://api.atlascms.io".</summary>
    public string? BaseUrl { get; init; }
    /// <summary>Optional custom HttpClient for testing or advanced scenarios.</summary>
    public HttpClient? HttpClient { get; init; }
}

Modules

client.Contents
Method Description
ListAsync(type, query?, options?) List contents of a given type
GetByIdAsync(type, id, options?) Get a single content by ID
GetSingleAsync(type, query?, options?) Get a singleton content
CountAsync(type, query?, options?) Count contents
CreateAsync(type, payload, options?) Create a new content
UpdateAsync(type, id, payload, options?) Update an existing content
RemoveAsync(type, id, options?) Delete a content
ChangeStatusAsync(type, id, status, options?) Publish or unpublish a content
CreateTranslationAsync(type, id, locale?, options?) Create a translation copy
DuplicateAsync(type, id, locales?, options?) Duplicate a content
UpdateSeoAsync(type, id, payload, options?) Update SEO metadata
client.Media
Method Description
ListAsync(query?, options?) List media items
GetByIdAsync(id, options?) Get a media item by ID
UploadAsync(input, options?) Upload a file
SetTagsAsync(id, tags, options?) Set tags on a media item
RemoveAsync(id, options?) Delete a media item
client.Users
Method Description
ListAsync(query?, options?) List users
CountAsync(query?, options?) Count users
GetByIdAsync(id, options?) Get a user by ID
CreateAsync(payload, options?) Register a new user
UpdateAsync(id, payload, options?) Update a user
RemoveAsync(id, options?) Delete a user
ChangeStatusAsync(id, isActive, options?) Activate or deactivate a user
ChangePasswordAsync(id, password, options?) Change a user's password
client.Roles
Method Description
ListAsync(options?) List roles
CreateAsync(payload, options?) Create a role
UpdateAsync(id, payload, options?) Update a role
RemoveAsync(id, options?) Delete a role
GetPermissionsAsync(options?) Get all available permissions
client.Models
Method Description
ListAsync(query?, options?) List content models
GetByIdAsync(id, options?) Get a model by ID
CreateAsync(payload, options?) Create a model
UpdateAsync(payload, options?) Update a model
RemoveAsync(id, options?) Delete a model
PublishAsync(id, options?) Publish a model
UnpublishAsync(id, options?) Unpublish a model
client.Components
Method Description
ListAsync(query?, options?) List components
GetByIdAsync(id, options?) Get a component by ID
CreateAsync(payload, options?) Create a component
UpdateAsync(payload, options?) Update a component
RemoveAsync(id, options?) Delete a component
client.Graphql
Method Description
ExecuteAsync<TData>(request, options?) Execute a GraphQL operation
var response = await client.Graphql.ExecuteAsync<MyData>(
    new GraphqlRequest<Dictionary<string, object?>>
    {
        Query = "query GetPages { pages { id title } }"
    });

Query Builders

  • ContentsQueryBuilder
  • MediaQueryBuilder
  • UsersQueryBuilder

All builders support:

Method Description
Page(number) Set the page number
Size(number) Set the page size
Search(string) Full-text search
Filter(field, operator, value) Add a filter
Sort(field, direction) Set sort order
Build() Produce the query string

Additional methods:

  • ContentsQueryBuilder: .Status(QueryStatus.Published), .Locale("en-US"), .Resolve("media", "relations")
  • MediaQueryBuilder: .Folder("images"), .SearchSubdirectory(true)
  • UsersQueryBuilder: .Email("..."), .FirstName("..."), .IsActive(true), .Roles([...])

Per-request API key override

await client.Media.ListAsync(options: new AtlasRequestOptions
{
    ApiKey = "ANOTHER_BEARER_TOKEN"
});

Error handling

using AtlasCms.Sdk.Http;

try
{
    var content = await client.Contents.GetByIdAsync("pages", "id");
}
catch (AtlasHttpException ex) when (ex.StatusCode == System.Net.HttpStatusCode.NotFound)
{
    // Content not found — ex.StatusCode, ex.Message, ex.RequestId
}
catch (AtlasTimeoutException)
{
    // Request timed out
}
catch (AtlasNetworkException)
{
    // Network error
}

Custom base URL

Useful for local development or self-hosted instances:

var client = AtlasCmsClient.Create(new AtlasClientConfig
{
    ProjectId = "my-project-id",
    ApiKey = "YOUR_BEARER_TOKEN",
    BaseUrl = "https://my-custom-instance.example.com"
});

Custom HttpClient

Useful for testing or advanced scenarios (e.g. delegating handlers, mocks):

var client = AtlasCmsClient.Create(new AtlasClientConfig
{
    ProjectId = "my-project-id",
    ApiKey = "YOUR_BEARER_TOKEN",
    HttpClient = myCustomHttpClient
});

ASP.NET Core Integration

From configuration

Register in Program.cs:

builder.Services.AddAtlasCms(builder.Configuration);

In appsettings.json:

{
  "AtlasCms": {
    "ProjectId": "my-project-id",
    "ApiKey": "YOUR_BEARER_TOKEN",
    "BaseUrl": "https://api.atlascms.io"
  }
}

BaseUrl is optional and defaults to https://api.atlascms.io.

Using the fluent builder

builder.Services.AddAtlasCms(options => options
    .WithProjectId("my-project-id")
    .WithApiKey("YOUR_BEARER_TOKEN")
);

Direct configuration

builder.Services.AddAtlasCms(new AtlasClientConfig
{
    ProjectId = "my-project-id",
    ApiKey = "YOUR_BEARER_TOKEN"
});

Injection

public class PageController(AtlasCmsClient client)
{
    public async Task<IActionResult> GetPage(string id)
    {
        var page = await client.Contents.GetByIdAsync("pages", id);
        return Ok(page);
    }
}

Working with Dynamic Attributes

Content attributes are represented as JsonObject to support dynamic schemas:

// Read attributes
var title = content.Attributes?["title"]?.GetValue<string>();
var count = content.Attributes?["count"]?.GetValue<int>();

// Create with attributes
var created = await client.Contents.CreateAsync("pages", new CreateContentInput
{
    Locale = "en",
    Attributes = new JsonObject
    {
        ["title"] = "Page Title",
        ["featured"] = true
    }
});

Development

dotnet build
dotnet test
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on AtlasCms.Sdk:

Package Downloads
AtlasCms.Sdk.AspnetCore

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 28 3/20/2026
1.0.1 30 3/20/2026
1.0.0 40 3/19/2026