---
title: "Revoke a role grant on a resource from a subject"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.cloudraker.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Revoke a role grant on a resource from a subject

Path: CloudRaker Workspace API › Authorization

`DELETE /authorization/grants`

Revokes an existing role grant (unshares). Authorization: same as createGrant — org admin, or the caller holds the resource’s share permission on the target (`space:share`/`spacetype:share`; `settings` is admin-only); otherwise 403 `forbidden`. Body is the SAME shape as createGrant: `subject` (exactly one of `organizationMembershipId`/`groupId`), `role`, `resourceType`, `resourceExternalId`. Returns 204 No Content on success.

## Authentication

- `bearerAuth`, http, header `Authorization`

## Request body

_Required._

- `subject` (`deleteGrant.subject`; object, required)
  - `organizationMembershipId` (`deleteGrant.subject.organizationMembershipId`; string, optional)
    - minLength 1
  - `groupId` (`deleteGrant.subject.groupId`; string, optional)
    - minLength 1
- `role` (`deleteGrant.role`; string, required)
  - minLength 1
- `resourceType` (`deleteGrant.resourceType`; string, required)
  - one of `"space"`, `"spacetype"`, `"settings"`
- `resourceExternalId` (`deleteGrant.resourceExternalId`; string, required)
  - minLength 1

## Example request

```json
{
  "subject": {
    "organizationMembershipId": "string",
    "groupId": "string"
  },
  "role": "string",
  "resourceType": "space",
  "resourceExternalId": "string"
}
```

## Code samples

### cURL

```bash
curl --request DELETE \
  --url https://api.cloudraker.com/authorization/grants \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "subject": {
    "organizationMembershipId": "string",
    "groupId": "string"
  },
  "role": "string",
  "resourceType": "space",
  "resourceExternalId": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/authorization/grants';
const options = {
  method: 'DELETE',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    subject: {organizationMembershipId: 'string', groupId: 'string'},
    role: 'string',
    resourceType: 'space',
    resourceExternalId: 'string'
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.cloudraker.com/authorization/grants"

payload = {
    "subject": {
        "organizationMembershipId": "string",
        "groupId": "string"
    },
    "role": "string",
    "resourceType": "space",
    "resourceExternalId": "string"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.delete(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 204

The role grant was revoked

### 400

Validation Error

#### Example

```json
{
  "success": false,
  "error": [
    null
  ],
  "data": null
}
```

- `success` (`deleteGrant.response.400.success`; boolean, required)
  - one of `false`
- `error` (`deleteGrant.response.400.error`; array<unknown>, required)
- `data` (`deleteGrant.response.400.data`; unknown, required)

### 403

Caller is not an admin and lacks the resource’s share permission


Source: https://docs.cloudraker.com/workspace/api/authorization/delete-grant/index.md
