Authstate

From SafeStamper API documentation
Revision as of 03:03, 5 June 2023 by api>Admin (→‎Example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This operation checks the status of an authorization key.

If the authkey is authorized, it also returns information about the authorizing user account.

URL

https://www.safestamper.com/api/authstate

Parameters

  • sharedkey: Your API client shared key
  • authkey: Authkey to check status
  • signature: Parameters signature, as explained in Signature parameter

Returns

A JSON object with the following fields:

  • authkey: Authkey value
  • authorized: State of authkey (true|false).

If authorized parameter is true the user info is added:

  • state: State of Safe Stamper user (ACTIVE|DISABLED)
  • userCode: Safe Stamper code of the authorizing user.
  • userMail: Mail of the authorizing user.
  • userName: Full name of the authorizing user.
  • accountType: Account type of the authorizing user (BASIC|PREMIUM).
  • userType: User type of the authorizing user (INDIVIDUAL|ORGANIZATION|OPERATOR).
  • mainUserAuthkey: Authkey of main user for authorized operators.
  • availableCertificates: Available certification credits to use web static, mail, file and photo services.
  • availableNavigations: Available certification credits to use browsing session services.
  • availableSignedDocuments: Available signature credits to create signed documents.
  • availableTimestamps: Available timestamp credits to use tsa services.
  • availableDiskSpace: Available disk space quota
  • maxCertificateSize: Máx size in bytes for certificates
  • maxCertificateSizeMb: Máx size in MB for certificates

HTTP Errors

  • 403 Forbidden: sharedkey or signature are not valid, or the authkey does not belong to the sharedkey
  • 404 Not found: the authkey does not exist

Example

REQUEST:

https://www.safestamper.com/api/authstate
?authkey=0021d81c-e4a5-4869-8384-2fd70cdb58ec
&sharedkey=axvmfqn8aex21mxhq5zsj7l482saxfu7j4hh
&signature=f9e0222c2fcacbea7923552128a9d395d122e963

RESPONSE (actual response has no line breaks or indentation):

{
     "accountType":"PREMIUM",
     "authkey":"0021d81c-e4a5-4869-8384-2fd70cdb58ec",
     "authorized":true,
     "availableCertificates":50,
     "availableNavigations":3,
     "availableTimestamps":10,
     "availableDiskSpace": 113435435
     "maxCertificateSize":"22500000"
     "maxCertificateSizemB":"15"
     "state":"ACTIVE",
     "userCode":"1612020000541",
     "userMail" : "apitest@safecreative.org",
     "userName":"Api User Test"
     "userType":"INDIVIDUAL"
}