Config not parsed correctly when using the API to trigger build

Config file:

version: 2

    - image: circleci/ruby:2.4.9-node-browsers
      - checkout
      - run: echo "Running tests"

  version: 2
      - run_tests

This seems to work if I push a commit to github, but if I use the circleci api it fails. I have a feeling this may be a bug in the API, because it triggers the same commit to be built, and comes up with the following error:

Build-agent version 1.0.39420-c361fae8 (2020-09-09T11:04:48+0000)

Configuration errors: 1 error occurred:

* Cannot find a job named `build` to run in the `jobs:` section of your configuration file.
If you expected a workflow to run, check your config contains a top-level key called 'workflows:'

Before asked I have already attempted to raise this with CircleCI directly but I have not received a response.

Hi @abepetrillo! When you says contacted CircleCI directly, does this mean you filed a support ticket? I’m asking so I can check on the status for you.