Authentication

How to authenticate your requests to portierX's API

You'll need to authenticate your requests to access most of the endpoints in the portierX API. In this guide, we'll look at how authentication works.

Authenticate with Authorization Header

To authenticate API requests, include the Authorization header with a Bearer or Token type:

# Using Personal Access Token (PAT)
curl --request POST \
  --url https://api.portierx.com/api/v1/locking-system/overview \
  --header 'Authorization: Token eyJhbGciOiJSUz......'
 
# Using JWT
curl --request POST \
  --url https://api.portierx.com/api/v1/locking-system/overview \
  --header 'Authorization: Bearer eyJhbGciOiJSUz......'

How to Get an Authenticate Token

There are two options for obtaining an authentication token:

1. Personal Access Token (PAT) for Service Users (Simpler)

  1. Open your portierx portal, click your organization name in bottom of the sidebar and click User Management Settings

User Management Settings

  1. You will be redirected to the user management settings page. Click Service Users in the navbar and New to create a new service user.

Service Users

  1. Fill the form to create a new service user.

Service User Form

  1. After creating the service user, you will be redirected to the service user details page. Click Create Token to create a new personal access token.

Create Token

  1. You will be asked for expired date and get the token. The token will be displayed only once, so make sure to copy it.

  2. After that, you can use the token to authenticate your requests. For example, to get the overview of the locking system:

curl --request GET \
  --url https://api.portierx.com/api/v1/locking-system/overview \
  --header 'Authorization: Token {PAT}'
  1. You may want to add an appropriate role for the service user to limit its access. You can visit the Roles and Permissions documentation for more information.

2. OAuth 2.0 Token (Most Secure)

Coming soon!

On this page