Anon
Anon

Reputation: 47

How do I get a DocuSign Monitor API access token

I am trying to get an access token to access the DocuSign Monitor API via the JWT grant method as it states in the documentation for the DocuSign Monitor API. Here is a snippet of my test script:

def create_jwt(self):
    epoch_time = int(time.time())
    priv_key = self.get_rsa(self.privkey_path)
    pub_key = self.get_rsa(self.pubkey_path)

    body = {"iss": self.iss,
            "iat": epoch_time,
            "exp": (epoch_time + 3000),
            "aud": 'account-d.docusign.com',
            "scope": "monitor"}

    encoded = jwt.encode(body, priv_key, algorithm='RS256')
    # decoded = jwt.decode(encoded, pub_key, audience='account-d.docusign.com', algorithm='RS256')

    return encoded

def request_access_token(self, encoded_token):
    url = 'https://account-d.docusign.com/oauth/token'
    data = {'grant_type': 'urn:ietf:params:oauth:grant-type:jwt-bearer',
            'assertion': encoded_token}
    response = requests.post(url=url, data=data)

    return response.text

request_access_token returns:

{"error":"invalid_scope"}

As far as I can tell I am following the documentation correctly. Using these functions I am able to successfully generate an access token for other scopes such as signature etc. Is there some problem with developer accounts requesting access to the monitor scope since it is a beta feature? What would a valid request to 'lens.docusign.net/api/v1.0/monitor/organization/{{organizationId}}' look like? I assume one needs to acquire an access token before attempting to make requests to the monitor API? I can't tell where I'm going wrong here. Any help would be greatly appreciated.

Upvotes: 0

Views: 131

Answers (1)

Inbar Gazit
Inbar Gazit

Reputation: 14015

So this API is in beta and we have to personally enable your account to use it. Use this form to submit a request

More information about this new API

Upvotes: 1

Related Questions