{
  "openapi": "3.1.0",
  "info": {
    "title": "AIDE AI Partner API",
    "version": "v1"
  },
  "servers": [
    {
      "url": "https://api.learningaide.ai"
    }
  ],
  "tags": [
    {
      "name": "Authentication"
    },
    {
      "name": "Files"
    },
    {
      "name": "Subjects"
    },
    {
      "name": "Papers"
    },
    {
      "name": "Submissions"
    },
    {
      "name": "Results and reports"
    },
    {
      "name": "Account and balance"
    },
    {
      "name": "Webhooks"
    },
    {
      "name": "Events"
    }
  ],
  "paths": {
    "/v1/api_key/revoke": {
      "post": {
        "operationId": "revokeApiKey",
        "tags": [
          "Authentication"
        ],
        "summary": "Revoke the key that makes this request",
        "security": [
          {
            "bearer": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The request succeeded.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKeyRevocation"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/files": {
      "post": {
        "operationId": "createFile",
        "tags": [
          "Files"
        ],
        "summary": "Upload a file",
        "security": [
          {
            "bearer": [
              "papers:write"
            ]
          },
          {
            "bearer": [
              "submissions:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "A unique value, such as a v4 UUID, that you reuse only to retry this request.",
            "schema": {
              "type": "string",
              "pattern": "^[\\x21-\\x7e]{1,255}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "purpose": {
                    "type": "string",
                    "enum": [
                      "question_paper",
                      "marking_scheme",
                      "answer_script"
                    ]
                  },
                  "filename": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255,
                    "pattern": "^[^\\u0000-\\u001f\\u007f-\\u009f\\u202a-\\u202e\\u2066-\\u2069]*$"
                  },
                  "content_type": {
                    "type": "string",
                    "enum": [
                      "application/pdf",
                      "image/jpeg",
                      "image/png"
                    ]
                  },
                  "size_bytes": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 104857600
                  }
                },
                "required": [
                  "purpose",
                  "filename",
                  "content_type",
                  "size_bytes"
                ],
                "additionalProperties": false,
                "if": {
                  "properties": {
                    "purpose": {
                      "enum": [
                        "question_paper",
                        "marking_scheme"
                      ]
                    }
                  }
                },
                "then": {
                  "properties": {
                    "content_type": {
                      "const": "application/pdf"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "A new object was created. Its processing may continue in the background.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/File"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/files/{id}": {
      "get": {
        "operationId": "retrieveFile",
        "tags": [
          "Files"
        ],
        "summary": "Retrieve a file",
        "security": [
          {
            "bearer": [
              "papers:read"
            ]
          },
          {
            "bearer": [
              "submissions:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The request succeeded.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/File"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/subjects": {
      "get": {
        "operationId": "listSubjects",
        "tags": [
          "Subjects"
        ],
        "summary": "List subjects",
        "security": [
          {
            "bearer": [
              "papers:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The request succeeded.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubjectList"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/papers": {
      "post": {
        "operationId": "createPaper",
        "tags": [
          "Papers"
        ],
        "summary": "Create a paper",
        "security": [
          {
            "bearer": [
              "papers:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "A unique value, such as a v4 UUID, that you reuse only to retry this request.",
            "schema": {
              "type": "string",
              "pattern": "^[\\x21-\\x7e]{1,255}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255,
                    "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
                  },
                  "subject_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "question_paper": {
                    "type": "object",
                    "properties": {
                      "file_id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      "url": {
                        "type": "string",
                        "maxLength": 2048,
                        "format": "uri",
                        "description": "An https:// URL.",
                        "pattern": "^[Hh][Tt][Tt][Pp][Ss]://"
                      }
                    },
                    "additionalProperties": false,
                    "oneOf": [
                      {
                        "required": [
                          "file_id"
                        ]
                      },
                      {
                        "required": [
                          "url"
                        ]
                      }
                    ]
                  },
                  "marking_scheme": {
                    "type": "object",
                    "properties": {
                      "file_id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      "url": {
                        "type": "string",
                        "maxLength": 2048,
                        "format": "uri",
                        "description": "An https:// URL.",
                        "pattern": "^[Hh][Tt][Tt][Pp][Ss]://"
                      }
                    },
                    "additionalProperties": false,
                    "oneOf": [
                      {
                        "required": [
                          "file_id"
                        ]
                      },
                      {
                        "required": [
                          "url"
                        ]
                      }
                    ]
                  },
                  "results_release": {
                    "type": "string",
                    "enum": [
                      "automatic",
                      "after_review"
                    ]
                  },
                  "grading": {
                    "type": "object",
                    "properties": {
                      "strictness": {
                        "type": "string",
                        "enum": [
                          "lenient",
                          "standard",
                          "strict"
                        ]
                      },
                      "feedback": {
                        "type": "string",
                        "enum": [
                          "none",
                          "brief",
                          "standard",
                          "detailed"
                        ]
                      },
                      "instructions": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 5000
                      }
                    },
                    "additionalProperties": false
                  },
                  "external_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
                  },
                  "metadata": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40
                    },
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "maxProperties": 20
                  },
                  "test_outcome": {
                    "type": "string",
                    "enum": [
                      "awaiting_review",
                      "with_warnings",
                      "file_unreadable",
                      "no_questions_found",
                      "insufficient_credits"
                    ]
                  }
                },
                "required": [
                  "title",
                  "subject_id",
                  "question_paper",
                  "marking_scheme"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "A new object was created. Its processing may continue in the background.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Paper"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listPapers",
        "tags": [
          "Papers"
        ],
        "summary": "List papers",
        "security": [
          {
            "bearer": [
              "papers:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "created_after",
            "in": "query",
            "required": false,
            "schema": {
              "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|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "created_before",
            "in": "query",
            "required": false,
            "schema": {
              "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|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "updated_after",
            "in": "query",
            "required": false,
            "schema": {
              "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|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "processing",
                "awaiting_review",
                "ready",
                "failed"
              ]
            }
          },
          {
            "name": "subject_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "external_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The request succeeded.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaperList"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/papers/{id}": {
      "get": {
        "operationId": "retrievePaper",
        "tags": [
          "Papers"
        ],
        "summary": "Retrieve a paper",
        "security": [
          {
            "bearer": [
              "papers:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The request succeeded.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Paper"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updatePaper",
        "tags": [
          "Papers"
        ],
        "summary": "Update a paper",
        "security": [
          {
            "bearer": [
              "papers:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255,
                    "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
                  },
                  "external_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128,
                        "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "metadata": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40
                    },
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "maxProperties": 20
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The request succeeded.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Paper"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deletePaper",
        "tags": [
          "Papers"
        ],
        "summary": "Delete a paper",
        "security": [
          {
            "bearer": [
              "papers:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "The object was deleted.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/papers/{id}/approve": {
      "post": {
        "operationId": "approvePaper",
        "tags": [
          "Papers"
        ],
        "summary": "Approve a paper",
        "security": [
          {
            "bearer": [
              "papers:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "A unique value, such as a v4 UUID, that you reuse only to retry this request.",
            "schema": {
              "type": "string",
              "pattern": "^[\\x21-\\x7e]{1,255}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The request succeeded.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Paper"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/papers/{id}/questions": {
      "get": {
        "operationId": "listPaperQuestions",
        "tags": [
          "Papers"
        ],
        "summary": "List a paper's questions",
        "security": [
          {
            "bearer": [
              "papers:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The request succeeded.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QuestionList"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/papers/{id}/review_links": {
      "post": {
        "operationId": "createReviewLink",
        "tags": [
          "Papers"
        ],
        "summary": "Create a review link",
        "security": [
          {
            "bearer": [
              "papers:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reviewer": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "pattern": "^[^\\u0000-\\u001f\\u007f-\\u009f\\u202a-\\u202e\\u2066-\\u2069]*$"
                  },
                  "expires_in_hours": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 24
                  }
                },
                "required": [
                  "reviewer"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "A new object was created. Its processing may continue in the background.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReviewLink"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/papers/{id}/review_links/revoke": {
      "post": {
        "operationId": "revokeReviewLinks",
        "tags": [
          "Papers"
        ],
        "summary": "Withdraw a paper's review links",
        "security": [
          {
            "bearer": [
              "papers:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "A unique value, such as a v4 UUID, that you reuse only to retry this request.",
            "schema": {
              "type": "string",
              "pattern": "^[\\x21-\\x7e]{1,255}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The request succeeded.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReviewLinkRevocation"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/submissions": {
      "post": {
        "operationId": "createSubmission",
        "tags": [
          "Submissions"
        ],
        "summary": "Create a submission",
        "security": [
          {
            "bearer": [
              "submissions:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "A unique value, such as a v4 UUID, that you reuse only to retry this request.",
            "schema": {
              "type": "string",
              "pattern": "^[\\x21-\\x7e]{1,255}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "paper_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "student": {
                    "type": "object",
                    "properties": {
                      "external_id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128,
                        "pattern": "^[^\\u0000-\\u001f\\u007f]*$"
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100,
                        "pattern": "^[^\\u0000-\\u001f\\u007f-\\u009f\\u202a-\\u202e\\u2066-\\u2069]*$"
                      }
                    },
                    "required": [
                      "external_id"
                    ],
                    "additionalProperties": false
                  },
                  "files": {
                    "minItems": 1,
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "file_id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "url": {
                          "type": "string",
                          "maxLength": 2048,
                          "format": "uri",
                          "description": "An https:// URL.",
                          "pattern": "^[Hh][Tt][Tt][Pp][Ss]://"
                        }
                      },
                      "additionalProperties": false,
                      "oneOf": [
                        {
                          "required": [
                            "file_id"
                          ]
                        },
                        {
                          "required": [
                            "url"
                          ]
                        }
                      ]
                    }
                  },
                  "metadata": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40
                    },
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "maxProperties": 20
                  },
                  "test_outcome": {
                    "type": "string",
                    "enum": [
                      "graded",
                      "no_readable_answers",
                      "file_unreadable",
                      "insufficient_credits",
                      "grading_failed"
                    ]
                  }
                },
                "required": [
                  "paper_id",
                  "student",
                  "files"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "A new object was created. Its processing may continue in the background.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Submission"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listSubmissions",
        "tags": [
          "Submissions"
        ],
        "summary": "List submissions",
        "security": [
          {
            "bearer": [
              "submissions:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "created_after",
            "in": "query",
            "required": false,
            "schema": {
              "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|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "created_before",
            "in": "query",
            "required": false,
            "schema": {
              "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|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "updated_after",
            "in": "query",
            "required": false,
            "schema": {
              "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|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "paper_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "student_external_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "queued",
                "processing",
                "graded",
                "released",
                "failed",
                "canceled"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The request succeeded.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubmissionList"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/submissions/{id}": {
      "get": {
        "operationId": "retrieveSubmission",
        "tags": [
          "Submissions"
        ],
        "summary": "Retrieve a submission",
        "security": [
          {
            "bearer": [
              "submissions:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The request succeeded.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Submission"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateSubmission",
        "tags": [
          "Submissions"
        ],
        "summary": "Update a submission",
        "security": [
          {
            "bearer": [
              "submissions:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "student": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100,
                            "pattern": "^[^\\u0000-\\u001f\\u007f-\\u009f\\u202a-\\u202e\\u2066-\\u2069]*$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  "metadata": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40
                    },
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "maxProperties": 20
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The request succeeded.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Submission"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteSubmission",
        "tags": [
          "Submissions"
        ],
        "summary": "Delete a submission",
        "security": [
          {
            "bearer": [
              "submissions:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "The object was deleted.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/submissions/{id}/cancel": {
      "post": {
        "operationId": "cancelSubmission",
        "tags": [
          "Submissions"
        ],
        "summary": "Cancel a submission",
        "security": [
          {
            "bearer": [
              "submissions:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "A unique value, such as a v4 UUID, that you reuse only to retry this request.",
            "schema": {
              "type": "string",
              "pattern": "^[\\x21-\\x7e]{1,255}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The request succeeded.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Submission"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/submissions/{id}/release": {
      "post": {
        "operationId": "releaseSubmission",
        "tags": [
          "Submissions"
        ],
        "summary": "Release a submission",
        "security": [
          {
            "bearer": [
              "submissions:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "A unique value, such as a v4 UUID, that you reuse only to retry this request.",
            "schema": {
              "type": "string",
              "pattern": "^[\\x21-\\x7e]{1,255}$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The request succeeded.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Submission"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/submissions/{id}/result": {
      "get": {
        "operationId": "retrieveResult",
        "tags": [
          "Results and reports"
        ],
        "summary": "Retrieve a result",
        "security": [
          {
            "bearer": [
              "submissions:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The request succeeded.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/submissions/{id}/report": {
      "get": {
        "operationId": "retrieveReport",
        "tags": [
          "Results and reports"
        ],
        "summary": "Download the report",
        "security": [
          {
            "bearer": [
              "submissions:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sections",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64,
              "pattern": "^\\s*(?:marks|summary|feedback)\\s*(?:,\\s*(?:marks|summary|feedback)\\s*)*$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The request succeeded.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Report"
                }
              }
            }
          },
          "202": {
            "description": "Not ready yet. Retry after the number of seconds in Retry-After.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Report"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account": {
      "get": {
        "operationId": "retrieveAccount",
        "tags": [
          "Account and balance"
        ],
        "summary": "Retrieve your account",
        "security": [
          {
            "bearer": [
              "billing:read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "The request succeeded.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Account"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/balance": {
      "get": {
        "operationId": "retrieveBalance",
        "tags": [
          "Account and balance"
        ],
        "summary": "Retrieve your balance",
        "security": [
          {
            "bearer": [
              "billing:read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "The request succeeded.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Balance"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/credit_transactions": {
      "get": {
        "operationId": "listCreditTransactions",
        "tags": [
          "Account and balance"
        ],
        "summary": "List credit transactions",
        "security": [
          {
            "bearer": [
              "billing:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "created_after",
            "in": "query",
            "required": false,
            "schema": {
              "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|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "created_before",
            "in": "query",
            "required": false,
            "schema": {
              "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|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "top_up",
                "paper_processing",
                "grading",
                "adjustment",
                "expiry"
              ]
            }
          },
          {
            "name": "source_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The request succeeded.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreditTransactionList"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhook_endpoints": {
      "post": {
        "operationId": "createWebhookEndpoint",
        "tags": [
          "Webhooks"
        ],
        "summary": "Create a webhook endpoint",
        "security": [
          {
            "bearer": [
              "webhooks:manage"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "maxLength": 2048,
                    "format": "uri",
                    "description": "An https:// URL.",
                    "pattern": "^[Hh][Tt][Tt][Pp][Ss]://"
                  },
                  "events": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "*",
                        "paper.awaiting_review",
                        "paper.ready",
                        "paper.failed",
                        "submission.graded",
                        "submission.released",
                        "submission.failed",
                        "credits.balance_low",
                        "credits.expiring"
                      ]
                    },
                    "if": {
                      "contains": {
                        "const": "*"
                      }
                    },
                    "then": {
                      "maxItems": 1
                    }
                  },
                  "description": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255,
                    "pattern": "^[^\\u0000-\\u001f\\u007f-\\u009f\\u202a-\\u202e\\u2066-\\u2069]*$"
                  }
                },
                "required": [
                  "url",
                  "events"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "A new object was created. Its processing may continue in the background.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointWithSecret"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listWebhookEndpoints",
        "tags": [
          "Webhooks"
        ],
        "summary": "List webhook endpoints",
        "security": [
          {
            "bearer": [
              "webhooks:manage"
            ]
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "created_after",
            "in": "query",
            "required": false,
            "schema": {
              "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|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "created_before",
            "in": "query",
            "required": false,
            "schema": {
              "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|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The request succeeded.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointList"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhook_endpoints/{id}": {
      "get": {
        "operationId": "retrieveWebhookEndpoint",
        "tags": [
          "Webhooks"
        ],
        "summary": "Retrieve a webhook endpoint",
        "security": [
          {
            "bearer": [
              "webhooks:manage"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The request succeeded.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateWebhookEndpoint",
        "tags": [
          "Webhooks"
        ],
        "summary": "Update a webhook endpoint",
        "security": [
          {
            "bearer": [
              "webhooks:manage"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "maxLength": 2048,
                    "format": "uri",
                    "description": "An https:// URL.",
                    "pattern": "^[Hh][Tt][Tt][Pp][Ss]://"
                  },
                  "events": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "*",
                        "paper.awaiting_review",
                        "paper.ready",
                        "paper.failed",
                        "submission.graded",
                        "submission.released",
                        "submission.failed",
                        "credits.balance_low",
                        "credits.expiring"
                      ]
                    },
                    "if": {
                      "contains": {
                        "const": "*"
                      }
                    },
                    "then": {
                      "maxItems": 1
                    }
                  },
                  "description": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 255,
                        "pattern": "^[^\\u0000-\\u001f\\u007f-\\u009f\\u202a-\\u202e\\u2066-\\u2069]*$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "enabled",
                      "disabled"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The request succeeded.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteWebhookEndpoint",
        "tags": [
          "Webhooks"
        ],
        "summary": "Delete a webhook endpoint",
        "security": [
          {
            "bearer": [
              "webhooks:manage"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "The object was deleted.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhook_endpoints/{id}/rotate_secret": {
      "post": {
        "operationId": "rotateWebhookEndpointSecret",
        "tags": [
          "Webhooks"
        ],
        "summary": "Rotate a webhook endpoint's secret",
        "security": [
          {
            "bearer": [
              "webhooks:manage"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The request succeeded.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointWithSecret"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/events": {
      "get": {
        "operationId": "listEvents",
        "tags": [
          "Events"
        ],
        "summary": "List events",
        "security": [
          {
            "bearer": [
              "events:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "created_after",
            "in": "query",
            "required": false,
            "schema": {
              "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|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "created_before",
            "in": "query",
            "required": false,
            "schema": {
              "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|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "paper.awaiting_review",
                "paper.ready",
                "paper.failed",
                "submission.graded",
                "submission.released",
                "submission.failed",
                "credits.balance_low",
                "credits.expiring"
              ]
            }
          },
          {
            "name": "object_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The request succeeded.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventList"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/events/{id}": {
      "get": {
        "operationId": "retrieveEvent",
        "tags": [
          "Events"
        ],
        "summary": "Retrieve an event",
        "security": [
          {
            "bearer": [
              "events:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The request succeeded.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Event"
                }
              }
            }
          },
          "default": {
            "description": "An error (client docs, \"Errors\").",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {
    "paper.awaiting_review": {
      "post": {
        "summary": "A paper's questions, marks and answer keys have been read",
        "parameters": [
          {
            "name": "AIDE-Signature",
            "in": "header",
            "required": true,
            "description": "Verify it before you trust the body (client docs, \"Verify the signature\").",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PaperAwaitingReviewEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Anything else, or no answer within 10 seconds, is retried."
          }
        }
      }
    },
    "paper.ready": {
      "post": {
        "summary": "A paper was approved",
        "parameters": [
          {
            "name": "AIDE-Signature",
            "in": "header",
            "required": true,
            "description": "Verify it before you trust the body (client docs, \"Verify the signature\").",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PaperReadyEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Anything else, or no answer within 10 seconds, is retried."
          }
        }
      }
    },
    "paper.failed": {
      "post": {
        "summary": "A paper couldn't be processed",
        "parameters": [
          {
            "name": "AIDE-Signature",
            "in": "header",
            "required": true,
            "description": "Verify it before you trust the body (client docs, \"Verify the signature\").",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PaperFailedEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Anything else, or no answer within 10 seconds, is retried."
          }
        }
      }
    },
    "submission.graded": {
      "post": {
        "summary": "A submission has been marked",
        "parameters": [
          {
            "name": "AIDE-Signature",
            "in": "header",
            "required": true,
            "description": "Verify it before you trust the body (client docs, \"Verify the signature\").",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubmissionGradedEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Anything else, or no answer within 10 seconds, is retried."
          }
        }
      }
    },
    "submission.released": {
      "post": {
        "summary": "A submission's result is final",
        "parameters": [
          {
            "name": "AIDE-Signature",
            "in": "header",
            "required": true,
            "description": "Verify it before you trust the body (client docs, \"Verify the signature\").",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubmissionReleasedEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Anything else, or no answer within 10 seconds, is retried."
          }
        }
      }
    },
    "submission.failed": {
      "post": {
        "summary": "A submission couldn't be marked",
        "parameters": [
          {
            "name": "AIDE-Signature",
            "in": "header",
            "required": true,
            "description": "Verify it before you trust the body (client docs, \"Verify the signature\").",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubmissionFailedEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Anything else, or no answer within 10 seconds, is retried."
          }
        }
      }
    },
    "credits.balance_low": {
      "post": {
        "summary": "Your available live balance fell below your alert threshold",
        "parameters": [
          {
            "name": "AIDE-Signature",
            "in": "header",
            "required": true,
            "description": "Verify it before you trust the body (client docs, \"Verify the signature\").",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreditsBalanceLowEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Anything else, or no answer within 10 seconds, is retried."
          }
        }
      }
    },
    "credits.expiring": {
      "post": {
        "summary": "Your credits' validity ends in 7 days",
        "parameters": [
          {
            "name": "AIDE-Signature",
            "in": "header",
            "required": true,
            "description": "Verify it before you trust the body (client docs, \"Verify the signature\").",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreditsExpiringEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Anything else, or no answer within 10 seconds, is retried."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "headers": {
      "X-Request-Id": {
        "description": "This request's ID. Quote it when you contact support.",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "RateLimit-Limit": {
        "description": "Requests allowed per window.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimit-Remaining": {
        "description": "Requests left in the current window.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimit-Reset": {
        "description": "Seconds until the window resets.",
        "schema": {
          "type": "integer"
        }
      },
      "Retry-After": {
        "description": "Seconds to wait before asking again.",
        "schema": {
          "type": "integer"
        }
      },
      "Idempotent-Replayed": {
        "description": "On the saved response to an earlier request with this Idempotency-Key.",
        "schema": {
          "type": "string",
          "const": "true"
        }
      }
    },
    "schemas": {
      "Timestamp": {
        "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(?:Z))$"
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "invalid_request_error",
                  "authentication_error",
                  "billing_error",
                  "permission_error",
                  "rate_limit_error",
                  "api_error"
                ]
              },
              "code": {
                "type": "string",
                "enum": [
                  "parameter_missing",
                  "parameter_invalid",
                  "parameter_unknown",
                  "invalid_json",
                  "idempotency_key_missing",
                  "api_key_missing",
                  "api_key_invalid",
                  "api_key_revoked",
                  "insufficient_credits",
                  "credits_expired",
                  "insufficient_scope",
                  "ip_not_allowed",
                  "account_suspended",
                  "resource_missing",
                  "route_not_found",
                  "idempotency_key_reused",
                  "idempotency_request_in_progress",
                  "external_id_taken",
                  "paper_not_ready",
                  "paper_not_awaiting_review",
                  "paper_in_progress",
                  "paper_has_empty_question",
                  "review_link_unavailable",
                  "file_already_attached",
                  "file_purpose_mismatch",
                  "file_not_uploaded",
                  "file_expired",
                  "submission_exists",
                  "submission_not_cancelable",
                  "submission_not_releasable",
                  "submission_in_progress",
                  "result_not_available",
                  "report_not_available",
                  "too_many_webhook_endpoints",
                  "request_too_large",
                  "unsupported_media_type",
                  "rate_limit_exceeded",
                  "internal_error",
                  "service_unavailable"
                ]
              },
              "message": {
                "type": "string"
              },
              "param": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "resource_id": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "request_id": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "type",
              "code",
              "message",
              "param",
              "resource_id",
              "request_id"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "ApiKeyRevocation": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "api_key"
          },
          "revoked": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "object",
          "revoked"
        ]
      },
      "File": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "const": "file"
          },
          "livemode": {
            "type": "boolean"
          },
          "purpose": {
            "type": "string",
            "enum": [
              "question_paper",
              "marking_scheme",
              "answer_script"
            ]
          },
          "filename": {
            "type": "string"
          },
          "content_type": {
            "type": "string",
            "enum": [
              "application/pdf",
              "image/jpeg",
              "image/png"
            ]
          },
          "size_bytes": {
            "type": "integer"
          },
          "pages": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "awaiting_upload",
              "uploaded",
              "attached",
              "expired"
            ]
          },
          "upload": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "method": {
                    "type": "string",
                    "const": "PUT"
                  },
                  "headers": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "string"
                    }
                  },
                  "expires_at": {
                    "$ref": "#/components/schemas/Timestamp"
                  }
                },
                "required": [
                  "url",
                  "method",
                  "headers",
                  "expires_at"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "expires_at": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "object",
          "livemode",
          "purpose",
          "filename",
          "content_type",
          "size_bytes",
          "pages",
          "status",
          "upload",
          "created_at",
          "expires_at"
        ]
      },
      "Subject": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "const": "subject"
          },
          "name": {
            "type": "string"
          },
          "board": {
            "type": "string"
          },
          "level": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "syllabus_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "object",
          "name",
          "board",
          "level",
          "syllabus_code"
        ]
      },
      "SubjectList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Subject"
            }
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "next_cursor"
        ]
      },
      "Billing": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "held",
              "charged",
              "not_charged"
            ]
          },
          "pages": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "credits": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "status",
          "pages",
          "credits"
        ]
      },
      "Paper": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "const": "paper"
          },
          "livemode": {
            "type": "boolean"
          },
          "title": {
            "type": "string"
          },
          "subject_id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "processing",
              "awaiting_review",
              "ready",
              "failed"
            ]
          },
          "failure": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "enum": [
                      "file_download_failed",
                      "file_unreadable",
                      "unsupported_file_type",
                      "file_too_large",
                      "too_many_pages",
                      "insufficient_credits",
                      "credits_expired",
                      "processing_timeout",
                      "no_questions_found",
                      "processing_failed"
                    ]
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "message"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "questions_may_be_incomplete",
                "answer_keys_missing",
                "scheme_instructions_not_used"
              ]
            }
          },
          "question_paper": {
            "type": "object",
            "properties": {
              "file_id": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "pages": {
                "anyOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "file_id",
              "pages"
            ]
          },
          "marking_scheme": {
            "type": "object",
            "properties": {
              "file_id": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "pages": {
                "anyOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "file_id",
              "pages"
            ]
          },
          "question_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "total_marks": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "results_release": {
            "type": "string",
            "enum": [
              "automatic",
              "after_review"
            ]
          },
          "grading": {
            "type": "object",
            "properties": {
              "strictness": {
                "type": "string",
                "enum": [
                  "lenient",
                  "standard",
                  "strict"
                ]
              },
              "feedback": {
                "type": "string",
                "enum": [
                  "none",
                  "brief",
                  "standard",
                  "detailed"
                ]
              },
              "instructions": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "strictness",
              "feedback",
              "instructions"
            ]
          },
          "billing": {
            "$ref": "#/components/schemas/Billing"
          },
          "submission_counts": {
            "type": "object",
            "propertyNames": {
              "type": "string",
              "enum": [
                "queued",
                "processing",
                "graded",
                "released",
                "failed",
                "canceled"
              ]
            },
            "additionalProperties": {
              "type": "integer"
            },
            "required": [
              "queued",
              "processing",
              "graded",
              "released",
              "failed",
              "canceled"
            ]
          },
          "external_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            }
          },
          "created_at": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "approved_at": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "$ref": "#/components/schemas/Timestamp"
          }
        },
        "required": [
          "id",
          "object",
          "livemode",
          "title",
          "subject_id",
          "status",
          "failure",
          "warnings",
          "question_paper",
          "marking_scheme",
          "question_count",
          "total_marks",
          "results_release",
          "grading",
          "billing",
          "submission_counts",
          "external_id",
          "metadata",
          "created_at",
          "approved_at",
          "updated_at"
        ]
      },
      "PaperList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Paper"
            }
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "next_cursor"
        ]
      },
      "Question": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "const": "question"
          },
          "number": {
            "type": "string"
          },
          "section": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "multiple_choice",
              "written"
            ]
          },
          "text": {
            "type": "string"
          },
          "marks": {
            "type": "number"
          },
          "answer_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "options": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string"
                    },
                    "text": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "label",
                    "text"
                  ]
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "correct_option": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "parts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "text": {
                  "type": "string"
                },
                "marks": {
                  "type": "number"
                },
                "answer_key": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "key",
                "label",
                "text",
                "marks",
                "answer_key"
              ]
            }
          }
        },
        "required": [
          "id",
          "object",
          "number",
          "section",
          "type",
          "text",
          "marks",
          "answer_key",
          "options",
          "correct_option",
          "parts"
        ]
      },
      "QuestionList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Question"
            }
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "next_cursor"
        ]
      },
      "ReviewLink": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "review_link"
          },
          "paper_id": {
            "type": "string"
          },
          "reviewer": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "expires_at": {
            "$ref": "#/components/schemas/Timestamp"
          }
        },
        "required": [
          "object",
          "paper_id",
          "reviewer",
          "url",
          "expires_at"
        ]
      },
      "ReviewLinkRevocation": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "review_link_revocation"
          },
          "paper_id": {
            "type": "string"
          },
          "revoked": {
            "type": "integer"
          }
        },
        "required": [
          "object",
          "paper_id",
          "revoked"
        ]
      },
      "Submission": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "const": "submission"
          },
          "livemode": {
            "type": "boolean"
          },
          "paper_id": {
            "type": "string"
          },
          "student": {
            "type": "object",
            "properties": {
              "external_id": {
                "type": "string"
              },
              "name": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "external_id",
              "name"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "processing",
              "graded",
              "released",
              "failed",
              "canceled"
            ]
          },
          "failure": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "enum": [
                      "file_download_failed",
                      "file_unreadable",
                      "unsupported_file_type",
                      "file_too_large",
                      "too_many_pages",
                      "image_too_small",
                      "insufficient_credits",
                      "credits_expired",
                      "processing_timeout",
                      "invalid_file_combination",
                      "grading_failed"
                    ]
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "message"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "no_readable_answers": {
            "type": "boolean"
          },
          "files": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "file_id": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "pages": {
                  "anyOf": [
                    {
                      "type": "integer"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "file_id",
                "pages"
              ]
            }
          },
          "billing": {
            "$ref": "#/components/schemas/Billing"
          },
          "score": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "awarded": {
                    "type": "number"
                  },
                  "available": {
                    "type": "number"
                  },
                  "percentage": {
                    "type": "number"
                  }
                },
                "required": [
                  "awarded",
                  "available",
                  "percentage"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "graded_at": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "released_at": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            }
          },
          "created_at": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "updated_at": {
            "$ref": "#/components/schemas/Timestamp"
          }
        },
        "required": [
          "id",
          "object",
          "livemode",
          "paper_id",
          "student",
          "status",
          "failure",
          "no_readable_answers",
          "files",
          "billing",
          "score",
          "graded_at",
          "released_at",
          "metadata",
          "created_at",
          "updated_at"
        ]
      },
      "SubmissionList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Submission"
            }
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "next_cursor"
        ]
      },
      "Result": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "result"
          },
          "livemode": {
            "type": "boolean"
          },
          "submission_id": {
            "type": "string"
          },
          "paper_id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "provisional",
              "final"
            ]
          },
          "student": {
            "type": "object",
            "properties": {
              "external_id": {
                "type": "string"
              },
              "name": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "external_id",
              "name"
            ]
          },
          "score": {
            "type": "object",
            "properties": {
              "awarded": {
                "type": "number"
              },
              "available": {
                "type": "number"
              },
              "percentage": {
                "type": "number"
              }
            },
            "required": [
              "awarded",
              "available",
              "percentage"
            ]
          },
          "no_readable_answers": {
            "type": "boolean"
          },
          "graded_at": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "released_at": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "questions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "question_id": {
                  "type": "string"
                },
                "number": {
                  "type": "string"
                },
                "section": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "multiple_choice",
                    "written"
                  ]
                },
                "marks_available": {
                  "type": "number"
                },
                "marks_awarded": {
                  "type": "number"
                },
                "counted": {
                  "type": "boolean"
                },
                "is_correct": {
                  "type": "boolean"
                },
                "adjusted": {
                  "type": "boolean"
                },
                "adjusted_by": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "adjusted_at": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Timestamp"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "feedback": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "strengths": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "improvements": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "explanation": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "answer_text": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "selected_option": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "parts": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "key": {
                        "type": "string"
                      },
                      "label": {
                        "type": "string"
                      },
                      "marks_available": {
                        "type": "number"
                      },
                      "marks_awarded": {
                        "type": "number"
                      },
                      "is_correct": {
                        "type": "boolean"
                      },
                      "adjusted": {
                        "type": "boolean"
                      },
                      "feedback": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "explanation": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "answer_text": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "key",
                      "label",
                      "marks_available",
                      "marks_awarded",
                      "is_correct",
                      "adjusted",
                      "feedback",
                      "explanation",
                      "answer_text"
                    ]
                  }
                }
              },
              "required": [
                "question_id",
                "number",
                "section",
                "type",
                "marks_available",
                "marks_awarded",
                "counted",
                "is_correct",
                "adjusted",
                "adjusted_by",
                "adjusted_at",
                "feedback",
                "strengths",
                "improvements",
                "explanation",
                "answer_text",
                "selected_option",
                "parts"
              ]
            }
          }
        },
        "required": [
          "object",
          "livemode",
          "submission_id",
          "paper_id",
          "status",
          "student",
          "score",
          "no_readable_answers",
          "graded_at",
          "released_at",
          "questions"
        ]
      },
      "Report": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "report"
          },
          "submission_id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "ready",
              "rendering"
            ]
          },
          "sections": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "marks",
                "summary",
                "feedback"
              ]
            }
          },
          "url": {
            "anyOf": [
              {
                "type": "string",
                "format": "uri"
              },
              {
                "type": "null"
              }
            ]
          },
          "expires_at": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "object",
          "submission_id",
          "status",
          "sections",
          "url",
          "expires_at"
        ]
      },
      "Account": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "account"
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "livemode": {
            "type": "boolean"
          },
          "pricing": {
            "type": "object",
            "properties": {
              "paper_credits_per_page": {
                "type": "integer"
              },
              "grading_credits_per_page": {
                "type": "integer"
              }
            },
            "required": [
              "paper_credits_per_page",
              "grading_credits_per_page"
            ]
          },
          "low_balance_threshold": {
            "type": "integer"
          },
          "credits_valid_until": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "technical_contact_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "rate_limit_per_minute": {
            "type": "integer"
          }
        },
        "required": [
          "object",
          "id",
          "name",
          "livemode",
          "pricing",
          "low_balance_threshold",
          "credits_valid_until",
          "technical_contact_email",
          "rate_limit_per_minute"
        ]
      },
      "Balance": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "balance"
          },
          "livemode": {
            "type": "boolean"
          },
          "available": {
            "type": "integer"
          },
          "held": {
            "type": "integer"
          },
          "expired": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          }
        },
        "required": [
          "object",
          "livemode",
          "available",
          "held",
          "expired",
          "total"
        ]
      },
      "CreditTransaction": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "const": "credit_transaction"
          },
          "livemode": {
            "type": "boolean"
          },
          "type": {
            "type": "string",
            "enum": [
              "top_up",
              "paper_processing",
              "grading",
              "adjustment",
              "expiry"
            ]
          },
          "amount": {
            "type": "integer"
          },
          "balance_after": {
            "type": "integer"
          },
          "pages": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "source": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "object": {
                    "type": "string",
                    "enum": [
                      "paper",
                      "submission"
                    ]
                  },
                  "id": {
                    "type": "string"
                  }
                },
                "required": [
                  "object",
                  "id"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "reference": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "description": {
            "type": "string"
          },
          "created_at": {
            "$ref": "#/components/schemas/Timestamp"
          }
        },
        "required": [
          "id",
          "object",
          "livemode",
          "type",
          "amount",
          "balance_after",
          "pages",
          "source",
          "reference",
          "description",
          "created_at"
        ]
      },
      "CreditTransactionList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreditTransaction"
            }
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "next_cursor"
        ]
      },
      "WebhookEndpoint": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "const": "webhook_endpoint"
          },
          "livemode": {
            "type": "boolean"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "*",
                "paper.awaiting_review",
                "paper.ready",
                "paper.failed",
                "submission.graded",
                "submission.released",
                "submission.failed",
                "credits.balance_low",
                "credits.expiring"
              ]
            }
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "enabled",
              "disabled"
            ]
          },
          "secret": {
            "type": "null"
          },
          "created_at": {
            "$ref": "#/components/schemas/Timestamp"
          }
        },
        "required": [
          "id",
          "object",
          "livemode",
          "url",
          "events",
          "description",
          "status",
          "secret",
          "created_at"
        ]
      },
      "WebhookEndpointWithSecret": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "const": "webhook_endpoint"
          },
          "livemode": {
            "type": "boolean"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "*",
                "paper.awaiting_review",
                "paper.ready",
                "paper.failed",
                "submission.graded",
                "submission.released",
                "submission.failed",
                "credits.balance_low",
                "credits.expiring"
              ]
            }
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "enabled",
              "disabled"
            ]
          },
          "secret": {
            "type": "string"
          },
          "created_at": {
            "$ref": "#/components/schemas/Timestamp"
          }
        },
        "required": [
          "id",
          "object",
          "livemode",
          "url",
          "events",
          "description",
          "status",
          "secret",
          "created_at"
        ]
      },
      "WebhookEndpointList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookEndpoint"
            }
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "next_cursor"
        ]
      },
      "Event": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/PaperAwaitingReviewEvent"
          },
          {
            "$ref": "#/components/schemas/PaperReadyEvent"
          },
          {
            "$ref": "#/components/schemas/PaperFailedEvent"
          },
          {
            "$ref": "#/components/schemas/SubmissionGradedEvent"
          },
          {
            "$ref": "#/components/schemas/SubmissionReleasedEvent"
          },
          {
            "$ref": "#/components/schemas/SubmissionFailedEvent"
          },
          {
            "$ref": "#/components/schemas/CreditsBalanceLowEvent"
          },
          {
            "$ref": "#/components/schemas/CreditsExpiringEvent"
          }
        ]
      },
      "EventList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Event"
            }
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "next_cursor"
        ]
      },
      "PaperAwaitingReviewEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "const": "event"
          },
          "type": {
            "type": "string",
            "const": "paper.awaiting_review"
          },
          "livemode": {
            "type": "boolean"
          },
          "created_at": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "data": {
            "type": "object",
            "properties": {
              "object": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/Paper"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "object": {
                        "type": "string",
                        "const": "paper"
                      },
                      "deleted": {
                        "type": "boolean",
                        "const": true
                      }
                    },
                    "required": [
                      "id",
                      "object",
                      "deleted"
                    ]
                  }
                ]
              }
            },
            "required": [
              "object"
            ]
          }
        },
        "required": [
          "id",
          "object",
          "type",
          "livemode",
          "created_at",
          "data"
        ]
      },
      "PaperReadyEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "const": "event"
          },
          "type": {
            "type": "string",
            "const": "paper.ready"
          },
          "livemode": {
            "type": "boolean"
          },
          "created_at": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "data": {
            "type": "object",
            "properties": {
              "object": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/Paper"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "object": {
                        "type": "string",
                        "const": "paper"
                      },
                      "deleted": {
                        "type": "boolean",
                        "const": true
                      }
                    },
                    "required": [
                      "id",
                      "object",
                      "deleted"
                    ]
                  }
                ]
              }
            },
            "required": [
              "object"
            ]
          }
        },
        "required": [
          "id",
          "object",
          "type",
          "livemode",
          "created_at",
          "data"
        ]
      },
      "PaperFailedEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "const": "event"
          },
          "type": {
            "type": "string",
            "const": "paper.failed"
          },
          "livemode": {
            "type": "boolean"
          },
          "created_at": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "data": {
            "type": "object",
            "properties": {
              "object": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/Paper"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "object": {
                        "type": "string",
                        "const": "paper"
                      },
                      "deleted": {
                        "type": "boolean",
                        "const": true
                      }
                    },
                    "required": [
                      "id",
                      "object",
                      "deleted"
                    ]
                  }
                ]
              }
            },
            "required": [
              "object"
            ]
          }
        },
        "required": [
          "id",
          "object",
          "type",
          "livemode",
          "created_at",
          "data"
        ]
      },
      "SubmissionGradedEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "const": "event"
          },
          "type": {
            "type": "string",
            "const": "submission.graded"
          },
          "livemode": {
            "type": "boolean"
          },
          "created_at": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "data": {
            "type": "object",
            "properties": {
              "object": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/Submission"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "object": {
                        "type": "string",
                        "const": "submission"
                      },
                      "deleted": {
                        "type": "boolean",
                        "const": true
                      }
                    },
                    "required": [
                      "id",
                      "object",
                      "deleted"
                    ]
                  }
                ]
              }
            },
            "required": [
              "object"
            ]
          }
        },
        "required": [
          "id",
          "object",
          "type",
          "livemode",
          "created_at",
          "data"
        ]
      },
      "SubmissionReleasedEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "const": "event"
          },
          "type": {
            "type": "string",
            "const": "submission.released"
          },
          "livemode": {
            "type": "boolean"
          },
          "created_at": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "data": {
            "type": "object",
            "properties": {
              "object": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/Submission"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "object": {
                        "type": "string",
                        "const": "submission"
                      },
                      "deleted": {
                        "type": "boolean",
                        "const": true
                      }
                    },
                    "required": [
                      "id",
                      "object",
                      "deleted"
                    ]
                  }
                ]
              }
            },
            "required": [
              "object"
            ]
          }
        },
        "required": [
          "id",
          "object",
          "type",
          "livemode",
          "created_at",
          "data"
        ]
      },
      "SubmissionFailedEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "const": "event"
          },
          "type": {
            "type": "string",
            "const": "submission.failed"
          },
          "livemode": {
            "type": "boolean"
          },
          "created_at": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "data": {
            "type": "object",
            "properties": {
              "object": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/Submission"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "object": {
                        "type": "string",
                        "const": "submission"
                      },
                      "deleted": {
                        "type": "boolean",
                        "const": true
                      }
                    },
                    "required": [
                      "id",
                      "object",
                      "deleted"
                    ]
                  }
                ]
              }
            },
            "required": [
              "object"
            ]
          }
        },
        "required": [
          "id",
          "object",
          "type",
          "livemode",
          "created_at",
          "data"
        ]
      },
      "CreditsBalanceLowEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "const": "event"
          },
          "type": {
            "type": "string",
            "const": "credits.balance_low"
          },
          "livemode": {
            "type": "boolean"
          },
          "created_at": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "data": {
            "type": "object",
            "properties": {
              "object": {
                "$ref": "#/components/schemas/Balance"
              }
            },
            "required": [
              "object"
            ]
          }
        },
        "required": [
          "id",
          "object",
          "type",
          "livemode",
          "created_at",
          "data"
        ]
      },
      "CreditsExpiringEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "const": "event"
          },
          "type": {
            "type": "string",
            "const": "credits.expiring"
          },
          "livemode": {
            "type": "boolean"
          },
          "created_at": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "data": {
            "type": "object",
            "properties": {
              "object": {
                "$ref": "#/components/schemas/Account"
              }
            },
            "required": [
              "object"
            ]
          }
        },
        "required": [
          "id",
          "object",
          "type",
          "livemode",
          "created_at",
          "data"
        ]
      }
    }
  }
}
