# Create a source group

Returns either a newly created source group, or validation errors.

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

[[body_param]]
name = "team_name"
description = "Required if using [global API token](https://betterstack.com/docs/logs/api/getting-started/#get-a-global-api-token) to specify the team which should own the resource"
required = false
type = "string"

[[body_param]]
name = "name"
description = "The name of the group that you can see in the dashboard."
required = false
type = "string"

[[body_param]]
name = "sort_index"
description = "Set sort_index to specify how to sort your source groups."
required = false
type = "integer"

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

[[header]]
name = "Content_Type"
description = "application/json"
required = false
type = "string"
[/endpoint]

[responses]
[[response]]
status = 201
description = '''Returns newly created source group'''
body = '''{
  "data": {
    "id": "95251342",
    "type": "source_group",
    "attributes": {
      "name": "Backend sources",
      "sort_index": null,
      "created_at": "2025-06-30T17:43:12.192Z",
      "updated_at": "2020-06-30T17:43:12.192Z",
      "team_name": "Test team"
    }
  }
}'''

[/responses]

#### Example cURL 

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