/
API Authentication

API Authentication

HTTP Basic Authentication

Using HTTP Basic authentication each request will require that the API key and secret be sent along with the request in the Authentication header.

Authorization: Basic <Base64UrlSafe(apiKeyId:apiKeySecret)>

Depending on the language or tool you are using to send your request, the method for generating will differ.  An example using curl:

Curl command line basic authentication
curl -u apiKey:apiKeySecret https://secure.gotobilling.com/resource

PHP using the curl extension:

PHP curl basic authentication
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://secure.gotobilling.com/resource');
curl_setopt($ch, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
$result=curl_exec ($ch);

Generating API Access Keys

For a detailed guide on creating and managing API access keys see: Managing API Access Keys