Authentication

Log in to the system and log out from the system. For more details, please refer to: https://support.portsip.com/development-portsip/developer-guide/rest-apis/authentication.

Retrieve metadata.

get

Retrieve system metadata information. If the optional domain query parameter is specified, the relevant tenant metadata information will be returned together. System metadata:

  • web_domain

  • private_ipv4

  • public_ipv4

  • enable_ipv6

  • private_ipv6

  • public_ipv6

  • primary_dns_server

  • secondary_dns_server Tenant metadata:

  • name

  • domain

  • website

  • avatar_url

  • enable_ms365_integration

  • ms365_authorization_endpoint

Query parameters
domainstringOptional

Use the domain query parameter to retrieve just a subset of a collection.

Responses
200
OK
application/json
get
GET /api/info HTTP/1.1
Host: hostname:8887
Accept: */*
{
  "web_domain": "example.com",
  "private_ipv4": "127.0.0.1",
  "public_ipv4": "127.0.0.1",
  "enable_ipv6": false,
  "private_ipv6": "::1",
  "public_ipv6": "::1",
  "primary_dns_server": "127.0.0.1",
  "secondary_dns_server": "127.0.0.1",
  "name": "example",
  "domain": "example.com",
  "website": "example.com",
  "avatar_url": "avatar.com/avatar",
  "enable_ms365_integration": false,
  "ms365_authorization_endpoint": "/ms365"
}

Sign in with credentials

post

Sign in with credentials

Query parameters
qrbooleanOptionalDefault: false
Body
usernamestring · min: 1 · max: 64Required

The user's account name.
Only letters, numbers, and the following special characters can be added: underscore, dash, single quote, and period (_, -, ', and .).
Username cannot start or end with period (.).
admin, system, administrator, and root are reserved names for system admin only with case ignored.

passwordstringRequired

The password of user.

domainstring · min: 1 · max: 280Optional

The SIP domain of tenant.
It is usually a fully qualified domain name (FQDN). If there is no FQDN, you can also use the IP address of the PBX server as the SIP domain. The SIP domain name is only used for SIP message authentication and does not require analysis.

Responses
200
OK
application/json
Responseone of
or
post
POST /api/auth/sign_in HTTP/1.1
Host: hostname:8887
Content-Type: application/json
Accept: */*
Content-Length: 53

{
  "username": "text",
  "password": "text",
  "domain": "text"
}
{
  "two_factor_enabled": true,
  "token": "text"
}

Sign in with social account

post

Sign in with social account

Path parameters
providerstringRequired

The name of IdP provider. Currently only supports microsoft.

Body
domainstring · min: 1 · max: 280Required

The SIP domain of tenant.
It is usually a fully qualified domain name (FQDN). If there is no FQDN, you can also use the IP address of the PBX server as the SIP domain. The SIP domain name is only used for SIP message authentication and does not require analysis.

callback_urlstringRequired

The callback url for authentication flow.

Responses
200
OK
application/json
post
POST /api/auth/sign_in/{provider} HTTP/1.1
Host: hostname:8887
Content-Type: application/json
Accept: */*
Content-Length: 39

{
  "domain": "text",
  "callback_url": "text"
}
{
  "url": "text"
}

Sign out from system.

post

Sign out from system.

Authorizations
Responses
200
OK
post
POST /api/auth/sign_out HTTP/1.1
Host: hostname:8887
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*

No content

Send OTP to email.

post

Request to send OTP to email.

Body
tokenstringRequired

The session token in authentication flow.

Responses
200
OK
post
POST /api/auth/send_otp HTTP/1.1
Host: hostname:8887
Content-Type: application/json
Accept: */*
Content-Length: 16

{
  "token": "text"
}

No content

Verify OTP from email.

post

Request to verify OTP from email.

Body
tokenstringRequired

The session token in authentication flow.

codestringRequired

The OTP code in authentication flow.

Responses
200
OK
post
POST /api/auth/verify_otp HTTP/1.1
Host: hostname:8887
Content-Type: application/json
Accept: */*
Content-Length: 30

{
  "token": "text",
  "code": "text"
}

No content

Initiate authentication forget password flow

post

Initiate authentication forget password flow.

Body
domainstring · min: 1 · max: 280Required

The SIP domain of tenant.
It is usually a fully qualified domain name (FQDN). If there is no FQDN, you can also use the IP address of the PBX server as the SIP domain. The SIP domain name is only used for SIP message authentication and does not require analysis.

usernamestring · min: 1 · max: 64Required

The user's account name.
Only letters, numbers, and the following special characters can be added: underscore, dash, single quote, and period (_, -, ', and .).
Username cannot start or end with period (.).
admin, system, administrator, and root are reserved names for system admin only with case ignored.

callback_urlstringRequired

The callback url for authentication flow.

Responses
200
OK
post
POST /api/auth/forget_password HTTP/1.1
Host: hostname:8887
Content-Type: application/json
Accept: */*
Content-Length: 57

{
  "domain": "text",
  "username": "text",
  "callback_url": "text"
}

No content

Reset password with session token.

post

Reset password with session token.

Body
tokenstringRequired

The session token in authentication flow.

new_passwordstringRequired

The password of user.

Responses
200
OK
post
POST /api/auth/reset_password HTTP/1.1
Host: hostname:8887
Content-Type: application/json
Accept: */*
Content-Length: 38

{
  "token": "text",
  "new_password": "text"
}

No content

Refresh the access token.

post

Refresh the access token.

Body
refresh_tokenstringRequired

The refresh token.

Responses
200
OK
application/json
post
POST /api/auth/refresh_token HTTP/1.1
Host: hostname:8887
Content-Type: application/json
Accept: */*
Content-Length: 24

{
  "refresh_token": "text"
}
{
  "token_type": "text",
  "access_token": "text",
  "refresh_token": "text",
  "expires_in": 1
}

Get the authentication information of the logged-in user.

get

Get the authentication information of the logged-in user.

Authorizations
Responses
200
OK
application/json
get
GET /api/auth/user HTTP/1.1
Host: hostname:8887
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "role": "User",
  "password_verified": true,
  "password_force_reset": false
}

Get login status of current session

get

Get login status of current session.

Responses
200
OK
application/json
get
GET /api/login HTTP/1.1
Host: hostname:8887
Accept: */*
{
  "access_token": "4DFCF1D4C30B4D798ECE3AE43769F008.",
  "expires_at": "2017-07-21T17:32:28Z",
  "expires_in": 1800,
  "role": "User"
}

Login into system

post

Login with username and password.

Body
usernamestring · min: 1 · max: 64Required

The user's account name.
Only letters, numbers, and the following special characters can be added: underscore, dash, single quote, and period (_, -, ', and .).
Username cannot start or end with period (.).
admin, system, administrator, and root are reserved names for system admin only with case ignored.

passwordstringRequired

The password of user.

domainstring · min: 1 · max: 280Optional

The SIP domain of tenant.
It is usually a fully qualified domain name (FQDN). If there is no FQDN, you can also use the IP address of the PBX server as the SIP domain. The SIP domain name is only used for SIP message authentication and does not require analysis.

Responses
200
OK
post
POST /api/login HTTP/1.1
Host: hostname:8887
Content-Type: application/json
Accept: */*
Content-Length: 53

{
  "username": "text",
  "password": "text",
  "domain": "text"
}

No content

login with Microsoft Identity Provider by Authorization Code Flow

post

login with Microsoft Identity Provider by Authorization Code Flow.

Body
domainstring · min: 1 · max: 280Required

The SIP domain of tenant.
It is usually a fully qualified domain name (FQDN). If there is no FQDN, you can also use the IP address of the PBX server as the SIP domain. The SIP domain name is only used for SIP message authentication and does not require analysis.

Responses
302
Found
post
POST /api/login/by_microsoft HTTP/1.1
Host: hostname:8887
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 17

"domain='text'"

No content

Log out from system

post

Logs out current session.

Responses
204
No Content
post
POST /api/logout HTTP/1.1
Host: hostname:8887
Accept: */*

No content