{
  "openapi": "3.1.0",
  "info": {
    "title": "Indexing Guard API",
    "version": "1.0.0",
    "contact": {
      "email": "terrell@myartmyrules.com"
    }
  },
  "servers": [
    {
      "url": "https://guard.myartmyrules.com"
    }
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "paths": {
    "/v1/process": {
      "post": {
        "summary": "Check one build's pages and get the sitemaps to publish",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProcessRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sitemaps, kept-out pages with reasons, page warnings and counts"
          },
          "400": {
            "description": "The body isn't valid. The error says why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, unknown or rotated API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Subscription inactive.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "More URLs than your plan covers per build.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Daily build limit reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Something failed on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/runs": {
      "get": {
        "summary": "Recent builds, counts only",
        "responses": {
          "200": {
            "description": "Up to 50 runs"
          },
          "401": {
            "description": "Missing, unknown or rotated API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/keys/rotate": {
      "post": {
        "summary": "Swap the calling key for a new one",
        "responses": {
          "200": {
            "description": "The new key, shown once",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "api_key": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, unknown or rotated API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "success": {
            "const": false
          },
          "data": {
            "type": "null"
          },
          "error": {
            "type": "string"
          }
        }
      },
      "ProcessRequest": {
        "type": "object",
        "required": [
          "routes"
        ],
        "properties": {
          "previous": {
            "type": "object",
            "description": "Optional. Address lists from your previous answer, compared in memory to return data.change_list. Nothing from it is stored.",
            "properties": {
              "sitemap_urls": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "noindex_urls": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    }
                  }
                }
              },
              "suppressed_urls": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    }
                  }
                }
              },
              "page_warnings": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "issue": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "routes": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "description": "Required. The page's path or full address on your site."
                },
                "source_url": {
                  "type": "string",
                  "description": "Where the page's facts come from. Pages without a valid source are kept out of the sitemap."
                },
                "checked_date": {
                  "type": "string",
                  "description": "When you last checked those facts, as YYYY-MM-DD. Becomes the sitemap's lastmod. Missing, invalid or future dates keep the page out."
                },
                "inventory_count": {
                  "type": "integer",
                  "description": "How many items the page lists. Zero takes the page out of the sitemap and your links."
                },
                "page_status": {
                  "type": "string",
                  "description": "Set to \"ignore\" to take a page out of the sitemap and your links."
                },
                "canonical": {
                  "type": "string",
                  "description": "Optional. The canonical tag from the built page (\"\" if none). Report only."
                },
                "title": {
                  "type": "string",
                  "description": "Optional. The page title. Report only."
                },
                "word_count": {
                  "type": "integer",
                  "description": "Optional. Words of body text. Report only."
                }
              }
            }
          }
        }
      }
    }
  }
}