---
title: "REST API: Delete All Space Roles of User"
type: "wiki"
space: "Axero Documentation"
author: "Anonymous User"
created: 2020-08-03T22:52:23Z
updated: 2026-09-28T01:10:09Z
tags: ["API"]
url: "https://my.axerosolutions.com/spaces/5/axero-documentation/wiki/view/66962/rest-api-delete-all-space-roles-of-user"
---

# REST API: Delete All Space Roles of User

[Open API Guide](https://my.axerosolutions.com/spaces/5/axero-documentation/api-guide?id=66962)
DELETE/api/users/\{UserID\}/spaces/\{SpaceID\}/roles

Remove every role a user holds in a space. ResponseData is true when roles were removed and false when the user held none. The user stays a member of the space, and Get User Space Roles then lists only the space's Guest role for them.

## Request

### Request Header
| Header | Required | Value | Description |
| :--- | :--- | :--- | :--- |
| `Authorization` | YES | `Bearer YOUR_TOKEN` | Bearer token for the authenticated user. [Learn how to create Bearer tokens](https://my.axerosolutions.com/spaces/5/axero-documentation/wiki/view/108973/creating-bearer-tokens). |
### Required Parameters
| Parameter | Type | Required | Location | Description |
| :--- | :--- | :--- | :--- | :--- |
| `UserID` | Integer | YES | Path | Unique ID of the user |
| `SpaceID` | Integer | YES | Path | Unique ID of the space |
## Example

### Request Header

```
Authorization: Bearer YOUR_TOKEN
```

### Request URL

`https://your-site.com/api/users/26/spaces/11/roles`

### Success Response

```
{
  "IsError": false,
  "ResponseMessage": "",
  "ResponseData": true
}
```

### Error Response

```
{
  "Message": "The request is invalid."
}
```

## Error Handling

| Status Code | Likely Cause | Next Action |
| :--- | :--- | :--- |
| 400 Bad Request | UserID or SpaceID in the path is not an integer. | Send numeric IDs in the path. |
| 401 Unauthorized | Missing or invalid Bearer token. | Check token validity. [Learn how to create Bearer tokens →](https://my.axerosolutions.com/spaces/5/axero-documentation/wiki/view/108973/creating-bearer-tokens) |
| 403 Forbidden | The caller is not a site administrator and does not have the Manage Role permission in the space. The same status answers when the user is an administrator of the space, whose roles only a site administrator can remove. | Confirm the user has the required roles for this action. |
| 500 Server Error | Internal failure. | Retry later. |
| 200 with ResponseData false | UserID or SpaceID is 0, or the roles could not be removed. | Check both IDs. |

## Rate Limits

While Axero does not enforce hard rate limits by default, we recommend the following best practices to ensure optimal performance:

- **Sustained Request Rate:** Do not exceed 5 API calls per second
- **Sequential Processing:** Wait for each request to complete before sending the next in automated workflows
- **Concurrent Connections:** If parallel processing is required, limit to 3 or fewer simultaneous requests
- **Response Timeout:** Ensure API responses complete within 15 seconds during testing

Axero may implement temporary rate restrictions if excessive API usage affects overall site performance. For high-volume integrations, contact Axero to discuss your requirements.
