{
 "components": {
  "schemas": {
   "CreateScanRequest": {
    "properties": {
     "files": {
      "anyOf": [
       {
        "items": {
         "contentMediaType": "application/octet-stream",
         "type": "string"
        },
        "type": "array"
       },
       {
        "type": "null"
       }
      ],
      "title": "Files"
     },
     "options": {
      "default": "{}",
      "title": "Options",
      "type": "string"
     }
    },
    "title": "CreateScanRequest",
    "type": "object"
   },
   "DevBalanceOut": {
    "properties": {
     "pages": {
      "title": "Pages",
      "type": "integer"
     }
    },
    "required": [
     "pages"
    ],
    "title": "DevBalanceOut",
    "type": "object"
   },
   "DevScanCancelOut": {
    "properties": {
     "id": {
      "title": "Id",
      "type": "string"
     },
     "status": {
      "const": "canceled",
      "title": "Status",
      "type": "string"
     }
    },
    "required": [
     "id",
     "status"
    ],
    "title": "DevScanCancelOut",
    "type": "object"
   },
   "DevScanCreateOut": {
    "properties": {
     "deduplicated": {
      "default": false,
      "title": "Deduplicated",
      "type": "boolean"
     },
     "id": {
      "title": "Id",
      "type": "string"
     },
     "pages": {
      "title": "Pages",
      "type": "integer"
     },
     "status": {
      "enum": [
       "queued",
       "processing",
       "done",
       "failed",
       "canceled"
      ],
      "title": "Status",
      "type": "string"
     }
    },
    "required": [
     "id",
     "status",
     "pages"
    ],
    "title": "DevScanCreateOut",
    "type": "object"
   },
   "DevScanStatusOut": {
    "properties": {
     "chargedPages": {
      "anyOf": [
       {
        "type": "integer"
       },
       {
        "type": "null"
       }
      ],
      "title": "Chargedpages"
     },
     "error": {
      "anyOf": [
       {
        "type": "string"
       },
       {
        "type": "null"
       }
      ],
      "title": "Error"
     },
     "etaSeconds": {
      "title": "Etaseconds",
      "type": "integer"
     },
     "id": {
      "title": "Id",
      "type": "string"
     },
     "pages": {
      "title": "Pages",
      "type": "integer"
     },
     "progress": {
      "title": "Progress",
      "type": "integer"
     },
     "queuePosition": {
      "title": "Queueposition",
      "type": "integer"
     },
     "status": {
      "enum": [
       "queued",
       "processing",
       "done",
       "failed",
       "canceled"
      ],
      "title": "Status",
      "type": "string"
     }
    },
    "required": [
     "id",
     "status",
     "progress",
     "pages",
     "chargedPages",
     "error",
     "queuePosition",
     "etaSeconds"
    ],
    "title": "DevScanStatusOut",
    "type": "object"
   },
   "Error": {
    "additionalProperties": true,
    "properties": {
     "code": {
      "description": "Stable machine-readable error code.",
      "type": "string"
     },
     "message": {
      "type": "string"
     }
    },
    "required": [
     "code",
     "message"
    ],
    "title": "Error",
    "type": "object"
   }
  },
  "securitySchemes": {
   "bearerAuth": {
    "description": "API key: ps_live_...",
    "scheme": "bearer",
    "type": "http"
   }
  }
 },
 "info": {
  "title": "PlayScan Developer API",
  "version": "1.0.0"
 },
 "openapi": "3.1.0",
 "paths": {
  "/v1/balance": {
   "get": {
    "operationId": "balance",
    "responses": {
     "200": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/DevBalanceOut"
        }
       }
      },
      "description": "Successful Response",
      "headers": {
       "X-Balance-Pages": {
        "description": "Pages left on the account balance after this request.",
        "schema": {
         "type": "integer"
        }
       }
      }
     },
     "401": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Missing, malformed or revoked API key."
     },
     "402": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Account blocked or not enough pages on the balance."
     },
     "429": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Too many active scans or rate limit exceeded."
     },
     "500": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Unexpected server error (code internal_error); retry shortly."
     },
     "503": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Service busy, retry shortly."
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "summary": "Balance",
    "tags": [
     "balance"
    ]
   }
  },
  "/v1/scans": {
   "post": {
    "operationId": "create_scan",
    "requestBody": {
     "content": {
      "multipart/form-data": {
       "schema": {
        "$ref": "#/components/schemas/CreateScanRequest"
       }
      }
     }
    },
    "responses": {
     "202": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/DevScanCreateOut"
        }
       }
      },
      "description": "Successful Response",
      "headers": {
       "X-Balance-Pages": {
        "description": "Pages left on the account balance after this request.",
        "schema": {
         "type": "integer"
        }
       }
      }
     },
     "401": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Missing, malformed or revoked API key."
     },
     "402": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Account blocked or not enough pages on the balance."
     },
     "422": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Invalid request (see code)."
     },
     "429": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Too many active scans or rate limit exceeded."
     },
     "500": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Unexpected server error (code internal_error); retry shortly."
     },
     "503": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Service busy, retry shortly."
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "summary": "Create Scan",
    "tags": [
     "scans"
    ]
   }
  },
  "/v1/scans/{scan_id}": {
   "delete": {
    "operationId": "cancel_scan",
    "parameters": [
     {
      "in": "path",
      "name": "scan_id",
      "required": true,
      "schema": {
       "title": "Scan Id",
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/DevScanCancelOut"
        }
       }
      },
      "description": "Successful Response",
      "headers": {
       "X-Balance-Pages": {
        "description": "Pages left on the account balance after this request.",
        "schema": {
         "type": "integer"
        }
       }
      }
     },
     "401": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Missing, malformed or revoked API key."
     },
     "402": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Account blocked or not enough pages on the balance."
     },
     "404": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Scan not found, or it has no music output."
     },
     "409": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Scan not ready, already processing or already finished."
     },
     "429": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Too many active scans or rate limit exceeded."
     },
     "500": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Unexpected server error (code internal_error); retry shortly."
     },
     "503": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Service busy, retry shortly."
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "summary": "Cancel Scan",
    "tags": [
     "scans"
    ]
   },
   "get": {
    "operationId": "scan_status",
    "parameters": [
     {
      "in": "path",
      "name": "scan_id",
      "required": true,
      "schema": {
       "title": "Scan Id",
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/DevScanStatusOut"
        }
       }
      },
      "description": "Successful Response",
      "headers": {
       "X-Balance-Pages": {
        "description": "Pages left on the account balance after this request.",
        "schema": {
         "type": "integer"
        }
       }
      }
     },
     "401": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Missing, malformed or revoked API key."
     },
     "402": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Account blocked or not enough pages on the balance."
     },
     "404": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Scan not found, or it has no music output."
     },
     "429": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Too many active scans or rate limit exceeded."
     },
     "500": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Unexpected server error (code internal_error); retry shortly."
     },
     "503": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Service busy, retry shortly."
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "summary": "Scan Status",
    "tags": [
     "scans"
    ]
   }
  },
  "/v1/scans/{scan_id}/result": {
   "get": {
    "operationId": "scan_result",
    "parameters": [
     {
      "in": "path",
      "name": "scan_id",
      "required": true,
      "schema": {
       "title": "Scan Id",
       "type": "string"
      }
     },
     {
      "in": "query",
      "name": "format",
      "required": false,
      "schema": {
       "default": "musicxml",
       "title": "Format",
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "content": {
       "application/vnd.recordare.musicxml": {
        "schema": {
         "format": "binary",
         "type": "string"
        }
       },
       "application/vnd.recordare.musicxml+xml": {
        "schema": {
         "format": "binary",
         "type": "string"
        }
       },
       "application/zip": {
        "schema": {
         "format": "binary",
         "type": "string"
        }
       },
       "audio/midi": {
        "schema": {
         "format": "binary",
         "type": "string"
        }
       }
      },
      "description": "The result file.",
      "headers": {
       "X-Balance-Pages": {
        "description": "Pages left on the account balance after this request.",
        "schema": {
         "type": "integer"
        }
       }
      }
     },
     "401": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Missing, malformed or revoked API key."
     },
     "402": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Account blocked or not enough pages on the balance."
     },
     "404": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Scan not found, or it has no music output."
     },
     "409": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Scan not ready, already processing or already finished."
     },
     "410": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Result expired (deleted after 24 hours)."
     },
     "422": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Invalid request (see code)."
     },
     "429": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Too many active scans or rate limit exceeded."
     },
     "500": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Unexpected server error (code internal_error); retry shortly."
     },
     "503": {
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "description": "Service busy, retry shortly."
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "summary": "Scan Result",
    "tags": [
     "scans"
    ]
   }
  }
 },
 "security": [
  {
   "bearerAuth": []
  }
 ],
 "servers": [
  {
   "url": "https://api.playscan.app"
  }
 ]
}
