---
title: Quickstart
description: >-
  Create a small workspace authorization model and make your first permission
  check with SaaSLayer Permissions.
canonical_url: 'https://saaslayer.com/docs/permissions/quickstart/'
last_updated: '2026-11-15T00:13:40-08:00'
---
# Quickstart

This guide builds a minimal model:

* One organization
* One workspace
* One user
* One role
* One permission check

## Before you start

Use a deployed Permissions service and a credential authorized to create users,
organizations, workspaces and roles, add memberships, assign roles and evaluate
permissions. A login to SaaSLayer's management account is separate from a
credential for this deployment. See [Access admins](https://saaslayer.com/docs/permissions/access-admins) for human
administrator setup and [API keys](https://saaslayer.com/docs/permissions/api-keys) for backend credentials.

The examples are HTTP request shapes, not shell commands. Send them to your
Permissions API base URL. Replace `YOUR_DEPLOYMENT_ID_TOKEN` with an unexpired ID
token from a provider this deployment trusts, for a user with the required
permissions. An authorized API key uses `X-API-Key: YOUR_API_KEY` instead of that
Authorization header. Keep management credentials on the server.

The example assumes your application's catalog has product `acme-iot`, service
`device-service`, resource type `device` and the `read` and `delete` actions.
Use your own published names if they differ. Registering a service and defining
its action/resource vocabulary is covered in [hierarchy and namespaces](https://saaslayer.com/docs/permissions/hierarchy-and-namespaces).
A caller creating or assigning a role must already have authority to confer its
permissions; an API key does not inherit all its owner's access.

Run this against a test deployment. The sample IDs must be unused; a repeated
create can return `409 Conflict` rather than creating another entity.

## 1. Create an organization

```http
POST /orgs
Authorization: Bearer YOUR_DEPLOYMENT_ID_TOKEN
Content-Type: application/json

{
  "id": "org-acme",
  "name": "Acme"
}
```

Organizations are the top-level customer boundary. In most SaaS products, this maps to an account, company, or customer.

## 2. Create a workspace

```http
POST /workspaces
Authorization: Bearer YOUR_DEPLOYMENT_ID_TOKEN
Content-Type: application/json

{
  "id": "ws-acme-prod",
  "orgId": "org-acme",
  "name": "Acme Production"
}
```

Workspaces are the most common scope for application access. A workspace is a subdivision inside an organization, such as an environment, project, or product account.

## 3. Create a user

```http
POST /users
Authorization: Bearer YOUR_DEPLOYMENT_ID_TOKEN
Content-Type: application/json

{
  "id": "user-alice",
  "email": "alice@example.com",
  "name": "Alice"
}
```

SaaSLayer Permissions lets you use caller-owned IDs for domain entities, so the user ID can match your auth provider or application database.

<a id="4-add-the-user-to-the-workspace" />

## 4. Add the user to the organization and workspace

Workspace membership requires membership in its parent organization. Add the
organization membership first:

```http
POST /orgs/org-acme/members
Authorization: Bearer YOUR_DEPLOYMENT_ID_TOKEN
Content-Type: application/json

{
  "type": "user",
  "id": "user-alice"
}
```

Then add the workspace membership:

```http
POST /workspaces/ws-acme-prod/members
Authorization: Bearer YOUR_DEPLOYMENT_ID_TOKEN
Content-Type: application/json

{
  "type": "user",
  "id": "user-alice"
}
```

Membership says where a principal belongs. Roles say what that principal can do.

## 5. Create a role

```http
POST /roles
Authorization: Bearer YOUR_DEPLOYMENT_ID_TOKEN
Content-Type: application/json

{
  "id": "role-device-viewer",
  "permissions": [
    {
      "effect": "can",
      "action": "read",
      "resource": "device",
      "service": "device-service"
    }
  ]
}
```

Roles are permission bundles. Keep role names close to product responsibilities, not job titles. `device-viewer` is usually more reusable than `intern`.

## 6. Assign the role at workspace scope

```http
POST /users/user-alice/roles
Authorization: Bearer YOUR_DEPLOYMENT_ID_TOKEN
Content-Type: application/json

{
  "roleId": "role-device-viewer",
  "scope": "ws-acme-prod"
}
```

Scoped role assignments grant the role only inside that scope. A global assignment has no `scope`.

## 7. Check a permission

```http
POST /permissions/check
Authorization: Bearer YOUR_DEPLOYMENT_ID_TOKEN
Content-Type: application/json

{
  "userId": "user-alice",
  "action": "read",
  "resource": "device",
  "product": "acme-iot",
  "service": "device-service",
  "scope": "ws-acme-prod"
}
```

A successful API call returns a decision in `data.attributes.allowed`. HTTP
success alone is not permission to perform the action. For this read, the expected
result is `allowed: true`; the exact reason and sources can vary:

```json
{
  "data": {
    "type": "permission-check",
    "id": "user-alice:read:device",
    "attributes": {
      "allowed": true,
      "effect": "can",
      "reason": null,
      "sources": []
    }
  }
}
```

## 8. Confirm a denied action

Repeat the check with `"action": "delete"`, keeping the same user, product,
service, resource and workspace. With only the role above assigned, the expected
result is `data.attributes.allowed: false`: this role grants read access only.
Check that your backend refuses the delete when the decision is false or the
permission request fails.

`POST /users` above creates a Permissions principal; it does not create a
password, Cognito account or sign-in session. When integrating an existing login,
derive the user ID from the verified session and the workspace from your own
application data. See [permission checks](https://saaslayer.com/docs/permissions/permission-checks#keep-your-existing-sign-in).

## Troubleshooting

| Result | What to check |
| --- | --- |
| `401 Unauthorized` | Use an unexpired credential accepted by this deployment, with the correct header. |
| `403 Forbidden` | Check the caller's management permissions, target scope and authority to confer the requested role. |
| `PARENT_MEMBERSHIP_REQUIRED` | Add Alice to `org-acme` before adding her to its workspace. |
| `ProductRequired`, `ServiceRequired` or `UnknownResourceType` | Send product and service, and use action/resource names from your published catalog. |
| The read decision is false | Inspect memberships, the scoped role assignment and any existing denies or boundaries. |

## Next steps

After the first check works:

* Add a deny permission and confirm deny-overrides-allow behavior.
* Add a policy with a `when` condition for ownership or environment.
* Use `/permissions/check-batch` for list pages that need multiple decisions.
* Open the permission state endpoint for a user to see materialized access:

```http
GET /users/user-alice/perm-state
Authorization: Bearer YOUR_DEPLOYMENT_ID_TOKEN
```
