Fax Cost API

To use the Fax Cost API:

  1. Create a request and get the Fax Cost:
                    #!/bin/bash
    curl -X GET --header 'Content-Type: application/json' 'https://fax.to/api/v2/fax/{document_id}/costs?api_key=API_KEY&fax_number=+161242252602'
                    
                
    <?php
    
    $defaults = [
    	CURLOPT_URL => 'https://fax.to/api/v2/fax/{document_id}/costs?api_key=API_KEY&fax_number=+161242252602'
    ];
    
    $ch = curl_init();
    curl_setopt_array($ch, $defaults);
    
    $response = curl_exec($ch);
    
    // Decode the json object you retrieved when you ran the request.
    $decodedResponse = json_decode($response, true);
    var_dump($decodedResponse);
    
    
    import urllib
    
    params = {
        'api_key': 'API_KEY',
        'fax_number': '+161242252602'
    }
    
    url = 'https://fax.to/api/v2/fax/{document_id}/costs?' + urllib.urlencode(params)
    response = urllib.urlopen(url)
    print response.read()
    
    require "net/http"
    require "uri"
    
    uri = URI.parse("https://fax.to/api/v2/fax/{document_id}/costs?api_key=API_KEY&fax_number=+161242252602")
    
    response = Net::HTTP.get(uri)
    
    puts response
    
    {
      "status": "success",
      "cost": 0.15
    }