Getting Started
Various Environments
Use our Demo Environment when you start your integration:
API | URL |
---|---|
Token API | https://login.demo-eks.snpd.io/oauth/token |
Snapdocs Connect API | https://api.cs-demo0.snpd.io/ |
Audience | https://api.*.snpd.io |
Once the integration is complete, you can then switch to Production Environment.
API | URL |
---|---|
Token API | https://login.snapdocs.com/oauth/token/ |
Snapdocs Connect API | https://api.snapdocs.com/ |
Audience | https://api.snapdocs.com |
Authenticate with Snapdocs Connect
Snapdocs Connect uses OAuth 2.0 for authentication. Specifically, we use the OAuth 2.0 Client Credentials grant type, which means when you authenticate with Snapdocs Connect, you must pass these client credentials:
- Client Id
- Client Secret
- Grant Type
- Audience
Client Credentials
You cannot retrieve your client credentials from Snapdocs Connect directly. However, your Customer Success Manager can provide them.
Your client credentials carry many privileges, so be sure to keep them secure. Because they aren’t available as a secure download, we have some recommendations for how to distribute them securely with your team:
Leverage Gmail’s Confidential Mode to share the client credentials with one-day expiry and enable an SMS passcode for the recipient. Store client credentials under password protection. Use a file protected with a 14+ character password. Securely share the file and password separately.
Audience
The API you intend to call using a token generated by this request, example https://api.snapdocs.com
Grant Type
Use value "client_credentials" for grant type.
"grant_type": "client_credentials"
Example Authentication Request
This example code demonstrates the API requests to retrieve an OAuth access token and use it in the following requests to Snapdocs Connect.
from requests import Session
token_url = "https://login.demo-eks.snpd.io/oauth/token"
test_api_url = "https://api.cs-demo0.snpd.io/api/v1/subscriptions"
client_id = 'CLIENT_ID_HERE'
client_secret = 'CLIENT_SECRET_HERE'
audience = 'https://api.*.snpd.io'
data = {
"client_id": client_id,
"client_secret": client_secret,
"audience": audience,
"grant_type": "client_credentials"
}
s = Session()
access_token_response = s.post(token_url, data=data)
access_token_response.raise_for_status()
print(access_token_response)
tokens = access_token_response.json()
print("access token: " + tokens['access_token'])
#step B - with the returned access_token we can make as many calls as we want
api_call_headers = {'Authorization': 'Bearer ' + tokens['access_token']}
api_call_response = s.get(test_api_url, headers=api_call_headers, verify=False)
api_call_response.raise_for_status()
print(api_call_response.text)
Verify the Access Token
If you have questions of the access token or need to inspect it, you can copy the value to https://jwt.io to decode it.
Updated about 2 years ago