# Management API role delete returns 200

**URL:** <https://community.auth0.com/t/management-api-role-delete-returns-200/70528>\
**Category:** Get Help\
**Tags:** api, bug\
**Created:** [September 29, 2021, 9:02pm UTC](https://community.auth0.com/t/management-api-role-delete-returns-200/70528 "2021-09-29T21:02:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lilvinz](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lilvinz/32/32032_2.png) [@lilvinz](https://community.auth0.com/u/lilvinz)\
**Post date:** [September 29, 2021, 9:02pm UTC](https://community.auth0.com/t/management-api-role-delete-returns-200/70528/1 "2021-09-29T21:02:33Z")

</div>

A successful delete of a role returns http 200 but according to documentation it should return 204. This leads to issues with our automation pipelines.  
First time we have seen this broken was 2021/06/30, last time it was good was 2021/06/28.

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [September 29, 2021, 11:16pm UTC](https://community.auth0.com/t/management-api-role-delete-returns-200/70528/3 "2021-09-29T23:16:02Z")

</div>

Hi @lilvinz,

Welcome to the Auth0 Community!

After testing this myself, I can confirm your observations. When I try to delete a role, I also receive an HTTP 200 status code response.

Let me check with our Engineering teams on whether this is a bug and clarify what the intended response code should be and if any documentation needs to be updated.

For now, could you please elaborate more on how this led to breaking behavior in your automation pipelines?

Thank you.

---

<div class="post-metadata">

**Author:** ![lilvinz](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lilvinz/32/32032_2.png) [@lilvinz](https://community.auth0.com/u/lilvinz)\
**Post date:** [September 30, 2021, 9:39am UTC](https://community.auth0.com/t/management-api-role-delete-returns-200/70528/4 "2021-09-30T09:39:29Z")

</div>

We are using terraform-provider-auth0 and that fails deleting roles for our review-apps because of the issue i explained. I assume the terraform provider expects the response code to be 204 as it is documented and obviously has been implemented until 2021/06/30. The roles are deleted but the terraform state is kept because of the failure.

> <https://github.com/alexkappa/terraform-provider-auth0/issues/247>
>
> \<!---
> \*\*IMPORTANT:\*\* Please submit issues or pull requests to \[alexkappa/terraf…orm-provider-auth0\](https://github.com/alexkappa/terraform-provider-auth0). This helps maintainers organize work more efficiently.
> 
> Use the link below if you are not certain:
> https://github.com/alexkappa/terraform-provider-auth0/issues/new
> \---\>
> 
> \### Description
> 
> 
> 
> I have created two \`auth0\_connection\` resources, with strategies \`auth0\` and \`google-oauth2\`.
> 
> They create just fine, but when destroying, I get the error:
> 
> \`\`\`
> Error: json: Unmarshal(nil)
> \`\`\`
> 
> for both of them. The resources are deleted from auth0 but remain in the terraform state, so I'm guessing it's a failure in decoding the API response.
> 
> \<!---
> Please note the following potential times when an issue might be in Terraform core:
> 
> \* \[Configuration Language\](https://www.terraform.io/docs/configuration/index.html) or resource ordering issues
> \* \[State\](https://www.terraform.io/docs/state/index.html) and \[State Backend\](https://www.terraform.io/docs/backends/index.html) issues
> \* \[Provisioner\](https://www.terraform.io/docs/provisioners/index.html) issues
> \* \[Registry\](https://registry.terraform.io/) issues
> \* Spans resources across multiple providers
> 
> If you are running into one of these scenarios, we recommend opening an issue in the \[Terraform core repository\](https://github.com/hashicorp/terraform-plugin-sdk/) instead.
> \---\>
> 
> \### Terraform Version
> 
> \`\`\`
> Terraform v0.12.24
> + provider.auth0 v0.11.0
> + provider.aws v2.68.0
> + provider.digitalocean v1.20.0
> + provider.null v2.1.2
> \`\`\`
> 
> \<!--- 
> Please run \`terraform -v\` to show the \*\*Auth0 provider version\*\* as well as the \*\*Terraform core version\*\*. 
> 
> If you are not running the latest version of Terraform or the provider, please upgrade because your issue may have already been fixed. \[Terraform documentation on provider versioning\](https://www.terraform.io/docs/configuration/providers.html#provider-versions).
> \---\>
> 
> \### Affected Resource(s)
> 
> 
> 
> \* auth0\_connection
> 
> \### Terraform Configuration Files
> 
> 
> 
> \`\`\`hcl
> resource "auth0\_connection" "users" {
> name = "Development"
> strategy = "auth0"
> enabled\_clients = \[
> # list of clients
> \]
> }
> resource "auth0\_connection" "google" {
> name = "google"
> strategy = "google-oauth2"
> enabled\_clients = \[
> # list of clients
> \]
> options {
> client\_id = "client\_id"
> client\_secret = "client\_secret"
> scopes = \[
> "email",
> "profile",
> \]
> }
> }
> \`\`\`
> 
> \### Expected Behavior
> 
> The resources are destroyed successfully
> 
> \### Actual Behavior
> 
> The resources are deleted from auth0, but the resources remain in the terraform state.
> 
> \### Steps to Reproduce
> 
> 
> 
> 1. \`terraform apply -auto-approve\`
> 2. \`terraform destroy -auto-approve\`
> 
> \### Debug Output
> 
> This is part of a bigger terraform. I looked through the \`TRACE\` level logs and didn't see anything relevant.
> \<!---
> Please provide a link to a GitHub Gist containing the complete debug output. Please do NOT paste the debug output in the issue; just paste a link to the Gist.
> 
> To obtain the debug output, see the \[Terraform documentation on debugging\](https://www.terraform.io/docs/internals/debugging.html).
> \---\>
> 
> 
> 
> \### Community Note
> 
> \* Please vote on this issue by adding a 👍 \[reaction\](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
> \* Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
> \* If you are interested in working on this issue or have submitted a pull request, please leave a comment

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [October 4, 2021, 6:28pm UTC](https://community.auth0.com/t/management-api-role-delete-returns-200/70528/6 "2021-10-04T18:28:21Z")

</div>

Hi @lilvinz,

Thank you for your continued patience.

I have an update. After collaborating with our Engineers, they have clarified that ideally, the response code should return `204` as shown in our current documentation.

However, given that it is currently returning `200`, we will be updating our documentation to reflect that to prevent any further breaking behavior.

Please let me know if there are any questions.

Thank you.

---

<div class="post-metadata">

**Author:** ![lilvinz](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lilvinz/32/32032_2.png) [@lilvinz](https://community.auth0.com/u/lilvinz)\
**Post date:** [October 4, 2021, 7:42pm UTC](https://community.auth0.com/t/management-api-role-delete-returns-200/70528/7 "2021-10-04T19:42:14Z")

</div>

Thanks for getting back to me. Honestly to me that looks like you broke the API and now you are going to work around that by redefining what is correct.  
That does not prevent further breaking behavior at all in my opinion.  
Preventing further breaking would be to add a test-case to your test suite which ensures that you don’t accidentally change your API in the future.

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [October 5, 2021, 8:24pm UTC](https://community.auth0.com/t/management-api-role-delete-returns-200/70528/8 "2021-10-05T20:24:03Z")

</div>

Hi @lilvinz,

Thank you for your response.

I completely understand your frustration and have passed along this information to our Engineers. Whenever we receive valuable feedback such as this, we try to correct our services as quickly as possible.

We apologize for any inconvenience it may have caused you or your team. Rest assured that we’re taking action to help prevent similar issues from occurring in the future.

Please let me know if there is anything else I can do to help.

Thank you.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [October 20, 2021, 8:24pm UTC](https://community.auth0.com/t/management-api-role-delete-returns-200/70528/9 "2021-10-20T20:24:32Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
