Creating a Deploy with the API

I’m using the API for creating a deploy, and I keep getting a 404.
This is a link to the docs
https://docs.sentry.io/api/releases/post-release-deploys/

In the following code, I’m able to create a new release for a project but when I then try to create a deploy, I get a 404:

import requests
from utils.api_utils import HOST_URL, ORGANIZATION_SLUG, GITHUB_ORG_STR, HEADERS

def deploy_release(project, version, release_tag):

    req_session = requests.Session()

        # This block succeeds with a status code 201
        payload1 = {
            'version': version,
            'ref': release_tag,
            'url': 'https://github.com/' + GITHUB_ORG_STR + '/widget/commit/' + version
        }
        post_args1 = {'headers': HEADERS, 'data': payload1}
        request_url1 = HOST_URL + 'projects/' + ORGANIZATION_SLUG + '/' + project + '/releases/'
        response1 = req_session.post(request_url1, **post_args1)

        # This block fails with a status code 404
        payload2 = {
            'environment': 'staging'
        }
        post_args2 = {'headers': HEADERS, 'data': payload2}
        request_url2 = HOST_URL + 'organizations/' + ORGANIZATION_SLUG + '/releases/' + version + '/deploys/'
        response2 = req_session.post(request_url2, **post_args2)

        print 'request_url1: ' + request_url1
        print 'response1.status_code: ' + str(response1.status_code)
        print 'request_url2: ' + request_url2
        print 'response2.status_code: ' + str(response2.status_code)

deploy_release('widget', 'deadbeef0102deadbeef0304deadbeef05060708', 'v3.4.5')

This was answered here, but in case others are looking, this endpoint was added in 8.15.