# Manage access levels with the Salto Space API
> How to create, read, update, and delete user access levels in Salto Space with the Salto Space API.


The Space API, part of Salto IDM Connect, is a REST API that communicates with your Salto Space installation over the SHIP protocol.
This guide explains how to manage the full lifecycle of an access level through the API:

- Create an access level.
- Get one access level or list all access levels.
- Update an access level.
- Delete an access level.

You can use any HTTP client, such as Postman, or your own application.
Each step shows the API request and the result in Salto Space.

{{% info-panel %}}
Before you start, follow the guide to [connect Salto Space to the Space API](https://support.saltosystems.com/idm/connect/space-api/connect-salto-space/).
That guide explains how Salto connects the Space API to your Salto Space installation and issues the API credentials you need.
Then [request an access token](/space/space-api/authentication) for the requests shown here.
{{% /info-panel %}}

An access level groups together the doors that a user can open.
In Salto Space, access levels appear in the **User access levels** list, under **Cardholders**.
After you create an access level, you can assign it to users so they inherit the doors it grants.

## Step 1: Create an access level {#step-1-create-an-access-level}

1. Use the `POST /api/v1/accesslevels` endpoint to create an access level.
The following payload shows the minimal fields:

    ```json
    {
      "extGroupId": "UNIQUE_ACCESS_LEVEL_ID",
      "name": "ACCESS_LEVEL_NAME",
      "description": "DESCRIPTION",
      "doors": []
    }
    ```

    - `extGroupId` is the unique identifier of the access level in Salto Space.
    You can provide any string, and you use this value to get, update, or delete the access level later.
    - `name` and `description` set the name and description shown in Salto Space.
    - `doors` is the list of doors the access level grants.
    Each entry has a single `extDoorId` field.
    Leave the list empty to create the access level without doors, and add them later.

    A successful response returns the `extGroupId` of the new access level.

2. After a successful response, confirm that the access level was created in Salto Space.
You can filter the **Ext ID** column of the **User access levels** list by the `extGroupId` you used.

    ![New access level shown in the User access levels list in Salto Space.](images/accesslevel-created.png)
    {.border}

{{% info-panel %}}
This example uses only the minimal fields.
See the [Space API reference](https://space.api.saltoidm.app/) for the full description of the access level entity and the doors you can assign to it.
{{% /info-panel %}}

## Step 2: Get an access level {#step-2-get-an-access-level}

To get access levels:

- To get a single access level, use the `GET /api/v1/accesslevels/ID` endpoint, where `ID` is the `extGroupId` of the access level.
- To list all access levels, use the `GET /api/v1/accesslevels` endpoint.
- To page and filter the results, use the `GET /api/v1/accesslevels/filtered` endpoint with the `maxCount` and `startingFromExtGroupId` query parameters:
  - `maxCount` sets the page size.
  - `startingFromExtGroupId` is a cursor: the results begin at the access level that follows the one you provide.
  Use the last `extGroupId` of a page as the `startingFromExtGroupId` of the next request to page through the full list.

## Step 3: Update an access level {#step-3-update-an-access-level}

1. Use the `PUT /api/v1/accesslevels/ID` endpoint, where `ID` is the `extGroupId` of the access level.
Send the complete access level, not only the fields you want to change.
The following payload updates the description:

    ```json
    {
      "extGroupId": "UNIQUE_ACCESS_LEVEL_ID",
      "name": "ACCESS_LEVEL_NAME",
      "description": "NEW_DESCRIPTION",
      "doors": []
    }
    ```

2. After a successful response, confirm the change on the access level's page in Salto Space.
Double-click the access level in the **User access levels** list to open its detail page.

    ![Updated description shown on the access level page in Salto Space.](images/accesslevel-updated.png)
    {.border}

## Step 4: Delete an access level {#step-4-delete-an-access-level}

1. Use the `DELETE /api/v1/accesslevels/ID` endpoint, where `ID` is the `extGroupId` of the access level.

2. After the access level is deleted, the record is removed from Salto Space.
It no longer appears in the **User access levels** list.

    ![User access levels list in Salto Space showing no results for the deleted access level.](images/accesslevel-deleted.png)
    {.border}

{{% info-panel %}}
Every operation returns an HTTP `200` status code.
To confirm whether a request succeeded, check the `Success` field in the response rather than the status code alone.
{{% /info-panel %}}

## API definition and documentation {#api-definition-and-documentation}

See the [Space API reference](https://space.api.saltoidm.app/) for a full description of the endpoints and entities available through the API.

The Space API uses a limited set of the functionality available in the full SHIP protocol.
Contact `support-id@saltosystems.com` if you need functionality in the API that is not yet available.

