Basic authentication is a easy to use authentication scheme included in the HTTP protocol. The client sends a request with the 'Authorization' header that contains the word Basic followed by a space and a base64-encoded string username:password. 

In the context of Ytel's v3 API's you will be using your accountsid and authtoken as the username and password respectively. i.e {ACCOUNTSID:AUTHTOKEN}.

Using base64 encoding accountsid:authtoken to create the 'Authorization' header to use our API's will end up looking like this.

'authorization: Basic YWlvY2o5ODExdTJmLTIzNS00MjVkLWFhOWYtYXNvaWRqMGM4dTo4eTg3YXNkZ3loN2I5MWJoYWpic2Q='

You can base64 encode your Accountsid and Authtoken using a couple different methods. Most programming languages have functions built in for just such a thing. Here are a few examples - 

In PHP 

$header = "Authorization: Basic " . base64_encode($username . ':' . $password);

In Node

var username = 'Test';
var password = '123';
var auth = 'Basic ' + new Buffer(username + ':' + password).toString('base64');

var header = {'Host': 'www.example.com', 'Authorization': auth};
var request = client.request('GET', '/', header);

In Python

base64string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '')
header = ("Authorization: Basic %s" % base64string)   

Those are just a few examples. There are also a couple websites that will do this for you as well. 

Ultimately, whats important is base64 encoding your accountsid:authtoken and utilizing that encoded string in your 'Authorization' header for your Ytel v3 API requests.

If you are successful you will receive a '200' HTTP response with your API response.

If you put in the wrong API credentials you will receive a '401' HTTP response with "message":"Invalid authentication credentials" as the body.

Did this answer your question?