# Authenticate with the Salto Space API
> How to authenticate with the Salto Space API using OAuth 2.0 client credentials and call the API with a bearer token.


The Space API uses the OAuth 2.0 client credentials flow.
Your application requests an access token from the Salto IDM identity server, then sends the token with every API call.

You need the client ID and secret of your API client.
Salto issues them when it connects your Salto Space installation to the Space API.
See [Connect Salto Space to the Space API](https://support.saltosystems.com/idm/connect/space-api/connect-salto-space/) on the Salto support site.

To authenticate:

1. Request an access token from the Salto IDM identity server with the OAuth 2.0 client credentials flow.
Send the client ID and secret as a Basic authentication header:

    ```bash
    curl --request POST "https://identity.saltoidm.app/connect/token" \
      --user "CLIENT_ID:CLIENT_SECRET" \
      --header "Content-Type: application/x-www-form-urlencoded" \
      --data "grant_type=client_credentials"
    ```

    The response contains the `access_token`, its `token_type` of `Bearer`, and `expires_in`, the number of seconds the token stays valid.
    Request a new token when it expires.

2. Call the Space API at the base URL `https://space.api.saltoidm.app` with the token in the `Authorization` header.
The following request gets the first user:

    ```bash
    curl "https://space.api.saltoidm.app/api/v1/users/Filtered?maxCount=1" \
      --header "Authorization: Bearer ACCESS_TOKEN"
    ```

    Every response contains `Data`, `Success`, and `Message`.

