You can use the same username and password as the portal access to obtain an API token. Each user is associated with a role. The API token will let the server knows the role and permission of the user.
Here is how you can obtain authorization token:
This API let you obtain auth token to access the switch.