When 2FA is enabled, every login / sign-in requires users to input their password, OTP, and user ID.
With such security measures, a regular user account cannot be used to invoke the OpenSpecimen APIs by automated systems.
Starting v8.1, a new type of user - API user is implemented.
API users are special type of users that do not require OTP for sign-in. However, they have one important restriction - API calls can be restricted from a certain IP address (or range).
Steps:
Navigate to Home → Users → Create
Select Yes as the answer for API User?
Specify the host IP address or range of allowed IP addresses in the text box appearing below the API User? as illustrated in the image below -
IP address can be:
Host IP address as in 142.250.67.196. This means the API user account can be used to invoke APIs from this IP address alone.
IP address range using Network address / mask notation (aka CIDR notation). For example: 142.250.0.0/16. This allows to invoke API from any IP falling the range - 142.250.0.0 - 142.250.255.255 (for a total of 65,025 IP addresses)
Few more examples:
142.250.67.0/24 signifies the range 142.250.67.0 - 142.250.67.255 (for a total of 255 IP addresses)
142.250.67.248/29 specifies the range 142.250.67.248 - 142.250.67.255 (for a total of 8 IP addresses)