{
  "openapi": "3.2.0",
  "info": {
    "title": "Forward: Collection Schedules API",
    "summary": "Schedule recurring network collections",
    "description": "Define, update, or remove the schedules that trigger a network's recurring collections.",
    "contact": {
      "email": "support@forwardnetworks.com"
    },
    "license": {
      "name": "MIT",
      "url": "https://spdx.org/licenses/MIT"
    },
    "version": "26.8"
  },
  "servers": [
    {
      "url": "/api"
    }
  ],
  "security": [
    {
      "api_token": []
    }
  ],
  "tags": [
    {
      "name": "Network Collection",
      "description": "Configure and run the collection of configuration and state from a network"
    },
    {
      "name": "Collection Schedules",
      "description": "Schedule recurring network collections",
      "parent": "Network Collection"
    }
  ],
  "paths": {
    "/networks/{networkId}/collection-schedules": {
      "get": {
        "tags": [
          "Collection Schedules"
        ],
        "summary": "Get a network’s collection schedules",
        "operationId": "getCollectionSchedules",
        "parameters": [
          {
            "name": "networkId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionSchedules"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Collection Schedules"
        ],
        "summary": "Add a network collection schedule",
        "operationId": "addCollectionSchedule",
        "parameters": [
          {
            "name": "networkId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CollectionScheduleDefinition"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionSchedule"
                }
              }
            }
          }
        }
      }
    },
    "/networks/{networkId}/collection-schedules/{scheduleId}": {
      "get": {
        "tags": [
          "Collection Schedules"
        ],
        "summary": "Get a network collection schedule",
        "operationId": "getCollectionSchedule",
        "parameters": [
          {
            "name": "networkId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scheduleId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionSchedule"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Collection Schedules"
        ],
        "summary": "Replace a network collection schedule",
        "operationId": "replaceCollectionSchedule",
        "parameters": [
          {
            "name": "networkId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scheduleId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CollectionSchedule"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Collection Schedules"
        ],
        "summary": "Delete a network collection schedule",
        "operationId": "deleteCollectionSchedule",
        "parameters": [
          {
            "name": "networkId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scheduleId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No Content",
            "content": {}
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CollectionSchedule": {
        "allOf": [
          {
            "type": "object",
            "required": [
              "id"
            ],
            "properties": {
              "id": {
                "type": "string",
                "description": "Network-specific collection schedule identifier",
                "examples": [
                  "1"
                ]
              }
            }
          },
          {
            "$ref": "#/components/schemas/CollectionScheduleDefinition"
          }
        ]
      },
      "CollectionScheduleDefinition": {
        "type": "object",
        "required": [
          "enabled",
          "daysOfTheWeek"
        ],
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "Whether the schedule is currently in effect",
            "examples": [
              true
            ]
          },
          "timeZone": {
            "$ref": "#/components/schemas/TimeZone",
            "description": "The time zone used to identify day boundaries and to interpret `times`, `startAt`, and `endAt`. Defaults to\nthe organization’s preferred time zone.",
            "examples": [
              "America/Los_Angeles"
            ]
          },
          "daysOfTheWeek": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            },
            "description": "The days of the week, Sun (0), Mon (1), …, Sat (6), on which the collection schedule is active.\nNever empty.",
            "examples": [
              [
                0,
                2,
                4,
                6
              ]
            ]
          },
          "times": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Times of the day (in \"HH:mm\" format) at which network collections should start. Either `times` or\n`periodInSeconds` must be specified—not both. Never empty if present.",
            "examples": [
              [
                "01:00",
                "06:00",
                "11:00",
                "16:00",
                "21:00"
              ]
            ]
          },
          "periodInSeconds": {
            "type": "integer",
            "format": "int32",
            "description": "How many seconds after the start of the most recent collection that the next one should begin. Either\n`times` or `periodInSeconds` must be specified—not both. Must be positive.\n\n**Note**: A Collector can only perform one network collection at a time. A scheduled collection will be\ndelayed if it cannot start on time due to an earlier collection running long.",
            "examples": [
              1800
            ]
          },
          "startAt": {
            "type": "string",
            "description": "The time of day (in \"HH:mm\" format) at which a rate-based collection schedule begins. Must be absent if\n`times` is specified. Defaults to the start of the day (00:00).",
            "examples": [
              "05:30"
            ]
          },
          "endAt": {
            "type": "string",
            "description": "The time of day (in \"HH:mm\" format) at which a rate-based collection schedule ends. Must be absent if\n`times` is specified. Defaults to the end of the day.",
            "examples": [
              "20:00"
            ]
          }
        }
      },
      "CollectionSchedules": {
        "type": "object",
        "properties": {
          "schedules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CollectionSchedule"
            }
          }
        }
      },
      "TimeZone": {
        "type": "string",
        "enum": [
          "UTC",
          "Africa/Accra",
          "Africa/Addis_Ababa",
          "Africa/Algiers",
          "Africa/Cairo",
          "Africa/Dar_es_Salaam",
          "Africa/Johannesburg",
          "Africa/Khartoum",
          "Africa/Kinshasa",
          "Africa/Lagos",
          "Africa/Luanda",
          "Africa/Maputo",
          "America/Argentina/Buenos_Aires",
          "America/Bogota",
          "America/Chicago",
          "America/Denver",
          "America/Lima",
          "America/Los_Angeles",
          "America/Mexico_City",
          "America/New_York",
          "America/Phoenix",
          "America/Santiago",
          "America/Sao_Paulo",
          "America/Toronto",
          "Asia/Amman",
          "Asia/Baghdad",
          "Asia/Bangkok",
          "Asia/Beirut",
          "Asia/Dhaka",
          "Asia/Ho_Chi_Minh",
          "Asia/Hong_Kong",
          "Asia/Jakarta",
          "Asia/Jerusalem",
          "Asia/Karachi",
          "Asia/Kolkata",
          "Asia/Kuala_Lumpur",
          "Asia/Manila",
          "Asia/Riyadh",
          "Asia/Seoul",
          "Asia/Shanghai",
          "Asia/Singapore",
          "Asia/Tehran",
          "Asia/Tokyo",
          "Asia/Yangon",
          "Australia/Adelaide",
          "Australia/Eucla",
          "Australia/Perth",
          "Australia/Sydney",
          "Europe/Belgrade",
          "Europe/Berlin",
          "Europe/Istanbul",
          "Europe/London",
          "Europe/Madrid",
          "Europe/Moscow",
          "Europe/Paris",
          "Europe/Rome"
        ]
      }
    },
    "securitySchemes": {
      "api_token": {
        "type": "http",
        "scheme": "basic"
      }
    }
  }
}