{
 "openapi": "3.1.0",
 "info": {
  "title": "Avanciq customer API",
  "version": "1.0.0-preview",
  "description": "Read-only access to your Avanciq results and alerts. Keys are issued by Avanciq."
 },
 "servers": [
  {
   "url": "https://avanciq.com"
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "Error": {
    "type": "object",
    "properties": {
     "ok": {
      "type": "boolean"
     },
     "error": {
      "type": "string"
     }
    }
   },
   "Result": {
    "type": "object",
    "properties": {
     "run": {
      "type": "string"
     },
     "date": {
      "type": "string"
     },
     "model": {
      "type": "string"
     },
     "tasks": {
      "type": "integer"
     },
     "fully_right": {
      "type": "integer"
     },
     "accuracy_pct": {
      "type": "number"
     },
     "range_95": {
      "type": "array",
      "items": {
       "type": "number"
      }
     },
     "families": {
      "type": "object"
     }
    }
   },
   "Alert": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "date": {
      "type": "string"
     },
     "model": {
      "type": "string"
     },
     "before_pct": {
      "type": "number"
     },
     "now_pct": {
      "type": "number"
     },
     "drop_points": {
      "type": "number"
     },
     "p_value": {
      "type": "number"
     },
     "families_flagged": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "examples": {
      "type": "array",
      "items": {
       "type": "object"
      }
     }
    }
   }
  }
 },
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/api/v1/results": {
   "get": {
    "summary": "Your results (scope read:results)",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "ok": {
           "type": "boolean"
          },
          "customer": {
           "type": "string"
          },
          "results": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Result"
           }
          }
         }
        }
       }
      }
     },
     "401": {
      "description": "Missing, wrong or revoked key"
     },
     "403": {
      "description": "Missing scope"
     },
     "429": {
      "description": "Rate limit"
     }
    }
   }
  },
  "/api/v1/alerts": {
   "get": {
    "summary": "Your alerts (scope read:alerts)",
    "parameters": [
     {
      "name": "since",
      "in": "query",
      "schema": {
       "type": "string",
       "format": "date"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "ok": {
           "type": "boolean"
          },
          "customer": {
           "type": "string"
          },
          "alerts": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Alert"
           }
          }
         }
        }
       }
      }
     },
     "401": {
      "description": "Missing, wrong or revoked key"
     },
     "403": {
      "description": "Missing scope"
     },
     "429": {
      "description": "Rate limit"
     }
    }
   }
  }
 }
}