logo

Barong

RESTful API for barong OAuth server

#Version: 2.0.30-alpha

Security

BearerToken

jwtundefined
DescriptionBearer Token authentication
NameAuthorization
Inheader

/admin/metrics

GET

Description

Returns main statistic in the given time period

Parameters
NameLocated inDescriptionRequiredSchema
created_fromqueryNostring
created_toqueryNostring
Responses
CodeDescription
200Returns main statistic in the given time period
401Invalid bearer token
Security
Security SchemaScopes
BearerToken

/admin/activities/admin

GET

Description

Returns array of activities as paginated collection

Parameters
NameLocated inDescriptionRequiredSchema
topicqueryNostring
actionqueryNostring
uidqueryNostring
emailqueryNostring
target_uidqueryNostring
rangequeryNostring
fromqueryNostring
toqueryNostring
pagequeryPage number (defaults to 1).Nointeger
limitqueryNumber of users per page (defaults to 100, maximum is 100).Nointeger
Responses
CodeDescription
200Returns array of activities as paginated collection
401Invalid bearer token
Security
Security SchemaScopes
BearerToken

/admin/activities

GET

Description

Returns array of activities as paginated collection

Parameters
NameLocated inDescriptionRequiredSchema
topicqueryNostring
actionqueryNostring
uidqueryNostring
emailqueryNostring
fromqueryNostring
toqueryNostring
pagequeryPage number (defaults to 1).Nointeger
limitqueryNumber of users per page (defaults to 100, maximum is 100).Nointeger
Responses
CodeDescription
200Returns array of activities as paginated collection
401Invalid bearer token
Security
Security SchemaScopes
BearerToken

/admin/permissions

PUT

Description

Update Permission

Parameters
NameLocated inDescriptionRequiredSchema
idformDataPermission idYesinteger
roleformDatapermission field - roleNostring
verbformDatapermission field - request verbNostring
pathformDatapermission field - request pathNostring
actionformDataNostring
Responses
CodeDescription
200Update Permission
401Invalid bearer token
Security
Security SchemaScopes
BearerToken

DELETE

Description

Deletes permission

Parameters
NameLocated inDescriptionRequiredSchema
idquerypermission idYesinteger
Responses
CodeDescription
204Deletes permission
401Invalid bearer token
Security
Security SchemaScopes
BearerToken

POST

Description

Create permission

Parameters
NameLocated inDescriptionRequiredSchema
roleformDataYesstring
verbformDataYesstring
pathformDataYesstring
actionformDataYesstring
Responses
CodeDescription
201Create permission
401Invalid bearer token
Security
Security SchemaScopes
BearerToken

GET

Description

Returns array of permissions as paginated collection

Parameters
NameLocated inDescriptionRequiredSchema
pagequeryPage number (defaults to 1).Nointeger
limitqueryNumber of users per page (defaults to 100, maximum is 100).Nointeger
Responses
CodeDescription
200Returns array of permissions as paginated collection
401Invalid bearer token
Security
Security SchemaScopes
BearerToken

/admin/users/{uid }

GET

Description

Returns user info

Parameters
NameLocated inDescriptionRequiredSchema
uidpathuser uniq idYesstring
Responses
CodeDescription
200Returns user info
401Invalid bearer token
Security
Security SchemaScopes
BearerToken

/admin/users/labels

DELETE

Description

Deletes label for user

Parameters
NameLocated inDescriptionRequiredSchema
uidqueryuser uniq idYesstring
keyquerylabel key. [a-z0-9_-]+ should be used. Min - 3, max - 255 characters.Yesstring
scopequerylabel key. [a-z0-9_-]+ should be used. Min - 3, max - 255 characters.Yesstring
Responses
CodeDescription
204Deletes label for user
401Invalid bearer token
Security
Security SchemaScopes
BearerToken

PUT

Description

Update user label scope

Parameters
NameLocated inDescriptionRequiredSchema
uidformDatauser uniq idYesstring
keyformDataLabel key.Yesstring
scopeformDatalabel key. [a-z0-9_-]+ should be used. Min - 3, max - 255 characters.Yesstring
valueformDataLabel value.Yesstring
Responses
CodeDescription
200Update user label scope
400Required params are empty
401Invalid bearer token
404Record is not found
422Validation errors
Security
Security SchemaScopes
BearerToken

POST

Description

Adds label for user

Parameters
NameLocated inDescriptionRequiredSchema
uidformDatauser uniq idYesstring
keyformDatalabel key. [a-z0-9_-]+ should be used. Min - 3, max - 255 characters.Yesstring
valueformDatalabel value. [A-Za-z0-9_-] should be used. Min - 3, max - 255 characters.Yesstring
scopeformDataLabel scope: 'public' or 'private'. Default is publicNostring
Responses
CodeDescription
201Adds label for user
401Invalid bearer token
Security
Security SchemaScopes
BearerToken

GET

Description

Returns array of users as paginated collection

Parameters
NameLocated inDescriptionRequiredSchema
keyqueryLabel keyYesstring
valuequeryLabel valueYesstring
pagequeryPage number (defaults to 1).Nointeger
limitqueryNumber of users per page (defaults to 100, maximum is 1000).Nointeger
Responses
CodeDescription
200Returns array of users as paginated collection
401Invalid bearer token
Security
Security SchemaScopes
BearerToken

/admin/users/labels/update

POST

Description

Update user label scope

Parameters
NameLocated inDescriptionRequiredSchema
uidformDatauser uniq idYesstring
keyformDataLabel key.Yesstring
scopeformDatalabel key. [a-z0-9_-]+ should be used. Min - 3, max - 255 characters.Yesstring
valueformDataLabel value.Yesstring
Responses
CodeDescription
201Update user label scope
400Required params are empty
401Invalid bearer token
404Record is not found
422Validation errors
Security
Security SchemaScopes
BearerToken

/admin/users/labels/list

GET

Description

Returns existing labels keys and values

Responses
CodeDescription
200Returns existing labels keys and values
401Invalid bearer token
Security
Security SchemaScopes
BearerToken

/admin/users/documents/pending

GET

Description

Returns array of users with pending documents as paginated collection

Parameters
NameLocated inDescriptionRequiredSchema
extendedqueryWhen true endpoint returns full information about usersNoboolean
uidqueryNostring
emailqueryNostring
rolequeryNostring
first_namequeryNostring
last_namequeryNostring
countryqueryNostring
levelqueryNointeger
statequeryNostring
rangequeryNostring
fromqueryNostring
toqueryNostring
pagequeryPage number (defaults to 1).Nointeger
limitqueryNumber of users per page (defaults to 100, maximum is 1000).Nointeger
Responses
CodeDescription
200Returns array of users with pending documents as paginated collection
401Invalid bearer token
Security
Security SchemaScopes
BearerToken

/admin/users

PUT

Description

Update user attributes

Parameters
NameLocated inDescriptionRequiredSchema
uidformDatauser uniq idYesstring
stateformDatauser stateNostring
otpformDatauser 2fa statusNoboolean
Responses
CodeDescription
200Update user attributes
401Invalid bearer token
Security
Security SchemaScopes
BearerToken

GET

Description

Returns array of users as paginated collection

Parameters
NameLocated inDescriptionRequiredSchema
extendedqueryWhen true endpoint returns full information about usersNoboolean
uidqueryNostring
emailqueryNostring
rolequeryNostring
first_namequeryNostring
last_namequeryNostring
countryqueryNostring
levelqueryNointeger
statequeryNostring
rangequeryNostring
fromqueryNostring
toqueryNostring
pagequeryPage number (defaults to 1).Nointeger
limitqueryNumber of users per page (defaults to 100, maximum is 100).Nointeger
Responses
CodeDescription
200Returns array of users as paginated collection
401Invalid bearer token
Security
Security SchemaScopes
BearerToken

/admin/users/role

POST

Description

Update user role

Parameters
NameLocated inDescriptionRequiredSchema
uidformDatauser uniq idYesstring
roleformDatauser roleYesstring
Responses
CodeDescription
201Update user role
401Invalid bearer token
Security
Security SchemaScopes
BearerToken

/admin/users/update

POST

Description

Update user attributes

Parameters
NameLocated inDescriptionRequiredSchema
uidformDatauser uniq idYesstring
stateformDatauser stateNostring
otpformDatauser 2fa statusNoboolean
Responses
CodeDescription
201Update user attributes
401Invalid bearer token
Security
Security SchemaScopes
BearerToken

/identity/users/password/confirm_code

POST

Description

Sets new account password

Parameters
NameLocated inDescriptionRequiredSchema
reset_password_tokenformDataToken from emailYesstring
passwordformDataUser passwordYesstring
confirm_passwordformDataUser passwordYesstring
langformDataLanguage in iso-2 formatNostring
Responses
CodeDescription
201Resets password
400Required params are empty
404Record is not found
422Validation errors

/identity/users/password/generate_code

POST

Description

Send password reset instructions

Parameters
NameLocated inDescriptionRequiredSchema
emailformDataAccount emailYesstring
langformDataLanguage in iso-2 formatNostring
Responses
CodeDescription
201Generated password reset code
400Required params are missing
404User doesn't exist
422Validation errors

/identity/users/email/confirm_code

POST

Description

Confirms an account

Parameters
NameLocated inDescriptionRequiredSchema
tokenformDataToken from emailYesstring
langformDataLanguage in iso-2 formatNostring
Responses
CodeDescription
201Confirms an account
400Required params are missing
422Validation errors

/identity/users/email/generate_code

POST

Description

Send confirmations instructions

Parameters
NameLocated inDescriptionRequiredSchema
emailformDataAccount emailYesstring
langformDataClient env languageNostring
Responses
CodeDescription
201Generated verification code
400Required params are missing
422Validation errors

/identity/users/register_geetest

GET

Description

Register Geetest captcha

Responses
CodeDescription
200Register Geetest captcha

/identity/users

POST

Description

Creates new user

Parameters
NameLocated inDescriptionRequiredSchema
emailformDataUser EmailYesstring
passwordformDataUser PasswordYesstring
refidformDataReferral uidNostring
langformDataClient env languageNostring
captcha_responseformDataResponse from captcha widgetNostring
Responses
CodeDescription
201Creates new user
400Required params are missing
422Validation errors

/identity/sessions

DELETE

Description

Destroy current session

Responses
CodeDescription
204Destroy current session
400Required params are empty
404Record is not found

POST

Description

Start a new session

Parameters
NameLocated inDescriptionRequiredSchema
emailformDataYesstring
passwordformDataYesstring
captcha_responseformDataResponse from captcha widgetNostring
otp_codeformDataCode from Google AuthenticatorNostring
Responses
CodeDescription
201Start a new session
400Required params are empty
404Record is not found

/identity/version

GET

Description

Get barong version

Responses
CodeDescription
200Get barong version

/identity/time

GET

Description

Get server current unix timestamp.

Responses
CodeDescription
200Get server current unix timestamp.

/identity/ping

GET

Description

Test connectivity

Responses
CodeDescription
200Test connectivity

/resource/api_keys

GET

Description

List all api keys for current account.

Parameters
NameLocated inDescriptionRequiredSchema
pagequeryPage number (defaults to 1).Nointeger
limitqueryNumber of api keys per page (defaults to 100, maximum is 1000).Nointeger
Responses
CodeDescription
200List all api keys for current account.
400Require 2FA and totp code
401Invalid bearer token
Security
Security SchemaScopes
BearerToken

POST

Description

Create an api key

Parameters
NameLocated inDescriptionRequiredSchema
algorithmformDataYesstring
kidformDataNostring
scopeformDatacomma separated scopesNostring
totp_codeformDataCode from Google AuthenticatorYesstring
Responses
CodeDescription
201Create an api key
400Required params are empty
401Invalid bearer token
422Validation errors
Security
Security SchemaScopes
BearerToken

/resource/api_keys/{kid }

DELETE

Description

Delete an api key

Parameters
NameLocated inDescriptionRequiredSchema
kidpathYesstring
totp_codequeryCode from Google AuthenticatorYesstring
Responses
CodeDescription
204Succefully deleted
400Required params are empty
401Invalid bearer token
404Record is not found
Security
Security SchemaScopes
BearerToken

PATCH

Description

Updates an api key

Parameters
NameLocated inDescriptionRequiredSchema
kidpathYesstring
scopeformDatacomma separated scopesNostring
stateformDataState of API Key. "active" state means key is active and can be used for authNostring
totp_codeformDataCode from Google AuthenticatorYesstring
Responses
CodeDescription
200Updates an api key
400Required params are empty
401Invalid bearer token
404Record is not found
422Validation errors
Security
Security SchemaScopes
BearerToken

/resource/otp/verify

POST

Description

Verify 2FA code

Parameters
NameLocated inDescriptionRequiredSchema
codeformDataCode from Google AuthenticatorYesstring
Responses
CodeDescription
201Verify 2FA code
4002FA has not been enabled for this account or code is missing
401Invalid bearer token
422Validation errors
Security
Security SchemaScopes
BearerToken

/resource/otp/enable

POST

Description

Enable 2FA

Parameters
NameLocated inDescriptionRequiredSchema
codeformDataCode from Google AuthenticatorYesstring
Responses
CodeDescription
201Enable 2FA
4002FA has been enabled for this account or code is missing
401Invalid bearer token
422Validation errors
Security
Security SchemaScopes
BearerToken

/resource/otp/generate_qrcode

POST

Description

Generate qr code for 2FA

Responses
CodeDescription
201Generate qr code for 2FA
4002FA has been enabled for this account
401Invalid bearer token
Security
Security SchemaScopes
BearerToken

/resource/phones/verify

POST

Description

Verify a phone

Parameters
NameLocated inDescriptionRequiredSchema
phone_numberformDataPhone number with country codeYesstring
verification_codeformDataVerification code from smsYesstring
Responses
CodeDescription
201Verify a phone
400Required params are empty
401Invalid bearer token
404Record is not found
Security
Security SchemaScopes
BearerToken

/resource/phones/send_code

POST

Description

Resend activation code

Parameters
NameLocated inDescriptionRequiredSchema
phone_numberformDataPhone number with country codeYesstring
Responses
CodeDescription
201Resend activation code
400Required params are empty
401Invalid bearer token
404Record is not found
422Validation errors
Security
Security SchemaScopes
BearerToken

/resource/phones

POST

Description

Add new phone

Parameters
NameLocated inDescriptionRequiredSchema
phone_numberformDataPhone number with country codeYesstring
Responses
CodeDescription
201Add new phone
400Required params are empty
401Invalid bearer token
404Record is not found
422Validation errors
Security
Security SchemaScopes
BearerToken

GET

Description

Returns list of user's phones

Responses
CodeDescription
200Returns list of user's phones
401Invalid bearer token
Security
Security SchemaScopes
BearerToken

/resource/documents

POST

Description

Upload a new document for current user

Parameters
NameLocated inDescriptionRequiredSchema
doc_typeformDataDocument typeYesstring
doc_numberformDataDocument numberYesstring
uploadformDataArray of Rack::Multipart::UploadedFileYesstring
doc_expireformDataDocument expiration dateNodate
Responses
CodeDescription
201Document is uploaded
400Required params are empty
401Invalid bearer token
422Validation errors
Security
Security SchemaScopes
BearerToken

GET

Description

Return current user documents list

Responses
CodeDescription
200Return current user documents list
401Invalid bearer token
Security
Security SchemaScopes
BearerToken

/resource/profiles

POST

Description

Create a profile for current_user

Parameters
NameLocated inDescriptionRequiredSchema
first_nameformDataYesstring
last_nameformDataYesstring
dobformDataYesdate
addressformDataYesstring
postcodeformDataYesstring
cityformDataYesstring
countryformDataYesstring
Responses
CodeDescription
201Create a profile for current_user
400Required params are empty
401Invalid bearer token
409Profile already exists
422Validation errors
Security
Security SchemaScopes
BearerToken

/resource/profiles/me

GET

Description

Return profile of current resource owner

Responses
CodeDescription
200Return profile of current resource owner
401Invalid bearer token
404User has no profile
Security
Security SchemaScopes
BearerToken

/resource/labels/{key }

DELETE

Description

Delete a label with 'public' scope.

Parameters
NameLocated inDescriptionRequiredSchema
keypathLabel key.Yesstring
Responses
CodeDescription
204Succefully deleted
400Required params are empty
401Invalid bearer token
404Record is not found
Security
Security SchemaScopes
BearerToken

PATCH

Description

Update a label with 'public' scope.

Parameters
NameLocated inDescriptionRequiredSchema
keypathLabel key.Yesstring
valueformDataLabel value.Yesstring
Responses
CodeDescription
200Update a label with 'public' scope.
400Required params are empty
401Invalid bearer token
404Record is not found
422Validation errors
Security
Security SchemaScopes
BearerToken

GET

Description

Return a label by key.

Parameters
NameLocated inDescriptionRequiredSchema
keypathLabel key.Yesstring
Responses
CodeDescription
200Return a label by key.
400Required params are empty
401Invalid bearer token
404Record is not found
Security
Security SchemaScopes
BearerToken

/resource/labels

POST

Description

Create a label with 'public' scope.

Parameters
NameLocated inDescriptionRequiredSchema
keyformDataLabel key.Yesstring
valueformDataLabel value.Yesstring
Responses
CodeDescription
201Create a label with 'public' scope.
400Required params are empty
401Invalid bearer token
422Validation errors
Security
Security SchemaScopes
BearerToken

GET

Description

List all labels for current user.

Responses
CodeDescription
200List all labels for current user.
401Invalid bearer token
Security
Security SchemaScopes
BearerToken

/resource/users/password

PUT

Description

Sets new account password

Parameters
NameLocated inDescriptionRequiredSchema
old_passwordformDataPrevious account passwordYesstring
new_passwordformDataUser passwordYesstring
confirm_passwordformDataUser passwordYesstring
langformDataLanguage in iso-2 formatNostring
Responses
CodeDescription
201Changes password
400Required params are empty
404Record is not found
422Validation errors

/resource/users/activity/{topic }

GET

Description

Returns user activity

Parameters
NameLocated inDescriptionRequiredSchema
pagequeryPage number (defaults to 1).Nointeger
limitqueryNumber of activity per page (defaults to 100, maximum is 1000).Nointeger
topicpathTopic of user activity. Allowed: [all, password, session, otp]Yesstring
Responses
CodeDescription
200Returns user activity

/resource/users/me

DELETE

Description

Returns current user

Parameters
NameLocated inDescriptionRequiredSchema
passwordqueryAccount passwordYesstring
otp_codequeryCode from Google AuthenticatorNostring
Responses
CodeDescription
204Returns current user

GET

Description

Returns current user

Responses
CodeDescription
200Returns current user

Models

Label

NameTypeDescriptionRequired
keystringLabel key. [a-z0-9_-]+ should be used. Min - 3, max - 255 characters.No
valuestringLabel value. [A-Za-z0-9_-] should be used. Min - 3, max - 255 characters.No
scopestringLabel scope: 'public' or 'private'No
created_atstringNo
updated_atstringNo

APIKey

NameTypeDescriptionRequired
kidstringjwt public keyNo
algorithmstringcryptographic hash function typeNo
scopestringserialized array of scopesNo
statestringactive/non-active state of keyNo
secretstringNo
created_atstringNo
updated_atstringNo

Profile

NameTypeDescriptionRequired
first_namestringNo
last_namestringNo
dobdateBirthday dateNo
addressstringNo
postcodestringNo
citystringNo
countrystringNo
metadataobjectProfile additional fieldsNo

User

NameTypeDescriptionRequired
emailstringNo
uidstringNo
rolestringNo
levelintegerNo
otpbooleanis 2FA enabled for accountNo
statestringNo

UserWithProfile

NameTypeDescriptionRequired
emailstringNo
uidstringNo
rolestringNo
levelintegerNo
otpbooleanis 2FA enabled for accountNo
statestringNo
profileProfileNo
created_atstringNo
updated_atstringNo

UserWithFullInfo

NameTypeDescriptionRequired
emailstringNo
uidstringNo
rolestringNo
levelintegerNo
otpbooleanNo
statestringNo
profileProfileNo
labelsLabelNo
phonesPhoneNo
documentsDocumentNo
created_atstringNo
updated_atstringNo

Phone

NameTypeDescriptionRequired
countrystringNo
numberstringNo
validated_ats (g)No

Document

NameTypeDescriptionRequired
uploadstringfile urlNo
doc_typestringdocument type: passport, driver licenseNo
doc_numberstringdocument number: AB123123 typeNo
doc_expirestringexpire date of uploaded documentsNo
metadatastringany additional stored dataNo
created_atstringNo
updated_atstringNo

Activity

NameTypeDescriptionRequired
user_ipstringNo
user_agentstringNo
topicstringNo
actionstringNo
resultstringNo
datastringNo
created_atstringNo