Maintenance API and Policies



Hello OpsGenie Community,

I’m currently working towards integrating OpsGenie with another product and I’m trying to create a maintenance window through API.

Manually, this is done by navigating to: Teams / Policies / and creating a new maintenance window.
In the new maintenance window I’m creating, I’m using a schedule, and adding a notification policy as a rule.
When I do this manually, I can search and find the notification policy and assign it.

The issue I’m having is when I do exactly the same through API, I get a message saying that policy isn’t available:
“Policy with given id [c88d1e1f-36bd-474b-9614-74ba8b8418ae] can not be found”.

If I create the maintenance window manually, and pull the details through a REST GET - I can see the same exact policy I am using, so I know it is correct.

Has anyone encountered this issue, and how can I resolve this? I’ll give a sample POST body below.


JSON body:
“description”: “Test Description”,
“time”: {
“type” : “schedule”,
“startDate”: “2019-12-25T08:45:00Z”,
“endDate”: “2019-12-25T21:45:00Z”
“rules”: [
“state”: “enabled”,
“id”: “c88d1e1f-36bd-474b-9614-74ba8b8418ae”,
“type”: “policy”

Thank you,



May be a fast guess but if you copied and pasted the json payload, there is a “{” missing after “entity” key. Can you verify that the json payload is correct?


Hello @serhat,

You are correct regarding the missing “{”, however in the original request it was there - I must have deleted it somehow in the process of copying/pasting.

I’ve attached a photo showing the request/response:

Thank you,



This is specific and you probably need to provide some internal information about your account which might be sensitive to share in a public forum. I suggest you login with your account and chat with the customer support team via the message bubble on the website. Thank you!


Hi Arun/Justin,

Just a quick follow up, team-based maintenance policies made through the API require an API key assigned to that team in order to work. With that you should be able to schedule a maintenance window using this format in the request:

  "teamId": "a1c09bd4-e5b4-4e03-896d-fb69db9a9a3f",
  "description": "Maintenance Description",
  "time": {
    "type": "schedule",
    "startDate": "2019-01-05T08:45:00Z",
    "endDate": "2019-01-05T21:45:00Z"
  "rules": [
      "state": "disabled",
      "entity": {
        "id": "44ec2c7e-c14e-45d7-b5d8-3bd5f5041a2b",
        "type": "integration"


Thank you @serhat, will do. Appreciate your help.



Let me try this. I was looking for some way to identify the team but didn’t see anything documented with relation to team-specific policies. I’m guessing this is going to work and appreciate your input and help in advance, crossing my fingers and will update the body with the appropriate teamId.

Thank you!


Hello @Robert,

I did take a look at the integration that was set up - the API key / integration I was using was labeled correctly specific to the team I was working with, but no team was assigned. Set up a new integration and assigned to the correct team and everything is working fine. Thank you, this was a great help.