Short answer: cache with caution. It will most likely never change, but if it does, just grab it again. I would make the call at the beginning of a set of requests, and then forget about it.
The baseUrl parameter would look like:
"https://demo.docusign.net/restapi/v2/accounts/123456"
To break it down:
- demo.docusign.net -> Our uri, demo environment is as you expect, the
demo site.
- restapi/v2/ -> Using version 2 of the api
- accounts/123456
-> Your account id particular to the demo site. (This will be a different id for the production site)
You would need to know this url for every api call. I wouldn't store it 'forever' just to be safe, but you could cache it for a short time to reduce the number of API calls. Your accountId should never change on the environment, but we do provide new environments occasionally, and every different account will have a different baseUrl.
For reference, see here: https://docs.docusign.com/esign/guide/usage/quickstart.html
If you really want to store it for a long time, I would set a 30 day time-out or something along those lines.