---
title: "Create a custom role"
url: https://docs.corefinity.com/api/reference/organisation/create-custom-role
type: endpoint
last_updated: 2026-11-13
feature: team
related:
  - https://docs.corefinity.com/guides/organisation/people/users-and-invitations.md
  - https://docs.corefinity.com/mcp/tools/corestack_team_role_create.md
---
# Create a custom role

Makes a custom role for your company. It may give only permissions you hold yourself, which
`GET /permissions` lists. The role's `slug` is made from its name and a unique suffix.

```http
POST /api/roles/create
```

- Scope: `write`
- Rate limit: 60 a minute
- Try it in the console: off. It has not been cleared for the console. Copy the request and run it yourself when you are sure.

## Body

- `name` (string, required)
- `permissions` (array of strings, required): The slugs of the permissions the role gives, each one you hold yourself. The whole set, not a change to it.

## Request

### curl

```bash
curl -X POST https://manage.corefinity.com/api/roles/create \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Release managers",
    "permissions": [
      "viewUsers"
    ]
  }'
```

### PHP

```php
use Illuminate\Support\Facades\Http;

$response = Http::withToken(env('COREFINITY_TOKEN'))
    ->acceptJson()
    ->post('https://manage.corefinity.com/api/roles/create', [
        'name' => 'Release managers',
        'permissions' => [
            'viewUsers',
        ],
    ]);

$data = $response->json();
```

### Node

```javascript
const res = await fetch('https://manage.corefinity.com/api/roles/create', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    name: 'Release managers',
    permissions: [
      'viewUsers',
    ],
  }),
});

// An answer with no body (204) has nothing to parse.
const text = await res.text();
const data = text && JSON.parse(text);
```

### Python

```python
import os
import requests

res = requests.post(
    "https://manage.corefinity.com/api/roles/create",
    headers={
        "Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
        "Accept": "application/json",
    },
    json={
        "name": "Release managers",
        "permissions": [
            "viewUsers",
        ],
    },
)

data = res.json() if res.content else None
```

## Responses

### 200 The role that was made.

```json
{
  "data": {
    "id": 3107,
    "name": "Release managers",
    "permissions": [
      "viewUsers"
    ],
    "slug": "release-managers-0b9c7a52-3f7e-4c1d-9a55-2f6f1f0e8d11"
  },
  "message": "Role was created.",
  "status": "success"
}
```

### 401 No token, or a token that is not valid.

```json
{
  "message": "Unauthenticated."
}
```

### 403 The token lacks the `write` scope (`scope_required`), or you may not create roles (`forbidden`).

```json
{
  "code": "forbidden",
  "message": "You are not allowed to create roles.",
  "reason": "forbidden",
  "status": "error"
}
```

### 422 A field is missing or wrong (`invalid`). On `permissions`: a name that is not a permission, a permission you do not hold yourself, or one that only Corefinity's own roles may hold.

```json
{
  "code": "invalid",
  "errors": {
    "permissions": [
      "readEverything is not a permission."
    ]
  },
  "field": "permissions",
  "message": "readEverything is not a permission.",
  "reason": "invalid"
}
```

### 429 Too many requests (`rate_limited`). Wait for the number of seconds in `Retry-After`, which `retry_after_seconds` repeats.

```json
{
  "code": "rate_limited",
  "message": "Too many requests. Try again in 60 seconds.",
  "reason": "rate_limited",
  "retry_after_seconds": 60
}
```

## If it is refused

| Status | Reason | What to do |
|---|---|---|
| 401 |  | Send a valid token as `Authorization: Bearer <token>`. |
| 403 | `forbidden` | The person is not allowed to do this. |
| 403 | `scope_required` | Use a token with the scope named in `scope`. |
| 422 | `invalid` | Fix the field named in `field`; `errors` says why. |
| 429 | `rate_limited` | Wait for the seconds in `Retry-After`. |

## The same task elsewhere

- Guide: [Users and invitations](https://docs.corefinity.com/guides/organisation/people/users-and-invitations.md)
- MCP tool: [`corestack_team_role_create`](https://docs.corefinity.com/mcp/tools/corestack_team_role_create.md)
