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

# Custom roles and limited access

> Build a team role from any set of actions, or give someone a role on only one project, database or other resource, optionally for a limited time.

> [!TIP]
>
> **Live.** This area is documented as current, user-reliable behavior.

## Goal

Give a person exactly the actions and resources they need.

## Prerequisites

* Owner or Admin of the team.

## Workflow

**Step 1**

In team settings, open Roles and choose New role, or copy a built-in role.

**Step 2**

Name it, pick a Start from preset if one fits, and choose actions under What it can do. Search by key, for example database.\*.

**Step 3**

Check This role can do N actions, then choose Save role.

**Step 4**

To limit someone to one resource, invite them with Only on…, or open the resource’s Who can access this? and choose Give someone access.

## Presets

* Read only: every read action.
* Deploy only: redeploy, restart, roll back and start deployments, cancel builds, and read builds, deployments and project status.
* Mail sender: send live, template, batch and one-time-code mail, schedule sends and run pre-send checks.
* Database operator: every database action except those that delete data.

## Actions and wildcards

* Use real action keys such as database.restart, database.backup.create, deployment.redeploy or mail.live.send.
* A wildcard covers a group: database.\* is every database action, \* is everything.
* Custom roles cannot include deleting the team or transferring ownership.
* Deleting a role that people hold removes it from all of them after you confirm.

## Limited to one resource

Limited roles take effect when Access is switched on. Until then, people with only a limited role can’t open anything on this team.

* A limited role applies only to one resource the team owns: a project, database, bucket, server, Mail domain, Assets space and more. A project includes its environments, services, domains and functions.
* Roles add up: Developer on project:api plus Viewer on database:orders gives both.
* Set an end date to grant access for a time.
* A limited person is not a full team member. They see only what their roles cover.

## Policies in the API

Roles are policies. Create them with POST /api/v1/teams/\{teamId}/access/roles using a preset, a list of actions, or a full policy. Assign them with POST /api/v1/teams/\{teamId}/access/assignments with user\_id, role or policy\_id, an optional resource such as database:\<id>, and an optional expires\_at.

A policy is a list of allow and deny statements. A deny always wins, and anything not allowed is refused. The only conditions are ip\_cidrs, environments, expires\_at and mfa\_within\_minutes.

```json Policy theme={null}
{
  "statements": [
    {
      "effect": "allow",
      "actions": ["deployment.*", "project.*"],
      "resources": ["project:8f2a…"],
      "conditions": { "environments": ["preview", "staging"] }
    },
    { "effect": "deny", "actions": ["database.delete"], "resources": ["*"] }
  ]
}
```

## Expected result

> [!TIP]
>
> The person sees and changes only what the role and its limit allow.

## Related guides

> [card] [Roles](https://docs.stackshift.cloud/team-and-access/roles-and-collaboration.md)
>
> Every person on a team has a role: Owner, Admin, Developer, Viewer or Billing. Developers build and deploy; once Access is switched on, they cannot delete production resources.

> [card] [Who can access this? and unused access](https://docs.stackshift.cloud/team-and-access/who-can-access.md)
>
> See every person, token, agent and automation that can reach a resource and why, and remove access nobody has used in 90 days.

> [card] [Team audit log and export](https://docs.stackshift.cloud/team-and-access/audit-log.md)
>
> See everything people, tokens, agents and automations changed in a team, and everything they were refused. Export CSV or JSON, or stream it through Events.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.