Music Scale Tool API

Welcome to the developer documentation for the Music Scale Tool backend. All endpoints are prefixed with /api. Unless otherwise stated, responses are JSON (UTF‑8).

Pitches

Method Path Description Query Params
GET /pitches/names List all pitch names (C, C#, Db, …)
GET /pitches/octaves List available octaves (0‑6)
GET /pitches/midi Convert pitch + octave to MIDI number pitch (string)
octave (int 0‑6)
GET /pitches/midi/pitch Convert MIDI number to pitch midi (int 0‑127)

Example

curl -X GET "https://musicscaletool.com/api/pitches/midi?pitch=C#&octave=4"
{{
    "pitch": "C#",
    "octave": 4,
    "midi": 61
  }}

Scales

Method Path Description Parameters
POST /scales/create Create a scale and return MusicXML JSON body (see below)
GET /scales/names List scale names type (optional)
GET /scales/types List available scale types

POST /scales/create

Content‑Type: application/json. The response is text/xml (MusicXML).


  {{
    "scaleTypeId": 1,
    "startPitch": {{
      "name": "C",
      "octave": 4
    }},
    "timeMeasure": {{
      "beats": 4,
      "beatType": 4
    }}
  }}
    

Example (cURL)


  curl -X POST https://musicscaletool.com/api/scales/create \
      -H "Content-Type: application/json" \
      -d '{{
        "scaleTypeId": 1,
        "startPitch": {{ "name": "C", "octave": 4 }},
        "timeMeasure": {{ "beats": 4, "beatType": 4 }}
      }}'
    

Time Signature

Method Path Description Parameters
GET /time-signature/beats List common numbers of beats
GET /time-signature/beats/types List beat types (denominators)

Example

curl -X GET "https://musicscaletool.com/api/time-signature/beats"

Error Handling

Invalid requests return errors in the following format with an appropriate HTTP status code:

{{
    "error": "Detailed message here"
  }}

Status Codes