APIs
Identity and Access Management ( Token Service) APIs
Each member of the Sahamati Network will be onboarded with a designated user who holds an admin role to manage the entity’s profile and secret.
During the onboarding process, the designated user will receive an email containing a verification link. After email verification, the user will be prompted to set a password, completing the account activation process.
Once the password is set, the user can generate the User Access Token by providing their email and the new password. This token is used for authenticating the entity’s secrets.
The designated user can then use the User Access Token to access the entity’s secret and, if necessary, reset the secret.
Finally, the entity secret is used to generate the Entity Access Token, which is needed for interactions with the ReBIT APIs within the AA network.
Entity Token Generation use case
The Regulated Entities (REs) should generate the Access Token using the Token API from Sahamati for accessing and authentication of any APIs in the AA ecosystem including Sahamati APIs.
Here is the sequence diagram for the Token Generation Process.
Below are the Base URL of each environment to use IAM APIs.
Production
https://api.sahamati.org.in/iam
Please note that the following documentation displays the Base URLs from the Production environment. Ensure you use the appropriate Base URLs depending on the environment you are working in.
To generate a User Access Token, the user must provide their username (email) and the password configured during the account activation process. This access token is necessary for interacting with the member's secret management APIs. The access token has an expiry of 180 days. Below is the API specification.
User email.
The password associated with the user.
Successful response
1.0.02024-07-16T11:33:34.509Zf35761ac-4a18-11e8-96ff-0277a9fbfedc86400BearerBad Request
Unauthorized
curl -L \
-X POST \
'https://api.sahamati.org.in/iam/v1/user/token/generate' \
-H 'accept: application/json' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'username=<email>&password=<password>
{
"ver": "1.0.0",
"timestamp": "2024-07-16T11:33:34.509Z",
"txnId": "f35761ac-4a18-11e8-96ff-0277a9fbfedc",
"accessToken": "",
"expiresIn": 86400,
"tokenType": "Bearer"
}The Read Secret API enables admin to retrieve the current secret for a specific member. To access this information, a user access token with administrative rights must be provided. Below is the API specification.
User Bearer token for authorization
1.0.02024-07-16T11:33:34.509Zf35761ac-4a18-11e8-96ff-0277a9fbfedcaa-1Successful response
1.0.02024-07-16T11:33:34.509Zf35761ac-4a18-11e8-96ff-0277a9fbfedcaa-1xxxxxxxxxxxxxxxxxxxxx17250107632024-12-17T07:10:52.92922024-12-13T07:10:52.929Bad Request
Unauthorized
POST /iam/v1/entity/secret/read HTTP/1.1
Host: api.sahamati.org.in
Authorization: text
Content-Type: application/json
Accept: */*
Content-Length: 119
{
"ver": "1.0.0",
"timestamp": "2024-07-16T11:33:34.509Z",
"txnId": "f35761ac-4a18-11e8-96ff-0277a9fbfedc",
"entityId": "aa-1"
}{
"ver": "1.0.0",
"timestamp": "2024-07-16T11:33:34.509Z",
"txnId": "f35761ac-4a18-11e8-96ff-0277a9fbfedc",
"entityId": "aa-1",
"secret": "xxxxxxxxxxxxxxxxxxxxx",
"expiresOn": 1725010763,
"expirationDate": "2024-12-17T07:10:52.929",
"oldSecretValidity": 2,
"oldSecretExpirationDate": "2024-12-13T07:10:52.929"
}The Reset Secret API is used to reset the entity’s secret. To perform this action, a user access token with administrative privileges must be provided. Once reset, the generated secret will have a validity period (default and max value of 180 days) as specified in the request payload. The SPOC will have to ensure that it is renewed well before the expiry. An entity’s secret can be reset up to 5 times per day. There will be a waiting period of 5 mins applied after each reset API call. Below is the API specification.
User Bearer token for authorization
1.0.02024-07-16T11:33:34.509Zf35761ac-4a18-11e8-96ff-0277a9fbfedcaa-1Specifies the number of days before the secret expires. This field is optional; if not provided, a default value will be used.
100Specifies the number of days (a max of 7) for which the previous secret remains valid. The old and new secret, both, can be used to generate token during this period. This field is optional. If not provided or set to 0, the old secret will be invalidated immediately. We advise the REs to use this judiciously.
2Successful response
1.0.02024-07-16T11:33:34.509Zf35761ac-4a18-11e8-96ff-0277a9fbfedcaa-1xxxxxxxxxxxxxxxxxxxxx17250107632024-12-17T07:10:52.9292Bad Request
Unauthorized
POST /iam/v1/entity/secret/reset HTTP/1.1
Host: api.sahamati.org.in
Authorization: text
Content-Type: application/json
Accept: */*
Content-Length: 164
{
"ver": "1.0.0",
"timestamp": "2024-07-16T11:33:34.509Z",
"txnId": "f35761ac-4a18-11e8-96ff-0277a9fbfedc",
"entityId": "aa-1",
"secretExpiryDays": 100,
"oldSecretValidity": 2
}{
"ver": "1.0.0",
"timestamp": "2024-07-16T11:33:34.509Z",
"txnId": "f35761ac-4a18-11e8-96ff-0277a9fbfedc",
"entityId": "aa-1",
"secret": "xxxxxxxxxxxxxxxxxxxxx",
"expiresOn": 1725010763,
"expirationDate": "2024-12-17T07:10:52.929",
"oldSecretValidity": 2
}To generate a Member (Entity) Access Token, the client ID and Secret are required. The API generates the token with a warning if the secret is within the grace period, but it will fail once the grace period has ended. This token is used for interactions with other members and has a validity of 24 hours. The API specification is detailed below.
The entity ID.
The secret associated with the entity.
Successful response
1.0.02024-07-16T11:33:34.509Zf35761ac-4a18-11e8-96ff-0277a9fbfedc86400BearerBad Request
Unauthorized
curl -L \
-X POST \
'https://api.sahamati.org.in/iam/v1/entity/token/generate' \
-H 'accept: application/json' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'id=<id>&secret=<secret>
{
"ver": "1.0.0",
"timestamp": "2024-07-16T11:33:34.509Z",
"txnId": "f35761ac-4a18-11e8-96ff-0277a9fbfedc",
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresIn": 86400,
"tokenType": "Bearer"
}Token Generation APIs:
API Postman Collection:
Member Secret Management APIs
API Collection:
Last updated
Was this helpful?