# Assign a group to a application (/docs/apis/management/clients/AssignGroupToApplication)

`POST /applications/{client_id}/groups/{group_id}`

Associates a group with the application and enforces group-based access control — only members of this group are permitted to access the application. Access to this endpoint requires an active ScaleX subscription.

Base URL: `https://{tenant}.{region}.monocloud.com/api`, where `{tenant}`, `{region}` (one of us, eu, in) come from your tenant. Authentication: send your Management API key in the `X-API-KEY` header.

## Parameters

- `client_id` (path) (string, required) The unique identifier of the application.
- `group_id` (path) (string, required, uuid) The unique identifier of the group.

## Response body

`201`. The group was assigned to the application successfully

## Errors

- `401` Unauthorized
- `402` Payment Required
  - `type` (string, required) A URI reference that identifies the error type. When accessed, it may provide human-readable documentation.
  - `title` (string, required) A short, human-readable summary of the error.
  - `status` (integer, required, int32) The HTTP status code associated with this error response.
  - `trace_id` (string, required) A unique identifier for the request, used for tracing and diagnostics.
  - `detail` (string) A human-readable explanation specific to this occurrence of the error.
  - `instance` (string) A URI reference that identifies the specific occurrence of the error.
- `403` Forbidden
- `404` Not Found
  Same body as `402`.
- `409` Conflict
  Same body as `402`.
- `422` Unprocessable Entity
  - `type` (string, required) A URI reference that identifies the error type. When accessed, it may provide human-readable documentation.
  - `title` (string, required) A short, human-readable summary of the error.
  - `status` (integer, required, int32) The HTTP status code associated with this error response.
  - `trace_id` (string, required) A unique identifier for the request, used for tracing and diagnostics.
  - `detail` (string) A human-readable explanation specific to this occurrence of the error.
  - `instance` (string) A URI reference that identifies the specific occurrence of the error.
  - `errors` (Record<string, string[]>, required) A key-value map of validation errors, where each key represents a request field and the value contains one or more messages describing why the request could not be processed.

## Example (MonoCloud .NET SDK)

```csharp
using MonoCloud.Management;
using MonoCloud.Management.Core.Base;

var apiClient = new MonoCloudManagementClient(new MonoCloudConfig("<your-domain>", "[[API-Key]]"));


var clientId = "eCOGRJYpnNwwAAuCeReEW";

var groupId = Guid.Parse("70b712ac-d96d-476b-b39b-249ad11de1a2");


var result = await apiClient.Clients.AssignGroupToApplicationAsync(clientId, groupId);
```

## Example (MonoCloud Javascript SDK)

```javascript
import { MonoCloudManagementClient } from '@monocloud/management';

const apiClient = MonoCloudManagementClient.init({ domain: '<your-domain>', apiKey: '[[API-Key]]' });

const clientId = 'eCOGRJYpnNwwAAuCeReEW';

const groupId = '70b712ac-d96d-476b-b39b-249ad11de1a2';

const result = apiClient.clients.assignGroupToApplication(clientId, groupId);
```