# Create an on-call group (admin or owner)

POST /api/agent/teams/{id}/oncall. Required scopes: oncall:write.

HTML: https://notify.belweave.ai/docs/api/postTeamsIdOncall

Required scopes: `oncall:write`

```http
POST /api/agent/teams/{id}/oncall
Authorization: Bearer ntf_your_token
```

## Operation schema

```json
{
  "summary": "Create an on-call group (admin or owner)",
  "operationId": "postTeamsIdOncall",
  "security": [
    {
      "bearer": [
        "oncall:write"
      ]
    }
  ],
  "x-notify-scopes": [
    "oncall:write"
  ],
  "parameters": [
    {
      "name": "id",
      "in": "path",
      "schema": {
        "type": "string"
      },
      "required": true
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 60
            },
            "rotation": {
              "type": "object",
              "properties": {
                "memberIds": {
                  "minItems": 1,
                  "maxItems": 100,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  }
                },
                "period": {
                  "type": "string",
                  "enum": [
                    "daily",
                    "weekly"
                  ]
                },
                "handoffAt": {
                  "type": "string",
                  "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
                },
                "timezone": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                },
                "startsAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                }
              },
              "required": [
                "memberIds",
                "period",
                "handoffAt",
                "timezone"
              ],
              "additionalProperties": false
            },
            "escalation": {
              "default": [
                {
                  "afterMinutes": 5,
                  "target": "next"
                },
                {
                  "afterMinutes": 10,
                  "target": "group"
                }
              ],
              "maxItems": 5,
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "afterMinutes": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1440
                  },
                  "target": {
                    "type": "string",
                    "enum": [
                      "next",
                      "group"
                    ]
                  }
                },
                "required": [
                  "afterMinutes",
                  "target"
                ],
                "additionalProperties": false
              }
            }
          },
          "required": [
            "name",
            "rotation"
          ],
          "additionalProperties": false
        }
      }
    }
  },
  "responses": {
    "201": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "group": {
                "$ref": "#/components/schemas/OncallGroup"
              }
            },
            "required": [
              "group"
            ]
          }
        }
      }
    },
    "400": {
      "description": "Invalid request",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing, unknown, revoked, or expired token",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "The token lacks a required scope or the account lacks permission",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Not found for this account",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}
```

Resolve schema references against [OpenAPI](https://notify.belweave.ai/openapi.json).
