---
title: "Remove a specific role from script access control list."
method: DELETE
path: "/api/v1/script/{script_id}/access/roles/{role}"
---

# Remove a specific role from script access control list.

`DELETE /api/v1/script/{script_id}/access/roles/{role}`

**Authentication**: JWT token required
**Authorization**: Admin level access required (ADMIN or SUPERADMIN)
**Purpose**: Revoke script access from all users with a specific role

**Path Parameters**:
- `script_id`: Script identifier/slug or numeric ID
- `role`: Role name to remove (USER, ADMIN, or SUPERADMIN)

**Request**: No request body required

**Response Schema**:
```json
{
  "data": {
    "script_id": "12345",
    "restricted": true,
    "allowed_roles": ["ADMIN"],
    "allowed_users": [],
    "access_type": "role_restricted"
  }
}
```

**Behavior**:
- Removes role from script's allowed roles list
- All users with only this role lose access immediately
- Does not affect other roles' access
- Gracefully handles removal of non-existent roles

**Access Effect**:
- Users with this role can no longer see script in listings
- Users with this role cannot execute script
- Existing executions continue to completion
- Users may retain access through user-specific permissions or other roles

**Cleanup Logic**:
- If role list becomes empty, role restrictions may be removed
- Script may become unrestricted if no other access controls exist
- Access type is recalculated based on remaining restrictions

**Use Cases**:
- Remove access when role permissions change
- Tighten security by restricting to higher privilege roles only
- Clean up outdated role-based permissions
- Implement policy changes across scripts

**Error Responses**:
- `401 Unauthorized`: JWT token required
- `403 Forbidden`: Admin privileges required
- `404 Not Found`: Script does not exist
- `500 Internal Server Error`: Failed to remove role access

## Path parameters

- `script_id` string, required
- `role` string, required

## Response `200`

Success

- object

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found
- `500` — Internal Server Error

---

[API](https://skmtc.dev/trends/apis/trends-earth-api.md) · [All operations](https://skmtc.dev/trends/apis/trends-earth-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/trends/trends-earth-api/revisions/6bdbc0b84666/schema)
