Create a New Release for an Organization

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

I’m able to create a new release for a project following these docs
https://docs.sentry.io/api/releases/post-project-releases/

This is my python code:

import requests

from utils.api_utils import HOST_URL, ORGANIZATION_SLUG, HEADERS

def create_releases(project, hash, release_tag):

    req_session = requests.Session()

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

    # This block succeeds with a status code 201
    payload2 = {
        'version': hash,
        'ref': release_tag,
        'url': 'https://github.com/sightmachine/ma/commit/' + hash
    }
    post_args2 = {'headers': HEADERS, 'data': payload2}
    request_url2 = HOST_URL + 'projects/' + ORGANIZATION_SLUG + '/' + project + '/releases/'
    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)

create_releases('ma-stage2', 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef', 'v1.2.3')

Are you using Sentry on premise? And if so, what version are you using?

Hi jess,
I believe the answer to your first question is yes.
The answer to your second question is 8.12.0

That endpoint wasn’t added until 8.14 (see change list). We also fixed a bug where API keys weren’t working for that endpoint, which will be included in 8.15, so if you want to upgrade, it might be worth waiting until we tag that release.

Thanks jess,
I just looked at the change list, and I didn’t see any mention of the endpoint for Create a Deploy (https://docs.sentry.io/api/releases/post-release-deploys/). That one isn’t working for me either. Is that because it will only work for releases that were created specifically with this endpoint – or is that a separate issue?

That endpoint was added in 8.15 (sorry I have a pr up for our changes). That release should be tagged shortly. If you upgrade, it would work for any existing releases, not just ones created from the new releases endpoint.

Sorry for the redundancy but I created a separate topic this morning about creating a deploy.
From the change list, it appears that 8.15 is released. I’ll ask my team to upgrade.
Thanks