Authenticate

Semantria 5 api request authentication uses access tokens. To generate an access token use your account login and password to create a new session. By default sessions will expire one hour after they are they are last used. See Create User Session. for details on how to specify a longer lifespan and or to disable auto refresh.

# create a session
curl -X POST 'https://api5.semantria.com/auth/sessions/' \
  -H 'Content-Type: application/json' \
  --data-binary '{"login": "myaccount", "password": "sekret"}'

# returns json including the access_token
{
  "access_token": "bb0bf16f-92ab-447b-8bc1-64e846195c0e",
  "account_id": "4a429efe-c663-4dce-a040-4632e4484072",
  "user_login": "myaccount",
  "authenticated": "2019-09-20T19:29:50.257Z",
  "expiration": "2019-09-20T20:29:50.257Z",
  "permissions": [
     ...
  ]
}

And now you are ready to analyze some content with that access token.

Create user session parameters

There are different parameters that can be set when creating a session:

Parameter

Type

Options

Explanation

expiration

string

default
OR
forever
OR
custom

default use the 60 minute default expiration time
forever never expire
custom set a custom expiration time

expire_after_minutes

integer

Enter a number of minutes that you would like the token to expire after.
If entering a custom time you must use custom in the above parameter.

renewal_type

string

auto
OR
manual

If auto then the expiration time will be update each time the authentication token is used.
If manual then the only way to change the expiration time is using /renew

Need Access?

If you do not have credentials, contact sales to discuss your use case as the Semantria API is a paid Saas text analytics service from Lexalytics.