# Create a group

Creates a new application group.

[endpoint]
base_url = "https://errors.betterstack.com"
path = "/api/v1/application-groups"
method = "POST"

[[body_param]]
name = "name"
description = "Application group name. Must be unique within your team."
required = true
type = "string"

[[body_param]]
name = "platform"
description = "Platform type for the application group. Automatically set to `errors`."
required = false
type = "string"

[[header]]
name = "Authorization"
description = "Bearer `$TOKEN`"
required = true
type = "string"

[[header]]
name = "Content-Type"
description = "application/json"
required = true
type = "string"
[/endpoint]

[responses]
[[response]]
status = 201
description = '''Returns the newly created application group.'''
body = '''{
  "data": {
    "id": "5678",
    "type": "application_group",
    "attributes": {
      "name": "new-production-group",
      "created_at": "2025-01-15T10:25:00.000Z",
      "updated_at": "2025-01-15T10:25:00.000Z",
      "sort_index": null,
      "team_name": "example-team"
    }
  }
}'''

[[response]]
status = 401
description = '''Unauthorized'''
body = '''{
  "errors": "Invalid authentication"
}'''

[[response]]
status = 400
description = '''Bad Request - Missing Required Attributes'''
body = '''{
  "errors": "Sorry, you are missing some required attributes",
  "required_attributes": ["name"]
}'''

[[response]]
status = 422
description = '''Unprocessable Entity - Validation Errors'''
body = '''{
  "errors": "Validation errors",
  "invalid_attributes": {
    "name": ["can't be blank"]
  }
}'''
[/responses]

#### Example cURL

```shell
[label Example]
curl --request POST \
  --url https://errors.betterstack.com/api/v1/application-groups \
  --header "Authorization: Bearer $TOKEN" \
  --header 'Content-Type: application/json' \
  --data '{
    "name": "new-production-group"
  }'
```
