> For the complete documentation index, see [llms.txt](https://docs.codemash.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.codemash.io/sdks-and-cli/membership/roles/create-role.md).

# Create Role

A **role** bundles one or more policies and is assigned to users to control what they can do — this is Norbix's role-based access control (RBAC). Roles are project-scoped and managed in the Membership module. This method creates the role; the response returns its id.

This method is on the **Hub** surface (`norbix.hub.membership`) — call it from admin tooling or IaC.

{% hint style="info" %}
These examples assume the SDK is installed and your credentials are set as environment variables — each client reads them automatically, so the constructors below take no arguments. See [Install a Norbix SDK](/sdks-and-cli/install.md).
{% endhint %}

{% tabs %}
{% tab title="JavaScript / TypeScript" %}

```ts
import { Norbix } from '@norbix.ai/ts';
const norbix = new Norbix();

const result = await norbix.hub.membership.createRole({
  roleName: 'content-editor',
  description: 'Can create and edit content, but not manage billing or members.',
  policies: ['pol_7Uhn615iG5KLwiIYGkxSIG', 'pol_1k4ufY10onE6beVi6Hp7I3'],
});
```

{% endtab %}

{% tab title=".NET" %}

```csharp
using Norbix.Sdk;
using Norbix.Sdk.Types.Hub;

using var client = new NorbixClient();

var result = await client.Membership.CreateRoleAsync(new CreateRole
{
    RoleName = "content-editor",
    Description = "Can create and edit content, but not manage billing or members.",
    Policies = new[] { "pol_7Uhn615iG5KLwiIYGkxSIG", "pol_1k4ufY10onE6beVi6Hp7I3" },
});
```

{% endtab %}

{% tab title="Python" %}

```python
from norbix_python import NorbixHub

norbix = NorbixHub()

result = norbix.membership.create_role(
    roleName="content-editor",
    description="Can create and edit content, but not manage billing or members.",
    policies=["pol_7Uhn615iG5KLwiIYGkxSIG", "pol_1k4ufY10onE6beVi6Hp7I3"],
)
```

{% endtab %}

{% tab title="Go" %}

```go
c, _ := norbix.New(norbix.Options{})
ctx := context.Background()

var result map[string]any
err := c.Hub.Membership.CreateRole(ctx, map[string]any{
	"roleName": "content-editor",
	"description": "Can create and edit content, but not manage billing or members.",
	"policies": []string{"pol_7Uhn615iG5KLwiIYGkxSIG", "pol_1k4ufY10onE6beVi6Hp7I3"},
}, &result)
```

{% endtab %}

{% tab title="Dart / Flutter" %}

```dart
import 'package:norbix/norbix_hub.dart';

final hub = NorbixHub();

final result = await hub.membership.createRole(body: {
  'roleName': 'content-editor',
  'description': 'Can create and edit content, but not manage billing or members.',
  'policies': ['pol_7Uhn615iG5KLwiIYGkxSIG', 'pol_1k4ufY10onE6beVi6Hp7I3'],
});
```

{% endtab %}

{% tab title="Swift" %}

```swift
import NorbixSwift

let client = Norbix()

let result = try await client.hub.membership.createRole([
    "roleName": "content-editor",
    "description": "Can create and edit content, but not manage billing or members.",
    "policies": ["pol_7Uhn615iG5KLwiIYGkxSIG", "pol_1k4ufY10onE6beVi6Hp7I3"],
])
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
import dev.norbix.sdk.hub.NorbixHub

val hub = NorbixHub()

val result = hub.membership.createRole(mapOf(
    "roleName" to "content-editor",
    "description" to "Can create and edit content, but not manage billing or members.",
    "policies" to listOf("pol_7Uhn615iG5KLwiIYGkxSIG", "pol_1k4ufY10onE6beVi6Hp7I3"),
))
```

{% endtab %}

{% tab title="CLI" %}

```sh
norbix raw '/{version}/membership/roles' -X POST --body '{"roleName":"content-editor","description":"Can create and edit content, but not manage billing or members.","policies":["pol_7Uhn615iG5KLwiIYGkxSIG","pol_1k4ufY10onE6beVi6Hp7I3"]}'
```

{% endtab %}
{% endtabs %}

## In the dashboard

Manage this visually in Norbix Cloud — see [Membership → Roles](/norbix-cloud/membership/roles.md).

## API reference

Full request and response for this endpoint: [Create Role](/api-reference/membership/roles/create-role.md).
