{
  "openapi": "3.1.0",
  "info": {
    "title": "Falling Note API",
    "version": "v1",
    "description": "Sheet music from piano recordings, printed music read from photos and PDFs, and easier versions of a score. Every job is asynchronous: create it, then ask for it until it has finished.",
    "contact": {
      "url": "https://fallingnoteapp.com/developer/docs"
    },
    "termsOfService": "https://fallingnoteapp.com/api-terms"
  },
  "servers": [
    {
      "url": "https://api.fallingnoteapp.com"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "tags": [
    {
      "name": "Transcriptions"
    },
    {
      "name": "Scans"
    },
    {
      "name": "Simplifications"
    },
    {
      "name": "Balance"
    }
  ],
  "paths": {
    "/v1/transcriptions": {
      "post": {
        "operationId": "createTranscription",
        "tags": [
          "Transcriptions"
        ],
        "summary": "Transcribe a recording",
        "description": "One audio file of solo piano becomes a score. The file's content decides its type, not its name. Charged once, at create, by the decoded length: whole seconds, 30 seconds at least.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "contentMediaType": "application/octet-stream",
                    "description": "MP3, M4A, AAC, WAV, FLAC, OGG, Opus, AIFF, CAF, WebM or MP4, with exactly one audio track. Up to 32 MB and 10 minutes; at least 1 second."
                  },
                  "title": {
                    "type": "string",
                    "maxLength": 200,
                    "description": "Written into the score. Absent: the file name, when it reads as a title. Empty: no title."
                  },
                  "composer": {
                    "type": "string",
                    "maxLength": 200
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "202": {
            "$ref": "#/components/responses/TranscriptionAccepted"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "408": {
            "$ref": "#/components/responses/RequestTimeout"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/CreateTooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/transcriptions/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/TranscriptionId"
        }
      ],
      "get": {
        "operationId": "getTranscription",
        "tags": [
          "Transcriptions"
        ],
        "summary": "Get a transcription",
        "responses": {
          "200": {
            "description": "The transcription.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Transcription"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      },
      "delete": {
        "operationId": "deleteTranscription",
        "tags": [
          "Transcriptions"
        ],
        "summary": "Delete a transcription's files",
        "description": "Erases the recording and the results now. The job's billing record stays. Only a finished job can be deleted.",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Deleted"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/transcriptions/{id}/content": {
      "parameters": [
        {
          "$ref": "#/components/parameters/TranscriptionId"
        }
      ],
      "get": {
        "operationId": "downloadTranscription",
        "tags": [
          "Transcriptions"
        ],
        "summary": "Download a transcription",
        "parameters": [
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "mxl",
                "musicxml",
                "midi"
              ],
              "default": "mxl"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file. Send the same Authorization header.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Content-Disposition": {
                "$ref": "#/components/headers/ContentDisposition"
              },
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            },
            "content": {
              "application/vnd.recordare.musicxml": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "application/vnd.recordare.musicxml"
                }
              },
              "application/vnd.recordare.musicxml+xml": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "application/vnd.recordare.musicxml+xml"
                }
              },
              "audio/midi": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "audio/midi"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/scans": {
      "post": {
        "operationId": "createScan",
        "tags": [
          "Scans"
        ],
        "summary": "Read printed music",
        "description": "One PDF, or 1 to 10 images in reading order, become a score. Repeat the file field for each image. Charged once, at create, by the page. Pages that couldn't be read are refunded.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 10,
                    "items": {
                      "type": "string",
                      "contentMediaType": "application/octet-stream"
                    },
                    "description": "One PDF, or 1 to 10 images (JPEG, PNG, WebP, TIFF, BMP, HEIC), up to 40 MB together and 50 megapixels an image."
                  },
                  "title": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "composer": {
                    "type": "string",
                    "maxLength": 200
                  }
                },
                "additionalProperties": false
              },
              "encoding": {
                "file": {
                  "style": "form",
                  "explode": true
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "$ref": "#/components/responses/ScanAccepted"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "408": {
            "$ref": "#/components/responses/RequestTimeout"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/CreateTooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/scans/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ScanId"
        }
      ],
      "get": {
        "operationId": "getScan",
        "tags": [
          "Scans"
        ],
        "summary": "Get a scan",
        "responses": {
          "200": {
            "description": "The scan.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Scan"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      },
      "delete": {
        "operationId": "deleteScan",
        "tags": [
          "Scans"
        ],
        "summary": "Delete a scan's files",
        "description": "Erases the pages and the results now. The job's billing record stays. Only a finished job can be deleted.",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Deleted"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/scans/{id}/content": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ScanId"
        }
      ],
      "get": {
        "operationId": "downloadScan",
        "tags": [
          "Scans"
        ],
        "summary": "Download a scan",
        "parameters": [
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "mxl",
                "musicxml"
              ],
              "default": "mxl"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file. Send the same Authorization header.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Content-Disposition": {
                "$ref": "#/components/headers/ContentDisposition"
              },
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            },
            "content": {
              "application/vnd.recordare.musicxml": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "application/vnd.recordare.musicxml"
                }
              },
              "application/vnd.recordare.musicxml+xml": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "application/vnd.recordare.musicxml+xml"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/simplifications": {
      "post": {
        "operationId": "createSimplification",
        "tags": [
          "Simplifications"
        ],
        "summary": "Make easier versions of a score",
        "description": "A MusicXML score, or one of your transcriptions, becomes an Easy and/or a Medium version. Charged once, at create, by the version. A version that couldn't be made is refunded.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "contentMediaType": "application/octet-stream",
                    "description": "A MusicXML file (.musicxml, .xml or .mxl) with one or two piano parts, up to 15 MB, 400 measures and 20,000 notes. Send this or transcription_id."
                  },
                  "transcription_id": {
                    "type": "string",
                    "pattern": "^trn_[0-9A-Za-z]{24}$",
                    "description": "One of your succeeded transcriptions, before its expires_at. Send this or file."
                  },
                  "levels": {
                    "type": "string",
                    "enum": [
                      "easy",
                      "medium",
                      "easy,medium"
                    ],
                    "default": "easy",
                    "description": "Comma-separated; order and repeats are ignored."
                  },
                  "title": {
                    "type": "string",
                    "maxLength": 200,
                    "description": "Absent: the score's own title, or the transcription's."
                  },
                  "composer": {
                    "type": "string",
                    "maxLength": 200
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "202": {
            "$ref": "#/components/responses/SimplificationAccepted"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "408": {
            "$ref": "#/components/responses/RequestTimeout"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/CreateTooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/simplifications/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/SimplificationId"
        }
      ],
      "get": {
        "operationId": "getSimplification",
        "tags": [
          "Simplifications"
        ],
        "summary": "Get a simplification",
        "responses": {
          "200": {
            "description": "The simplification.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Simplification"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      },
      "delete": {
        "operationId": "deleteSimplification",
        "tags": [
          "Simplifications"
        ],
        "summary": "Delete a simplification's files",
        "description": "Erases the score and the versions now. The job's billing record stays. Only a finished job can be deleted.",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Deleted"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/simplifications/{id}/content": {
      "parameters": [
        {
          "$ref": "#/components/parameters/SimplificationId"
        }
      ],
      "get": {
        "operationId": "downloadSimplification",
        "tags": [
          "Simplifications"
        ],
        "summary": "Download a version",
        "parameters": [
          {
            "name": "level",
            "in": "query",
            "required": false,
            "description": "Required unless exactly one version was made.",
            "schema": {
              "type": "string",
              "enum": [
                "easy",
                "medium"
              ]
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "mxl",
                "musicxml"
              ],
              "default": "mxl"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file. Send the same Authorization header.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Content-Disposition": {
                "$ref": "#/components/headers/ContentDisposition"
              },
              "ETag": {
                "$ref": "#/components/headers/ETag"
              }
            },
            "content": {
              "application/vnd.recordare.musicxml": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "application/vnd.recordare.musicxml"
                }
              },
              "application/vnd.recordare.musicxml+xml": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "application/vnd.recordare.musicxml+xml"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "410": {
            "$ref": "#/components/responses/Gone"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/balance": {
      "get": {
        "operationId": "getBalance",
        "tags": [
          "Balance"
        ],
        "summary": "Get the API balance",
        "description": "The prepaid API balance in US dollars. It is not the app's credits.",
        "responses": {
          "200": {
            "description": "The balance.",
            "headers": {
              "x-request-id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Balance"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Authorization: Bearer followed by your secret key, which starts with fn_sk_. Make keys at https://fallingnoteapp.com/developer/api-keys."
      }
    },
    "parameters": {
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "description": "Send the same key to retry a create safely: within 24 hours the same request returns the same job, charged once.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255,
          "pattern": "^[\\x21-\\x7E]{1,255}$"
        }
      },
      "TranscriptionId": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^trn_[0-9A-Za-z]{24}$"
        }
      },
      "ScanId": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^scn_[0-9A-Za-z]{24}$"
        }
      },
      "SimplificationId": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^smp_[0-9A-Za-z]{24}$"
        }
      }
    },
    "headers": {
      "RequestId": {
        "description": "The request's id, the same as error.request_id.",
        "schema": {
          "type": "string",
          "pattern": "^req_[0-9A-Za-z]{24}$"
        }
      },
      "Location": {
        "description": "The job's URL.",
        "schema": {
          "type": "string",
          "format": "uri"
        }
      },
      "RetryAfter": {
        "description": "Seconds to wait before trying again.",
        "schema": {
          "type": "integer",
          "minimum": 0
        }
      },
      "IdempotentReplayed": {
        "description": "true when this answer replays an earlier request with the same Idempotency-Key.",
        "schema": {
          "type": "string",
          "enum": [
            "true"
          ]
        }
      },
      "RateLimitLimit": {
        "description": "Jobs the account may create a minute.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimitRemaining": {
        "description": "Jobs left in this UTC minute.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimitReset": {
        "description": "Unix time, in seconds, when the minute ends.",
        "schema": {
          "type": "integer"
        }
      },
      "WWWAuthenticate": {
        "schema": {
          "type": "string",
          "enum": [
            "Bearer"
          ]
        }
      },
      "Allow": {
        "schema": {
          "type": "string"
        }
      },
      "ContentDisposition": {
        "schema": {
          "type": "string"
        }
      },
      "ETag": {
        "description": "The file's SHA-256, quoted.",
        "schema": {
          "type": "string",
          "pattern": "^\"[0-9a-f]{64}\"$"
        }
      }
    },
    "responses": {
      "TranscriptionAccepted": {
        "description": "Accepted and charged. Ask for the job until it has finished.",
        "headers": {
          "Location": {
            "$ref": "#/components/headers/Location"
          },
          "x-request-id": {
            "$ref": "#/components/headers/RequestId"
          },
          "Idempotent-Replayed": {
            "$ref": "#/components/headers/IdempotentReplayed"
          },
          "x-ratelimit-limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "x-ratelimit-remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "x-ratelimit-reset": {
            "$ref": "#/components/headers/RateLimitReset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Transcription"
            }
          }
        }
      },
      "ScanAccepted": {
        "description": "Accepted and charged. Ask for the job until it has finished.",
        "headers": {
          "Location": {
            "$ref": "#/components/headers/Location"
          },
          "x-request-id": {
            "$ref": "#/components/headers/RequestId"
          },
          "Idempotent-Replayed": {
            "$ref": "#/components/headers/IdempotentReplayed"
          },
          "x-ratelimit-limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "x-ratelimit-remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "x-ratelimit-reset": {
            "$ref": "#/components/headers/RateLimitReset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Scan"
            }
          }
        }
      },
      "SimplificationAccepted": {
        "description": "Accepted and charged. Ask for the job until it has finished.",
        "headers": {
          "Location": {
            "$ref": "#/components/headers/Location"
          },
          "x-request-id": {
            "$ref": "#/components/headers/RequestId"
          },
          "Idempotent-Replayed": {
            "$ref": "#/components/headers/IdempotentReplayed"
          },
          "x-ratelimit-limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "x-ratelimit-remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "x-ratelimit-reset": {
            "$ref": "#/components/headers/RateLimitReset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Simplification"
            }
          }
        }
      },
      "Deleted": {
        "description": "The files are erased.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Deleted"
            }
          }
        }
      },
      "BadRequest": {
        "description": "invalid_parameter, missing_file, empty_file, too_many_files, mixed_file_types, invalid_idempotency_key or api_key_in_url.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "missing_api_key or invalid_api_key.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestId"
          },
          "WWW-Authenticate": {
            "$ref": "#/components/headers/WWWAuthenticate"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "PaymentRequired": {
        "description": "insufficient_balance: the error carries required and available.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden": {
        "description": "account_suspended, account_frozen, https_required or browser_requests_not_supported.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "not_found.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "MethodNotAllowed": {
        "description": "method_not_allowed.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestId"
          },
          "Allow": {
            "$ref": "#/components/headers/Allow"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "RequestTimeout": {
        "description": "upload_timeout.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Conflict": {
        "description": "job_not_finished or job_failed.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Gone": {
        "description": "output_expired.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "LengthRequired": {
        "description": "length_required.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "PayloadTooLarge": {
        "description": "file_too_large, audio_too_long, too_many_pages, image_too_large or score_too_long.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "UnsupportedMediaType": {
        "description": "invalid_content_type or unsupported_file_type.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unprocessable": {
        "description": "unreadable_file, encrypted_pdf, audio_too_short, silent_audio, unsupported_score or idempotency_key_reused.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "rate_limited.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestId"
          },
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "CreateTooManyRequests": {
        "description": "rate_limited, too_many_active_jobs or too_many_failed_jobs.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestId"
          },
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          },
          "x-ratelimit-limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "x-ratelimit-remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "x-ratelimit-reset": {
            "$ref": "#/components/headers/RateLimitReset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "InternalError": {
        "description": "internal_error.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unavailable": {
        "description": "service_unavailable or overloaded.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestId"
          },
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "Status": {
        "type": "string",
        "enum": [
          "queued",
          "processing",
          "succeeded",
          "failed"
        ]
      },
      "Money": {
        "type": "string",
        "pattern": "^-?\\d+\\.\\d{6}$",
        "description": "US dollars, exactly 6 decimals.",
        "examples": [
          "0.403334"
        ]
      },
      "JobError": {
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "string",
            "examples": [
              "unreadable_audio",
              "no_notes_found",
              "no_beat_found",
              "not_writable",
              "unreadable_pages",
              "no_music_found",
              "timed_out",
              "cancelled",
              "internal_error",
              "unreadable_score",
              "not_simplified"
            ]
          },
          "message": {
            "type": "string"
          }
        }
      },
      "Transcription": {
        "type": "object",
        "required": [
          "id",
          "object",
          "status",
          "created_at",
          "started_at",
          "completed_at",
          "expires_at",
          "title",
          "composer",
          "input",
          "usage",
          "result",
          "outputs",
          "engine_version",
          "error"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^trn_[0-9A-Za-z]{24}$"
          },
          "object": {
            "const": "transcription"
          },
          "status": {
            "$ref": "#/components/schemas/Status"
          },
          "created_at": {
            "type": "integer"
          },
          "started_at": {
            "type": [
              "integer",
              "null"
            ]
          },
          "completed_at": {
            "type": [
              "integer",
              "null"
            ]
          },
          "expires_at": {
            "type": [
              "integer",
              "null"
            ],
            "description": "completed_at + 7 days when succeeded. From then the files are gone."
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "composer": {
            "type": [
              "string",
              "null"
            ]
          },
          "input": {
            "type": "object",
            "required": [
              "filename",
              "bytes",
              "format",
              "duration_seconds"
            ],
            "properties": {
              "filename": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 255
              },
              "bytes": {
                "type": "integer"
              },
              "format": {
                "type": "string",
                "enum": [
                  "mp3",
                  "wav",
                  "flac",
                  "ogg",
                  "opus",
                  "mp4",
                  "m4a",
                  "webm",
                  "aiff",
                  "aac",
                  "caf"
                ]
              },
              "duration_seconds": {
                "type": "number",
                "description": "The decoded length, 3 decimals."
              }
            }
          },
          "usage": {
            "type": "object",
            "required": [
              "billed_seconds",
              "cost"
            ],
            "properties": {
              "billed_seconds": {
                "type": "integer",
                "minimum": 30
              },
              "cost": {
                "$ref": "#/components/schemas/Money"
              }
            }
          },
          "result": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "required": [
                  "measures",
                  "notes"
                ],
                "properties": {
                  "measures": {
                    "type": "integer"
                  },
                  "notes": {
                    "type": "integer"
                  }
                }
              }
            ]
          },
          "outputs": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "required": [
                  "mxl",
                  "musicxml",
                  "midi"
                ],
                "properties": {
                  "mxl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "musicxml": {
                    "type": "string",
                    "format": "uri"
                  },
                  "midi": {
                    "type": "string",
                    "format": "uri"
                  }
                }
              }
            ]
          },
          "engine_version": {
            "type": "string"
          },
          "error": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/JobError"
              }
            ]
          }
        }
      },
      "Scan": {
        "type": "object",
        "required": [
          "id",
          "object",
          "status",
          "created_at",
          "started_at",
          "completed_at",
          "expires_at",
          "title",
          "composer",
          "input",
          "usage",
          "result",
          "outputs",
          "engine_version",
          "error"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^scn_[0-9A-Za-z]{24}$"
          },
          "object": {
            "const": "scan"
          },
          "status": {
            "$ref": "#/components/schemas/Status"
          },
          "created_at": {
            "type": "integer"
          },
          "started_at": {
            "type": [
              "integer",
              "null"
            ]
          },
          "completed_at": {
            "type": [
              "integer",
              "null"
            ]
          },
          "expires_at": {
            "type": [
              "integer",
              "null"
            ]
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "composer": {
            "type": [
              "string",
              "null"
            ]
          },
          "input": {
            "type": "object",
            "required": [
              "files",
              "bytes",
              "format",
              "pages"
            ],
            "properties": {
              "files": {
                "type": "integer"
              },
              "bytes": {
                "type": "integer"
              },
              "format": {
                "type": "string",
                "enum": [
                  "pdf",
                  "images"
                ]
              },
              "pages": {
                "type": "integer"
              }
            }
          },
          "usage": {
            "type": "object",
            "required": [
              "pages",
              "cost"
            ],
            "properties": {
              "pages": {
                "type": "integer"
              },
              "cost": {
                "$ref": "#/components/schemas/Money"
              }
            }
          },
          "result": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "required": [
                  "pages_read",
                  "failed_pages",
                  "truncated_pages",
                  "measures",
                  "notes"
                ],
                "properties": {
                  "pages_read": {
                    "type": "integer"
                  },
                  "failed_pages": {
                    "type": "integer",
                    "description": "Pages that couldn't be read. Refunded."
                  },
                  "truncated_pages": {
                    "type": "integer",
                    "description": "Pages whose reading stopped at the length limit. Charged; the page's end may be missing."
                  },
                  "measures": {
                    "type": "integer"
                  },
                  "notes": {
                    "type": "integer"
                  }
                }
              }
            ]
          },
          "outputs": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "required": [
                  "mxl",
                  "musicxml"
                ],
                "properties": {
                  "mxl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "musicxml": {
                    "type": "string",
                    "format": "uri"
                  }
                }
              }
            ]
          },
          "engine_version": {
            "type": "string"
          },
          "error": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/JobError"
              }
            ]
          }
        }
      },
      "Simplification": {
        "type": "object",
        "required": [
          "id",
          "object",
          "status",
          "created_at",
          "started_at",
          "completed_at",
          "expires_at",
          "title",
          "composer",
          "input",
          "usage",
          "result",
          "outputs",
          "engine_version",
          "error"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^smp_[0-9A-Za-z]{24}$"
          },
          "object": {
            "const": "simplification"
          },
          "status": {
            "$ref": "#/components/schemas/Status"
          },
          "created_at": {
            "type": "integer"
          },
          "started_at": {
            "type": [
              "integer",
              "null"
            ]
          },
          "completed_at": {
            "type": [
              "integer",
              "null"
            ]
          },
          "expires_at": {
            "type": [
              "integer",
              "null"
            ]
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "composer": {
            "type": [
              "string",
              "null"
            ]
          },
          "input": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "type",
                  "filename",
                  "bytes",
                  "format",
                  "parts",
                  "measures",
                  "levels"
                ],
                "properties": {
                  "type": {
                    "const": "file"
                  },
                  "filename": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 255
                  },
                  "bytes": {
                    "type": "integer"
                  },
                  "format": {
                    "type": "string",
                    "enum": [
                      "musicxml",
                      "mxl"
                    ]
                  },
                  "parts": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 2
                  },
                  "measures": {
                    "type": "integer"
                  },
                  "levels": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 2,
                    "items": {
                      "type": "string",
                      "enum": [
                        "easy",
                        "medium"
                      ]
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "type",
                  "transcription_id",
                  "measures",
                  "levels"
                ],
                "properties": {
                  "type": {
                    "const": "transcription"
                  },
                  "transcription_id": {
                    "type": "string",
                    "pattern": "^trn_[0-9A-Za-z]{24}$"
                  },
                  "measures": {
                    "type": "integer"
                  },
                  "levels": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 2,
                    "items": {
                      "type": "string",
                      "enum": [
                        "easy",
                        "medium"
                      ]
                    }
                  }
                }
              }
            ]
          },
          "usage": {
            "type": "object",
            "required": [
              "versions",
              "cost"
            ],
            "properties": {
              "versions": {
                "type": "integer",
                "minimum": 1,
                "maximum": 2
              },
              "cost": {
                "$ref": "#/components/schemas/Money"
              }
            }
          },
          "result": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "required": [
                  "levels"
                ],
                "properties": {
                  "levels": {
                    "type": "object",
                    "minProperties": 1,
                    "properties": {
                      "easy": {
                        "$ref": "#/components/schemas/SimplificationLevel"
                      },
                      "medium": {
                        "$ref": "#/components/schemas/SimplificationLevel"
                      }
                    }
                  }
                }
              }
            ]
          },
          "outputs": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "properties": {
                  "easy": {
                    "$ref": "#/components/schemas/SimplificationFiles"
                  },
                  "medium": {
                    "$ref": "#/components/schemas/SimplificationFiles"
                  }
                }
              }
            ]
          },
          "engine_version": {
            "type": "string"
          },
          "error": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/JobError"
              }
            ]
          }
        }
      },
      "SimplificationLevel": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "status",
              "measures",
              "notes"
            ],
            "properties": {
              "status": {
                "const": "succeeded"
              },
              "measures": {
                "type": "integer"
              },
              "notes": {
                "type": "integer"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "status",
              "error"
            ],
            "properties": {
              "status": {
                "const": "failed"
              },
              "error": {
                "$ref": "#/components/schemas/JobError"
              }
            }
          }
        ]
      },
      "SimplificationFiles": {
        "type": "object",
        "required": [
          "mxl",
          "musicxml"
        ],
        "properties": {
          "mxl": {
            "type": "string",
            "format": "uri"
          },
          "musicxml": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "Balance": {
        "type": "object",
        "required": [
          "object",
          "currency",
          "available"
        ],
        "properties": {
          "object": {
            "const": "balance"
          },
          "currency": {
            "const": "usd"
          },
          "available": {
            "$ref": "#/components/schemas/Money"
          }
        }
      },
      "Deleted": {
        "type": "object",
        "required": [
          "id",
          "object",
          "deleted"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^(trn|scn|smp)_[0-9A-Za-z]{24}$"
          },
          "object": {
            "type": "string",
            "enum": [
              "transcription",
              "scan",
              "simplification"
            ]
          },
          "deleted": {
            "const": true
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "type",
              "code",
              "message",
              "param",
              "request_id"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "invalid_request_error",
                  "authentication_error",
                  "billing_error",
                  "permission_error",
                  "not_found_error",
                  "conflict_error",
                  "rate_limit_error",
                  "api_error"
                ]
              },
              "code": {
                "type": "string",
                "description": "Stable. New codes may be added: fall back on type and the status.",
                "examples": [
                  "missing_file",
                  "empty_file",
                  "too_many_files",
                  "mixed_file_types",
                  "invalid_parameter",
                  "invalid_idempotency_key",
                  "api_key_in_url",
                  "missing_api_key",
                  "invalid_api_key",
                  "insufficient_balance",
                  "account_suspended",
                  "account_frozen",
                  "https_required",
                  "browser_requests_not_supported",
                  "not_found",
                  "method_not_allowed",
                  "upload_timeout",
                  "job_not_finished",
                  "job_failed",
                  "output_expired",
                  "length_required",
                  "file_too_large",
                  "audio_too_long",
                  "too_many_pages",
                  "image_too_large",
                  "invalid_content_type",
                  "unsupported_file_type",
                  "unreadable_file",
                  "encrypted_pdf",
                  "audio_too_short",
                  "silent_audio",
                  "idempotency_key_reused",
                  "rate_limited",
                  "too_many_active_jobs",
                  "too_many_failed_jobs",
                  "internal_error",
                  "service_unavailable",
                  "overloaded",
                  "score_too_long",
                  "unsupported_score"
                ]
              },
              "message": {
                "type": "string",
                "description": "One sentence that says what to do next."
              },
              "param": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The field at fault."
              },
              "request_id": {
                "type": "string",
                "pattern": "^req_[0-9A-Za-z]{24}$"
              },
              "required": {
                "$ref": "#/components/schemas/Money"
              },
              "available": {
                "$ref": "#/components/schemas/Money"
              }
            }
          }
        }
      }
    }
  }
}
