Adding Credentials
Your credentials are required to make any requests to the Bandwidth API. Never publish your credentials. Your credentials are unique to your account and allow Bandwith to verify you are the one making the requests.
Copy and paste the credentials code block on the left. Add your BANDWIDTH_USER_ID
, BANDWIDTH_API_TOKEN
, and BANDWIDTH_API_SECRET
as environment variables.
Reading Environment Variables
Programming Language | Example |
---|---|
NodeJS | var myEnvVar = process.env.MY_VARIABLE |
Python | my_env_var = os.environ.get('MY_VARIABLE') |
C# | string myEnvVar = Environment.GetEnvironmentVariable("MY_VARIABLE"); |
Ruby | my_env_var = env["MY_VARIABLE"] |
PHP | $myEnvVar = getenv('MY_VARIABLE'); |
GO | var myEnvVar = os.Getenv("MY_VARIABLE") |
Java | private static String myEnvVar = System.getenv("MY_VARIABLE") |
Access your Bandwidth Voice & Messaging API Credentials
To access your credentials, login to the Voice and Messaging Dashboard. Visit the account tab on the upper right hand side menu. Your userID is displayed in the API Information (THIS IS NOT THE SAME AS YOUR LOGIN USERNAME). Your apiToken and apiSecret are displayed when you select "Show token and secret". For more information on your credentials or to change your credentials, visit the security page.
Credentials Code Block
const myCreds = {
userId : process.env.BANDWIDTH_USER_ID,
apiToken : process.env.BANDWIDTH_API_TOKEN,
apiSecret : process.env.BANDWIDTH_API_SECRET
};
const bandwidthAPI = new Bandwidth(myCreds);