Authentication

Most API calls require authentication. Phaxio supports two methods of authentication: HTTP authentication and parameter authentication. We recommend HTTP authentication. The client libraries have built-in authentication handling, which will automatically authenticate each request when properly initialized.

HTTP Authentication

HTTP authentication may be used simply by using the API key as the username and the API secret as the password. For example:

curl 'https://api.phaxio.com/v2/faxes/123' \
  -u 'API_KEY:API_SECRET'
require_once('autoload.php');

$faxId = '123';

use Phaxio\Phaxio;
$phaxio = new Phaxio('API_KEY', 'API_SECRET', 'https://api.phaxio.com/v2/');
$phaxio->faxStatus($faxId);

Parameter Authentication

If you are unable to use HTTP authentication, you may also authenticate by using api_key and api_secret parameters. These parameters can be put in the request body just like a form field parameter. For example:

curl 'https://api.phaxio.com/v2/faxes/123/cancel' \
  -F 'api_key=API_KEY' -F 'api_secret=API_SECRET'

Or for request’s without a message body (such as GET), the authentication parameters can be included in the query string. For example:

curl 'https://api.phaxio.com/v2/faxes/123?api_key=API_KEY&api_secret=API_SECRET'