diff --git a/NETCore.Keycloak.Client/HttpClients/Abstraction/IKcOrganizations.cs b/NETCore.Keycloak.Client/HttpClients/Abstraction/IKcOrganizations.cs
new file mode 100644
index 0000000..99c0a23
--- /dev/null
+++ b/NETCore.Keycloak.Client/HttpClients/Abstraction/IKcOrganizations.cs
@@ -0,0 +1,128 @@
+using NETCore.Keycloak.Client.Exceptions;
+using NETCore.Keycloak.Client.Models;
+using NETCore.Keycloak.Client.Models.Organizations;
+
+namespace NETCore.Keycloak.Client.HttpClients.Abstraction;
+
+///
+/// Keycloak organizations REST client.
+///
+///
+public interface IKcOrganizations
+{
+ ///
+ /// Creates a new organization in a specified Keycloak realm.
+ ///
+ /// POST /{realm}/organizations
+ ///
+ /// The Keycloak realm where the organization will be created.
+ /// The access token used for authentication.
+ /// The organization representation to create.
+ /// Optional cancellation token.
+ ///
+ /// A indicating the result of the operation.
+ ///
+ /// Thrown if any required parameter is null, empty, or invalid.
+ Task> CreateAsync(
+ string realm,
+ string accessToken,
+ KcOrganization organization,
+ CancellationToken cancellationToken = default);
+
+ ///
+ /// Updates an existing organization in a specified Keycloak realm.
+ ///
+ /// PUT /{realm}/organizations/{organizationId}
+ ///
+ /// The Keycloak realm where the organization exists.
+ /// The access token used for authentication.
+ /// The ID of the organization to update.
+ /// The updated organization representation.
+ /// Optional cancellation token.
+ ///
+ /// A indicating the result of the operation.
+ ///
+ /// Thrown if any required parameter is null, empty, or invalid.
+ Task> UpdateAsync(
+ string realm,
+ string accessToken,
+ string organizationId,
+ KcOrganization organization,
+ CancellationToken cancellationToken = default);
+
+ ///
+ /// Deletes an organization from a specified Keycloak realm.
+ ///
+ /// DELETE /{realm}/organizations/{organizationId}
+ ///
+ /// The Keycloak realm where the organization exists.
+ /// The access token used for authentication.
+ /// The ID of the organization to delete.
+ /// Optional cancellation token.
+ ///
+ /// A indicating the result of the operation.
+ ///
+ /// Thrown if any required parameter is null, empty, or invalid.
+ Task> DeleteAsync(
+ string realm,
+ string accessToken,
+ string organizationId,
+ CancellationToken cancellationToken = default);
+
+ ///
+ /// Retrieves a specific organization by its ID from a specified Keycloak realm.
+ ///
+ /// GET /{realm}/organizations/{organizationId}
+ ///
+ /// The Keycloak realm to query.
+ /// The access token used for authentication.
+ /// The ID of the organization to retrieve.
+ /// Optional cancellation token.
+ ///
+ /// A containing the details.
+ ///
+ /// Thrown if any required parameter is null, empty, or invalid.
+ Task> GetAsync(
+ string realm,
+ string accessToken,
+ string organizationId,
+ CancellationToken cancellationToken = default);
+
+ ///
+ /// Retrieves a list of organizations from a specified Keycloak realm, optionally filtered by criteria.
+ ///
+ /// GET /{realm}/organizations
+ ///
+ /// The Keycloak realm from which organizations will be listed.
+ /// The access token used for authentication.
+ /// Optional filter criteria.
+ /// Optional cancellation token.
+ ///
+ /// A containing an enumerable of objects.
+ ///
+ /// Thrown if any required parameter is null, empty, or invalid.
+ Task>> ListAsync(
+ string realm,
+ string accessToken,
+ KcOrganizationFilter filter = null,
+ CancellationToken cancellationToken = default);
+
+ ///
+ /// Retrieves the count of organizations in a specified Keycloak realm, optionally filtered.
+ ///
+ /// GET /{realm}/organizations/count
+ ///
+ /// The Keycloak realm to query.
+ /// The access token used for authentication.
+ /// Optional filter criteria.
+ /// Optional cancellation token.
+ ///
+ /// A with the count of organizations.
+ ///
+ /// Thrown if any required parameter is null, empty, or invalid.
+ Task> CountAsync(
+ string realm,
+ string accessToken,
+ KcOrganizationFilter filter = null,
+ CancellationToken cancellationToken = default);
+}
diff --git a/NETCore.Keycloak.Client/HttpClients/Abstraction/IKeycloakClient.cs b/NETCore.Keycloak.Client/HttpClients/Abstraction/IKeycloakClient.cs
index 70409ea..d5edde5 100644
--- a/NETCore.Keycloak.Client/HttpClients/Abstraction/IKeycloakClient.cs
+++ b/NETCore.Keycloak.Client/HttpClients/Abstraction/IKeycloakClient.cs
@@ -76,4 +76,9 @@ public interface IKeycloakClient
/// See for detailed operations.
///
public IKcScopeMappings ScopeMappings { get; }
+
+ ///
+ /// Gets the organizations REST client for managing organizations.
+ ///
+ public IKcOrganizations Organizations { get; }
}
diff --git a/NETCore.Keycloak.Client/HttpClients/Implementation/KcOrganizations.cs b/NETCore.Keycloak.Client/HttpClients/Implementation/KcOrganizations.cs
new file mode 100644
index 0000000..3bc7098
--- /dev/null
+++ b/NETCore.Keycloak.Client/HttpClients/Implementation/KcOrganizations.cs
@@ -0,0 +1,141 @@
+using Microsoft.Extensions.Logging;
+using NETCore.Keycloak.Client.HttpClients.Abstraction;
+using NETCore.Keycloak.Client.Models;
+using NETCore.Keycloak.Client.Models.Organizations;
+
+namespace NETCore.Keycloak.Client.HttpClients.Implementation;
+
+///
+internal sealed class KcOrganizations(string baseUrl,
+ ILogger logger) : KcHttpClientBase(logger, baseUrl), IKcOrganizations
+{
+ // Primary constructor on the class declaration is used; no explicit ctor body required.
+
+ ///
+ public Task> CreateAsync(
+ string realm,
+ string accessToken,
+ KcOrganization organization,
+ CancellationToken cancellationToken = default)
+ {
+ ValidateAccess(realm, accessToken);
+ ValidateNotNull(nameof(organization), organization);
+
+ var url = $"{BaseUrl}/{realm}/organizations";
+ return ProcessRequestAsync