# Create an on-call schedule

Create a new on-call schedule. Returns either the new schedule, or validation errors.

[endpoint]
base_url = "https://uptime.betterstack.com"
path = "/api/v2/on-calls"
method = "POST"

[[body_param]]
name = "name"
description = "The name of the schedule"
required = true
type = "string"

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

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

[/endpoint]

[responses]
[[response]]
status = 200
description = '''The schedule was created'''
body = '''{
  "id": "56",
  "type": "on_call_calendar",
  "attributes": {
    "name": "My New Calendar",
    "default_calendar": false,
    "team_name": "Backend Team"
  },
  "relationships": {
    "on_call_users": {
      "data": []
    }
  }
}'''

[[response]]
status = 422
description = '''Validation errors encountered while creating the schedule'''
body = '''{
  "errors": {
    "name": ["can't be blank"]
  }
}'''

[/responses]

#### Example cURL 

```shell
[label Example]
curl --request POST \
  --url https://uptime.betterstack.com/api/v2/on-calls \
  --header "Authorization: Bearer $TOKEN" \
  --header "Content-Type: application/json; charset=utf-8" \
  --data '{ "name": "My New Calendar" }'
```

[info]
#### Looking for details of a specific parameter?
Explore [the list of all on-call schedule API response parameters](https://betterstack.com/docs/uptime/api/on-call-calendar-api-response-params/)
[/info]
