NAV
ruby shell javascript php java csharp python

Introduction

Welcome to the Medsender Developer API documentation. You can use our API to send, receive, and interact with PHI.

NOTE: Our Developer API is constantly being enhanced and updated. Somethings may not be fully documented and we apologize for that in advance. On rare occasion, breaking changes may occur and we will notify you if/when that happens. We would love to hear from you on feedback, questions, or help on using the API. Get in touch with us at api@medsender.com.

If there is functionality that you'd like to have that we currently don't have documentation for, please contact us and we'd be happy to assist you.

Note: If you'd like to request some functionality that isn't available through this existing API, please contact us. Our team is happy to work with you on a case-by-case basis.

Client SDKs

We have language bindings in Shell, PHP, Java, and JavaScript (Node.js). Code examples are in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right. Client SDKs for .NET, Ruby, and others will be getting support soon as well. If you have a language you'd like us to support, contact us at api@medsender.com and we'll keep it in mind!

Below, we've included instructions on how to install and use our SDKs.

Ruby

Gemfile

...
gem 'medsender_phi', source: 'YOUR_UNIQUE_URL'
...

# Code to add to gemfile
bundle add medsender_phi --source="YOUR_UNIQUE_URL"

We've published our Ruby SDK to a private repository which means you can use bundler to install it. You will need a unique URL to access the repository, so if you don't have one, please contact us at api@medsender.com to obtain one.

Once you've got the unique URL, simply add our gem to your bundler file along with the URL as the source. We've provided an example to show what it looks like. After you add the gem to your bundler file, simply run bundle install and you'll now have access to our Ruby SDK!

PHP

auth.json

{
  "http-basic": {
    "sdk.medsender.com": {
      "username": "your_token",
      "password": ""
    }
  }
}

We've published our PHP SDK to a repository which means you can use composer to install it. However, the repository is private, so you would need a secret token to access it. If you don't have one, please contact us at api@medsender.com to obtain a token.

Once you have the token, you will need to use it when authenticating with the SDK repository. We strongly recommend you keep the credentials in a separate file other than your composer file. This file is typically called auth.json. We've included a sample of the auth.json. Replace your_token with the token we give you. You can keep the auth.json file in your COMPOSER_HOME or in the same directory as your composer.json. Just be sure not to commit your auth.json file.

Once that's done, you can now configure composer to include our SDK. Here are the steps:

  1. Run composer config repositories.medsender composer https://sdk.medsender.com/php
  2. Run composer require medsender/medsender-php-sdk
  3. Run composer install

With that completed, you should be able to get started using our SDK!

Javascript

We've published our Javascript SDK to a repository which means you can use npm to install it. However, the repository is private, so you would need a secret token to access it. If you don't have one, please contact us at api@medsender.com and we'd be happy to give it to you.

Once you have the URL, you need to include it in your .npmrc file. Simply append //npm-proxy.fury.io/medsender/:_authToken=your_secret_token to your .npmrc file. Don't forget to replace your_secret_token with the token we give you.

Once that's done, run these commands to start using our SDK:

  1. In your project root directory, run npm config set registry https://sdk.medsender.com/npm/
  2. Once that's finished, run npm install medsender-phi --registry https://npm-proxy.fury.io/medsender/ --save

Congratulations! You're now able to use our Javascript SDK!

To keep our SDK updated, you can run npm update --registry https://npm-proxy.fury.io/medsender/ --save.

Java

settings.xml

<?xml version="1.0"?>
<settings>
    <servers>
        <server>
            <id>fury</id>
            <username>USERNAME</username>
            <password>NOPASS</password>
            <configuration>
                <httpConfiguration>
                    <all>
                        <usePreemptive>true</usePreemptive>
                    </all>
                </httpConfiguration>
            </configuration>
        </server>
    </servers>
</settings>

pom.xml

<project>
  ...
  <repositories>
      <repository>
          <id>releases</id>
          <url>https://maven.fury.io/medsender/</url>
      </repository>
  </repositories>

  <dependencies>
      <dependency>
          <groupId>com.medsender</groupId>
          <artifactId>phi</artifactId>
          <version>[1.0,2.0)</version>
          <scope>compile</scope>
      </dependency>
  </dependencies>
  ...
</project>

We've published our Java SDK to a private maven repository. In order to install it, you would need a username. If you don't have it already, please email us at api@medsender.com and we'd be happy to generate credentials for you.

Once you have the credentials, you just need to include them in your settings.xml file. This can usually be found at ${user.home}/.m2/settings.xml. We've included an example settings.xml file so you can see what it would look like. Be sure to replace USERNAME with the SDK Token we give you. Keep the password as NOPASS.

Next, in your project that you'd like to use our API with, you need to include in your pom.xml file our maven repository https://maven.fury.io/medsender and add the SDK as a dependency. We've included an example of what your pom.xml file should include. With your pom.xml updated, you can now import the SDK as a dependency and use it in your project!

.NET

A published version is coming soon! Currently, if you'd like access to our .NET SDK, you'd need to contact us at api@medsender.com and we'd be happy to send it to you. We would you send a DLL file that you would then reference within your current project.

Python

We've published our Python SDK to a private repository and you can install it easily via pip. You can email us at api@medsender.com and we'd be happy to send you the details.

Authentication

To authorize, use this code:

# With shell, you can just pass the correct header with each request
curl "https://api.medsender.com/v2/received_faxes" \
  -u "your_api_key:your_api_secret"
const MedsenderAPI = require('medsender-phi');

const defaultClient = MedsenderAPI.ApiClient.instance;
const medsenderAuth = defaultClient.authentications['medsenderAuth'];
medsenderAuth.username = 'your_api_key'
medsenderAuth.password = 'your_client_secret'
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$config = MedsenderPHI\Configuration::getDefaultConfiguration()
              ->setUsername('your_api_key')
              ->setPassword('your_client_secret');
?>
ApiClient apiClient = Configuration.getDefaultApiClient();
HttpBasicAuth medsenderAuth = (HttpBasicAuth) apiClient.getAuthentication("medsenderAuth");
medsenderAuth.setUsername("your_api_key");
medsenderAuth.setPassword("your_client_secret");
require 'medsender_phi'

MedsenderAPI.configure do |config|
  config.username = 'your_api_key'
  config.password = 'your_client_secret'
end

api_instance = MedsenderAPI::ClientsApi.new
using MedsenderSDK.Api;
using MedsenderSDK.Client;
using MedsenderSDK.Model;

namespace Example
{
    public class Example
    {
        public static void Main()
        {
            Configuration.Default.Username = "your_api_key";
            Configuration.Default.Password = "your_client_secret";

            var apiInstance = new ClientsApi(Configuration.Default);
        }
    }
}
import medsenderphi

configuration = medsenderphi.Configuration(
    username = 'your_api_key',
    password = 'your_client_secret'
)

Make sure to replace your_client_secret and your_api_key with your keys.

Medsender uses API keys to allow access to the API. They give you full access to our API, so it's important that you keep them secure. Be sure not to share them with anyone outside your organization. We also advise you don't commit them to code repositories. Everyone is welcome to use our API! If you'd like to try us out, contact us at api@medsender.com and we'll email you your test environment keys.

All requests must contain an api_key and a client_secret, which you provide via HTTP Basic Auth. For basic auth, your username is your api key; and your password is your client secret.

Note: Implementing this step is necessary before using any of the below endpoints. Always include authentication before using any of the endpoints.

Sent Faxes

The Sent Fax Object

Attributes

from_number

The number this fax was sent from. Must be a number linked to your developer account. Either this number was ported into Medsender from your previous telecom provider, or it's a number we provisioned for you. We accept any fax number format, but we will always return it in +12223334444 format where +1 is the country code.

to_number

The number this fax was sent to. We accept any fax number format, but we will always return it in +12223334444 format where +1 is the country code.

patient_name

The name of the patient this record is associated with. When provided, we will include this in the cover sheet we generate.

patient_dob

The date of birth of the patient this record is associated with. Accepted format is YYYY-MM-DD.

note

A note that is included in the cover sheet of the document.

sender_name

The name of the person sending this record. Will be included in the cover sheet of the document.

recipient_name

The name of the intended recipient of this record. Will be included in the cover sheet of the document.

record_status

Can be activated, archived, or revoked. If the status is activated, then this record can be accessed digitally, and will be listed when getting all sent faxes by default. If the status is archived, then this record can still be accessed digitally, but will no longer be listed when getting all sent faxes by default. If the status is revoked, then this record can no longer be accessed digitally (using the access code on the cover sheet), and will no longer be listed in sent faxes by default.

send_token

A unique identifier used to keep track of a sent fax. This is what you will use as the ID to get the status of a sent fax.

expiry

The date and time, in ISO-8061 format, digital access to this record expires (using access code on the cover sheet). Digital access expires 30 days after the request is made to send the fax.

view_count

The number of times this record was viewed digitally using the access code.

sent_at

The date and time, in ISO-8061 format, this record was sent at. Returned in UTC timezone.

completed_at

The date and time, in ISO-8061 format, this record transmission was completed at. Returned in UTC timezone.

sent_status

Can be queued, inprogress, success, or failure. queued means the record has been queued for transmission. inprogress means the record has started being transmitted. success means the record was successfully sent. failure means we were unable to send the record. We attempt to send a record via fax 5 times before marking it as failure.

document_type

Can accept three string values: document_only, access_code_sheet_only, or both. document_only will send just the document, access_code_sheet_only will send only the access code sheet, and both will send the access code sheet along with the document.

error_details

A json object that contains more information on why a fax failed during transmission.

is_test

Whether this transmission was conducted using test API keys. If true, then we didn't actually send a fax. Everything is simulated as if a fax was actually sent.

A link to access the record that was sent. Is valid for 5 minutes once the sent fax object is created and returned to you.

Send PHI via Fax

Code to send a fax:

<?php
$config = MedsenderPHI\Configuration::getDefaultConfiguration()
              ->setUsername('your_api_key')
              ->setPassword('your_client_secret');

$apiInstance = new MedsenderPHI\Api\SentFaxesApi(
    new GuzzleHttp\Client(),
    $config
);
$file = "/path/to/file.pdf";
$from_number = 'your_fax_number';
$to_number = '9174732192';
$patient_name = 'Philip J. Fry';
$patient_dob = '1974-08-14';
$note = 'This document is a patient referral';
$sender_name = 'Dr. Hubert Farnsworth';
$recipient_name = 'Dr. John Zoidberg';
$document_type = '';
$callback_url = 'https://your.callback.url'

try {
    $result = $apiInstance->sendFax($file, $from_number, $to_number, $patient_name, $patient_dob, $note, $sender_name, $recipient_name, $document_type, $callback_url);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling SentFaxesApi->sendFax: ', $e->getMessage(), PHP_EOL;
}
?>
const fs = require('fs');

let apiInstance = new MedsenderAPI.SentFaxesApi();
let file = fs.createReadStream("/path/to/file.pdf");
let fromNumber = "your_fax_number";
let toNumber = "9174732192";
let opts = {
  'patientName': "Philip J. Fry",
  'patientDob': "1974-08-14",
  'note': "This document is a patient referral",
  'senderName': "Dr. Hubert Farnsworth",
  'recipientName': "Dr. John Zoidberg",
  'document_type': "",
  'callback_url': "https://your.callback.url"
};
apiInstance.sendFax(file, fromNumber, toNumber, opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});
SentFaxesApi apiInstance = new SentFaxesApi(defaultClient);
File file = new File("/path/to/file.pdf");
String fromNumber = "your_fax_number";
String toNumber = "9174732192";
String patientName = "Philip J. Fry";
String patientDob = "1974-08-14";
String note = "This document is a patient referral";
String senderName = "Dr. Hubert Farnsworth";
String recipientName = "Dr. John Zoidberg";
String documentType = "";
String callbackUrl = "https://your.callback.url";

try {
  SentFaxSuccessResponse result = apiInstance.sendFax(file, fromNumber, toNumber, patientName, patientDob, note, senderName, recipientName, documentType, callbackUrl);
  System.out.println(result);
} catch (ApiException e) {
  System.err.println("Exception when calling SentFaxesApi#sendFax");
}
api_instance = MedsenderAPI::SentFaxesApi.new
file = File.new('/path/to/file.pdf')
from_number = 'your_fax_number'
to_number = '9174732192'
opts = {
  patient_name: 'Philip J. Fry',
  patient_dob: '1974-08-14',
  note: 'This document is a patient referral',
  sender_name: 'Dr. Hubert Farnsworth',
  recipient_name: 'Dr. John Zoidberg',
  document_type: '',
  callback_url: 'https://your.callback.url'
}

begin
  result = api_instance.send_fax(file, from_number, to_number, opts)
  p result
rescue MedsenderAPI::ApiError => e
  puts "Exception when calling SentFaxesApi->send_fax: #{e}"
end
curl https://api.medsender.com/api/v2/sent_faxes \
-u your_api_key:your_client_secret \
-F file='@/path/to/file.pdf' \
-F from_number='your_fax_number' \
-F to_number='9174732192' \
-F patientName='Philip J. Fry' \
-F patientDob='1974-08-14' \
-F note='This document is a patient referral' \
-F senderName='Dr. Hubert Farnsworth' \
-F recipientName='Dr. John Zoidberg' \
-F document_type='' \
-F callbackUrl='https://your.callback.url'
var apiInstance = new SentFaxesApi(Configuration.Default);
var file = BINARY_DATA_HERE;  // System.IO.Stream | The file you'd like to send.
var fromNumber = "your_fax_number";
var toNumber = "9174732192";
var patientName = "Philip J. Fry";
var patientDob = "1974-08-14";
var note = "This document is a patient referral";
var senderName = "Dr. Hubert Farnsworth";
var recipientName = "Dr. John Zoidberg";
var documentType = "";
var callbackUrl = "https://your.callback.url";

try
{
    // Send PHI via Fax
    SentFaxSuccessResponse result = apiInstance.SendFax(file, fromNumber, toNumber, patientName, patientDob, note, senderName, recipientName, documentType, callbackUrl);
    Debug.WriteLine(result);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling SentFaxesApi.SendFax: " + e.Message );
    Debug.Print("Status Code: "+ e.ErrorCode);
    Debug.Print(e.StackTrace);
}
with medsenderphi.ApiClient(configuration) as api_client:
  api_instance = sent_faxes_api.SentFaxesApi(api_client)
  file = open('/path/to/file', 'rb')
  from_number = "your_fax_number"
  to_number = "9174732192"
  patient_name = "Philip J. Fry"
  patient_dob = "1974-08-14"
  note = "This document is a patient referral."
  sender_name = "Dr. Hubert Farnsworth"
  recipient_name = "Dr. John Zoidberg"
  document_type = ""
  callback_url = "https://your.callback.url"

  try:
    # Send PHI via Fax
    api_response = api_instance.send_fax(file, from_number, to_number, patient_name=patient_name, patient_dob=patient_dob, note=note, sender_name=sender_name, recipient_name=recipient_name, document_type=document_type, callback_url=callback_url)
    pprint(api_response)
  except medsenderphi.ApiException as e:
    print("Exception when calling SentFaxesApi->send_fax: %s\n" % e)

The above command will return JSON structured like this:

{
  "message": "Record has been sent, we will send a callback upon completion.",
  "faxId": "f5cfd99304f9"
}

This endpoint will queue your PHI file to be sent to any valid fax number. The response will contain the send token (noted as fax id) that you can use to keep track of the transmission. If the initial transmission fails, we keep retrying a total of 5 times before we consider the transmission a failure. Once the transmission completes or fails, we send a callback to your callback URL notifying you of the new transmission status. You can also check the status of the transmission using the Retrieve a sent fax.

We will provide a cover sheet which includes instructions for accessing the record via our platform. The cover sheet will also include metadata which you provide. The arguments sender_name, recipient_name, patient_name, and note you provide will be displayed on the cover sheet.

Arguments

file

The path to the file you'd like to send via fax. Must be a PDF or TIFF file. The file must contain less than 200 pages (199 excluding our cover sheet) and be less than 20 megabytes in size. We'll be adding other formats in the future.

from_number

The number you'd like to send the fax from. Can be provided in any phone number format. Must be a fax number linked to your developer account. To port your fax number over or provision a new fax number, please contact us at api@medsender.com.

to_number

The number you'd like to send the fax to. Can be provided in any phone number format.

patient_name

The name of the patient this record belongs to. If provided, will be listed on the cover sheet we generate.

patient_dob

The date of birth of the patient this record belongs to. Must be provided in YYYY-MM-DD format. Optional.

note

If provided, a note to include in the cover sheet of the fax. Usually a helpful description of the document to help the recipient.

sender_name

The name of the person sending this record. If provided, will be listed on the cover sheet we generate.

recipient_name

The name of the intended recipient of this record. If provided, will be listed on the cover sheet we generate.

document_type

Can accept three string values: document_only, access_code_sheet_only, or both. document_only will send just the document, access_code_sheet_only will send only the access code sheet, and both will send the access code sheet along with the document.

callback_url

The callback url to use when the fax has finished sending. If left blank, we'll use the callback url associated with the fax number you're sending from.

Response

If the arguments passed are valid, it will return the the send token (listed as fax ID) that you can then use to keep track of the transmission. If the arguments passed are invalid, we'll return an error object with more information.

Retrieve a sent fax

Code to retrieve a sent fax:

curl "https://api.medsender.com/api/v2/sent_faxes/:id" \
  -u "your_api_key:your_client_secret"
<?php
$config = MedsenderPHI\Configuration::getDefaultConfiguration()
              ->setUsername('your_api_key')
              ->setPassword('your_client_secret');


$apiInstance = new MedsenderPHI\Api\SentFaxesApi(
    new GuzzleHttp\Client(),
    $config
);

try {
    $result = $apiInstance->getSentFaxById('your_send_token');
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling SentFaxesApi->getSentFaxById: ', $e->getMessage(), PHP_EOL;
}
?>
const apiInstance = new MedsenderAPI.SentFaxesApi();
const faxId = "your_send_token"; // String | Fax ID
apiInstance.getSentFaxById(faxId).then((data) => {
  console.log('API called successfully. Returned data: ', data);
}, (error) => {
  console.error(error);
});
SentFaxesApi apiInstance = new SentFaxesApi(defaultClient);
try {
  SentFax result = apiInstance.getSentFaxById("your_send_token");
  System.out.println(result);
} catch (ApiException e) {
  System.err.println("Exception when calling SentFaxesApi#getSentFaxById");
}
api_instance = MedsenderAPI::SentFaxesApi.new
fax_id = 'your_send_token'

begin
  result = api_instance.get_sent_fax_by_id(fax_id)
  p result
rescue MedsenderAPI::ApiError => e
  puts "Exception when calling SentFaxesApi->get_sent_fax_by_id: #{e}"
end
var apiInstance = new SentFaxesApi(Configuration.Default);
var faxId = "c5ac4dd675d1";

try
{
    SentFax result = apiInstance.GetSentFaxById(faxId);
    Debug.WriteLine(result);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling SentFaxesApi.GetSentFaxById: " + e.Message );
    Debug.Print("Status Code: "+ e.ErrorCode);
    Debug.Print(e.StackTrace);
}
with medsenderphi.ApiClient(configuration) as api_client:
  api_instance = sent_faxes_api.SentFaxesApi(api_client)
  fax_id = "c5ac4dd675d1"
  try:
    api_response = api_instance.get_sent_fax_by_id(fax_id)
    pprint(api_response)
  except medsenderphi.ApiException as e:
    print("Exception when calling SentFaxesApi->get_sent_fax_by_id: %s\n" % e)

The above command will return JSON structured like this:

{
  "fromNumber": "+19177572947",
  "toNumber": "+19174732192",
  "recipientName": "Dr. John Zoidberg",
  "recordStatus": "activated",
  "patientName": "Philip J. Fry",
  "patientDob": "1974-08-14",
  "sendToken": "3e842d315d8f",
  "senderName": "Dr. Hubert Farnsworth",
  "expiry": "2020-03-21T23:37:01.000Z",
  "viewCount": 0,
  "note": "This document is a patient referral",
  "sentAt": "2020-02-20T23:37:01.000Z",
  "completedAt": "2020-02-20T23:37:04.000Z",
  "sentStatus": "success",
  "documentType": "both",
  "errorDetails": null,
  "isTest": true,
  "secureLink": "https://link.to.record"
}

Gets the details of a sent fax. Provide the send token of the fax that was returned when you sent it via our API.

Remember that 'your_send_token' is the fax id from the response of the previous endpoint.

Arguments

None

Response

This endpoint returns a sent fax object.

List all Sent Faxes

Code to retrieve all sent faxes:

curl "https://api.medsender.com/api/v2/sent_faxes" \
  -u "your_api_key:your_client_secret"
const apiInstance = new MedsenderAPI.SentFaxesApi();
const opts = {
  'fromNumber': '9178473555',
  'toNumber': '9178473555',
  'patientName': 'John Doe',
  'senderName': 'Dr. Farnsworth',
  'recipientName': 'Dr. Recipient',
  'dateStart': '1994-02-22',
  'dateEnd': '2020-01-20',
  'patientDob': '2000-01-20',
  'isTest': true,
  'page': 1,
  'pageSize': 50
};
apiInstance.getSentFaxes(opts).then((data) => {
  console.log(data);
}, (error) => {
  console.error(error);
});

SentFaxesApi apiInstance = new SentFaxesApi(defaultClient);
String fromNumber = "9178473555";
String toNumber = "9178473555";
String patientName = "John Doe";
String senderName = "Dr. Farnsworth";
String recipientName = "Dr. Recipient";
String dateStart = "1994-02-22";
String dateEnd = "2020-01-20";
String patientDob = "2000-01-20";
Boolean isTest = true;
Integer page = 1;
Integer pageSize = 50;
try {
  SentFaxesSuccessResponse result = apiInstance.getSentFaxes(fromNumber, toNumber, patientName, senderName, recipientName, dateStart, dateEnd, patientDob, isTest, page, pageSize);
  System.out.println(result);
} catch (ApiException e) {
  System.err.println("Exception when calling SentFaxesApi#getSentFaxes");
}
<?php

$config = MedsenderPHI\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');


$apiInstance = new MedsenderPHI\Api\SentFaxesApi(
    new GuzzleHttp\Client(),
    $config
);
$from_number = '9178473555';
$to_number = '9178473555';
$patient_name = 'John Doe';
$sender_name = 'Dr. Farnsworth';
$recipient_name = 'Dr. Recipient';
$date_start = '1994-02-22';
$date_end = '2020-01-20';
$patient_dob = '2000-01-20';
$is_test = true;
$page = 1;
$page_size = 50;

try {
    $result = $apiInstance->getSentFaxes($from_number, $to_number, $patient_name, $sender_name, $recipient_name, $date_start, $date_end, $patientDob, $is_test, $page, $page_size);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling SentFaxesApi->getSentFaxes: ', $e->getMessage(), PHP_EOL;
}
?>
api_instance = MedsenderAPI::SentFaxesApi.new
opts = {
  from_number: '9178473555',
  to_number: '9178473555',
  patient_name: 'John Doe',
  sender_name: 'Dr. Farnsworth',
  recipient_name: 'Dr. Recipient',
  date_start: '1994-02-22',
  date_end: '2020-01-20',
  is_test: true,
  page: 1,
  page_size: 50
}

begin
  result = api_instance.get_sent_faxes(opts)
  p result
rescue MedsenderAPI::ApiError => e
  puts "Exception when calling SentFaxesApi->get_sent_faxes: #{e}"
end
var apiInstance = new SentFaxesApi(Configuration.Default);
var fromNumber = "9178473555";
var toNumber = "9178473555";
var patientName = "John Doe";
var senderName = "Dr. Farnsworth";
var recipientName = "Dr. Recipient";
var dateStart = "1994-02-22";
var dateEnd = "2020-01-20";
var patientDob = "2000-01-20";
var isTest = true;
var page = 1;
var pageSize = 10;

try
{
    SentFaxesSuccessResponse result = apiInstance.GetSentFaxes(fromNumber, toNumber, patientName, senderName, recipientName, dateStart, dateEnd, patientDob, isTest, page, pageSize);
    Debug.WriteLine(result);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling SentFaxesApi.GetSentFaxes: " + e.Message );
    Debug.Print("Status Code: "+ e.ErrorCode);
    Debug.Print(e.StackTrace);
}
with medsenderphi.ApiClient(configuration) as api_client:
  api_instance = sent_faxes_api.SentFaxesApi(api_client)
  from_number = "9178473555"
  to_number = "9178473555"
  patient_name = "John Doe"
  sender_name = "Dr. Farnsworth"
  recipient_name = "Dr. Recipient"
  date_start = "1994-02-22"
  date_end = "2020-01-20"
  patient_dob = "2000-01-20"
  is_test = True
  page = 1
  page_size = 10

  try:
    api_response = api_instance.get_sent_faxes(from_number=from_number, to_number=to_number, patient_name=patient_name, sender_name=sender_name, recipient_name=recipient_name, date_start=date_start, date_end=date_end, patient_dob=patient_dob, is_test=is_test, page=page, page_size=page_size)
    pprint(api_response)
  except medsenderphi.ApiException as e:
    print("Exception when calling SentFaxesApi->get_sent_faxes: %s\n" % e)

The above command will return JSON structured like this:

{
  "sentFaxes": [
    {
      "fromNumber": "+19177572947",
      "toNumber": "+19174732192",
      "recipientName": "Dr. John Zoidberg",
      "recordStatus": "activated",
      "patientName": "Philip J. Fry",
      "patientDob": "1974-08-14",
      "sendToken": "3e842d315d8f",
      "senderName": "Dr. Hubert Farnsworth",
      "expiry": "2020-03-21T23:37:01.000Z",
      "viewCount": 0,
      "note": "This document is a patient referral",
      "sentAt": "2020-02-20T23:37:01.000Z",
      "completedAt": "2020-02-20T23:37:04.000Z",
      "sentStatus": "success",
      "documentType": "both",
      "errorDetails": null,
      "isTest": true,
      "secureLink": "https://link.to.record"
    }
  ],
  "meta": {
    "totalCount": 1,
    "totalPages": 1,
    "perPage": 10,
    "page": 1
  }
}

Returns a list of all faxes you've previously sent. By default, the endpoint orders the returned sent faxes using the latest creation date. We also allow filtering via query parameters.

Arguments

from_number

The fax number you used to send the fax. Can be provided in any phone number format.

to_number

The fax number you sent the fax to. Can be provided in any phone number format.

sender_name

The name of the person who sent this record.

recipient_name

The name of the intended recipient of this record.

patient_name

Filter the sent faxes by the patient name.

patient_dob

Filter the sent faxes by the patient name. Must be specified in YYYY-MM-DD format.

date_start

Inclusively filter faxes beginning by the date they were received. Must be specified in YYYY-MM-DD format.

date_end

Inclusively filter faxes ending by the date they were sent. Must be specified in YYYY-MM-DD format.

order_by_date

Order the results in either asc (ascending) or dsc (descending). Default is descending.

is_test

Filter results based on whether they were test transmission or not. Default is false, only return real transmissions.

page

We paginate our results, with 10 results per page. You can specify which page to view using this parameter.

page_size

The number of results to show per page. Default is 10. Allowed values are 1 to 100, inclusive.

Returns

An array of sentFaxes which contains SentFax objects. If you have no sent faxes, we will return an empty array. If there was an error with the request, we'll return an error object explaining why.

Emails

The Email object

Attributes

recipient_email

The email the file was sent to. This can be any valid email e.g john.doe@medsender.com

recipient_name

The name of the recipient.

sender_name

The name of the user sending the email.

reply_to_email

The email the recipient will reply to if they click on reply in their email client. We send all our emails from no-reply@medsender.com, but with the reply to email flag, when the recipient clicks on reply it'll use that email to reply to instead. Be careful though, we can't ensure the reply to email is secure if you provide your own.

patient_name

The name of the patient this record is associated with.

patient_dob

The date of birth of the patient this record is associated with. Accepted format is YYYY-MM-DD.

record_status

The status of the record to be digitally accesed through the secure-link, can be active, archived or revoked.

email_status

The status of the email sent.

subject

The subject of the email.

note

The note to be displayed on the body of the email.

email_id

A unique identifier used to keep track of a sent email. This is what you will use as the emailId to get the status of a sent email.

expiry

The date and time, in ISO-8061 format, digital access to this record expires (using the secure link in the email).

sent_at

The date and time, in ISO-8061 format, this email was sent. Returned in UTC timezone.

last_viewed_at

The date and time, in ISO-8061 format, the document was viewed. Returned in UTC timezone.

error

Contain details about the email transmission error i.e error_code, error_message

Code to send a secure email link:

  <?php
    $apiInstance = new MedsenderPHI\Api\EmailsApi(
        new GuzzleHttp\Client(),
        $config
    );

    $file = "/path/to/file.txt";
    $recipient_email = 'recipient_email_example';
    $sender_name = 'sender_name_example';
    $recipient_name = 'recipient_name_example';
    $reply_to_email = 'reply_to_email_example';
    $patient_name = 'patient_name_example';
    $patient_dob = 'patient_dob_example';
    $subject = 'subject_example';
    $note = 'note_example';
    $expire_after = 56;
    $callback_url = 'callback_url_example';
    try {
        $result = $apiInstance->sendEmail($file, $recipient_email, $sender_name, $recipient_name, $reply_to_email, $patient_name, $patient_dob, $subject, $note, $expire_after, $callback_url);
        print_r($result);
    } catch (Exception $e) {
        echo 'Exception when calling EmailsApi->sendEmail: ', $e->getMessage(), PHP_EOL;
    }
  ?>
  curl https://api.medsender.com/api/v2/emails \
  -u your_api_key:your_client_secret \
  -F file='@/path/to/file.pdf' \
  -F recipientEmail='recipients_email' \
  -F recipientName='Dr. John Zoidberg' \
  -F senderName='recipients_email' \
  -F replyToEmail='support@medsemder.com' \
  -F patientName='Philip J. Fry' \
  -F patientDob='1974-08-14' \
  -F subject='subject' \
  -F note='This document is a patient referral' \
  -F expireAfter='90' \
  -F callbackUrl='https://example.com/webhook' \

The above command will return JSON structured like this:

  {
    "message": "Record has been sent, we will send a callback upon completion.",
    "emailId": "f5cfd99304f9"
  }

This endpoint will send an email to the recipient's address. The response will contain the email_id that you can use to check status of the transmitted PHI.

The developer will send an email which includes instructions for accessing the record via our platform.

Arguments

file

The path to the file you'd like to send via email. Must be a PDF file. The file must contain less than 200 pages and be less than 20 megabytes in size. We'll be adding other formats in the future. Required

recipient_email

The email address you'd like to send the email to. Required.

sender_name

The name of the person sending this record. If provided, will be listed on the cover sheet we generate. Required.

recipient_name

The name of the recipient.

reply_to_email

The email address the recipients will respond to.

patient_name

The name of the patient this record belongs to.

patient_dob

The date of birth of the patient this record belongs to. Must be provided in YYYY-MM-DD format. Optional.

subject

If provided, will appear as the subject of the email. Usually a helpful description of the document to help the recipient.

note

If provided, a note to include in the body of the email. Usually a helpful description of the document to help the recipient.

expire_after

The number of days before the secure email link expiry. It Should be an Integer between 1 and 180 days.

callback_url

The http(s) callback trigger, only happens if the callback url is supplied.

Response

If the arguments passed are valid, it will return the the email id that you can then use to get details of the transmission. If the arguments passed are invalid, we'll return an error object with more information.

Retrieve details of the sent email

Code to retrieve the details of the email sent:

curl "https://api.medsender.com/api/v2/emails/c5ac4dd675d1" \
  -u "your_api_key:your_client_secret"
  <?php
  $apiInstance = new MedsenderPHI\Api\EmailsApi(
      new GuzzleHttp\Client(),
      $config
  );
  $email_id = 'c5ac4dd675d1';
  try {
      $result = $apiInstance->getEmailById($email_id);
      print_r($result);
  } catch (Exception $e) {
      echo 'Exception when calling EmailsApi->getEmailById: ', $e->getMessage(), PHP_EOL;
  }

The above command will return JSON structured like this:

{
  "recipientEmail": "john.doe@example.com",
  "recipientName": "John Doe",
  "secureLink": "string",
  "senderName": "Dr. Farnsworth",
  "patientName": "John Doe",
  "patientDob": {},
  "emailStatus": "string",
  "sendToken": "string",
  "recordStatus": "string",
  "sentAt": "2021-09-30T07:24:53.891Z",
  "subject": "Secure Link to View Document.",
  "note": "This is a patient referral.",
  "expiry": "2021-09-30T07:24:53.891Z",
  "lastViewedAt": "2021-09-30T07:24:53.891Z",
  "error": null
}

Gets the details of a sent email. Provide the emailId on the Send Link Via Email endpoint response.

Arguments

None

Response

It will return a response object with details about the sent email.

Received Faxes

The Received Fax Object

Attributes

from_number

The number you received this fax from. Returned in +12223334444 format where +1 is the country code.

to_number

The number this fax was sent to. Must be a number linked to your developer account. Either this number was ported into Medsender from your previous telecom provider, or it's a number we provisioned for you. We accept any fax number format, but we will always return it in +12223334444 format where +1 is the country code.

file

The file received via fax. Only returned during the callback request we make when you receive fax to your number.

send_token

A unique identifier used to keep track of a received fax. This is what you will use as the ID to get the status of a sent fax.

sent_at

The date and time, in ISO-8061 format, this record was sent at. Returned in UTC timezone.

completed_at

The date and time, in ISO-8061 format, this record transmission was completed at. Returned in UTC timezone.

num_pages

The number of pages this fax contains.

fax_status

Can be success or failure. success means the record was successfully sent. failure means we were unable to send the record. We attempt to send a record via fax 5 times before marking it as failure.

caller_name

The caller ID associated with the fax number of the sender. Sometimes, this isn't provided by the sender.

error_details

A json object that contains more information on why a fax failed during transmission.

is_test

Whether this transmission was conducted using test API keys. If true, then we didn't actually receive a fax. Everything is simulated as if a fax was actually received.

A link to access the record that was sent. Is valid for 5 minutes once the sent fax object is created and returned to you. Only returned if getting an individual received fax.

client

The client ID associated with this received fax. Developers can create clients to better organize faxes. You can assign fax numbers to clients. Whenever you receive a fax, we assign it to the client associated with the fax number.

Receive PHI via Fax

Whenever Medsender receives a fax to a number linked to your developer account, we send a callback request to your specified callback URL. The request contains a Received Fax object. You can verify the request came from Medsender by hashing the send_token, completed_at, and your API key and comparing the result with the X-Medsender-Signature header we include with the request.

Retrieve a Received Fax

Code to retrieve a received fax:

curl "https://api.medsender.com/api/v2/received_faxes/:id" \
  -u "your_api_key:your_client_secret"
<?php
$config = MedsenderPHI\Configuration::getDefaultConfiguration()
              ->setUsername('your_api_key')
              ->setPassword('your_client_secret');

$apiInstance = new MedsenderPHI\Api\ReceivedFaxesApi(
    new GuzzleHttp\Client(),
    $config
);

try {
    $result = $apiInstance->getReceivedFaxById('your_send_token');
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ReceivedFaxesApi->getReceivedFaxById: ', $e->getMessage(), PHP_EOL;
}
?>
let apiInstance = new MedsenderAPI.ReceivedFaxesApi();
apiInstance.getReceivedFaxById("your_send_token").then((data) => {
  console.log(data);
}, (error) => {
  console.log(error);
});
ReceivedFaxesApi apiInstance = new ReceivedFaxesApi(defaultClient);
try {
  ReceivedFax result = apiInstance.getReceivedFaxById("your_send_token");
  System.out.println(result);
} catch (ApiException e) {
  System.err.println("Exception when calling ReceivedFaxesApi#getReceivedFaxById");
}
api_instance = MedsenderAPI::ReceivedFaxesApi.new
fax_id = 'your_send_token'

begin
  result = api_instance.get_received_fax_by_id(fax_id)
  p result
rescue MedsenderAPI::ApiError => e
  puts "Exception when calling ReceivedFaxesApi->get_received_fax_by_id: #{e}"
end
var apiInstance = new ReceivedFaxesApi(Configuration.Default);
var faxId = "c5ac4dd675d1";

try
{
    ReceivedFax result = apiInstance.GetReceivedFaxById(faxId);
    Debug.WriteLine(result);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling ReceivedFaxesApi.GetReceivedFaxById: " + e.Message );
    Debug.Print("Status Code: "+ e.ErrorCode);
    Debug.Print(e.StackTrace);
}
with medsenderphi.ApiClient(configuration) as api_client:
  api_instance = received_faxes_api.ReceivedFaxesApi(api_client)
  fax_id = "c5ac4dd675d1"

  try:
    api_response = api_instance.get_received_fax_by_id(fax_id)
    pprint(api_response)
  except medsenderphi.ApiException as e:
    print("Exception when calling ReceivedFaxesApi->get_received_fax_by_id: %s\n" % e)

The above command will return JSON structured like this:

{
  "fromNumber": "+9135758385",
  "toNumber": "+12076077796",
  "sendToken": "887183cc2a5f",
  "callerName": "TEST HOSPITAL",
  "sentAt": "2020-02-18T00:00:00.000Z",
  "completedAt": "2020-02-18T23:59:59.000Z",
  "numPages": 3,
  "isTest": true,
  "faxStatus": "success",
  "errorDetails": null,
  "client": "42486f1b-9297-401e-a3f4-869ce409c927",
  "secureLink": "https://link.to.record"
}

Gets the details of a received fax. Provide the send token of the fax that was returned when you received it.

Remember that 'your_send_token' here is the fax id for received faxes; not sent faxes.

Arguments

None

Response

This endpoint returns a received fax object.

Forward a Received Fax

This endpoint will queue a received PHI file to be forwarded to any valid fax number. The response will contain the send token (noted as fax id) that you can use to keep track of the transmission. If the initial transmission fails, we keep retrying a total of 5 times before we consider the transmission a failure. Once the transmission completes or fails, we send a callback to your callback URL notifying you of the new transmission status. You can also check the status of the transmission using the Retrieve a sent fax.

We will provide a cover sheet which includes instructions for accessing the record via our platform. The cover sheet will also include metadata which you provide. The arguments sender_name, recipient_name, patient_name, and note you provide will be displayed on the cover sheet.

Code to forward a received fax:

curl https://api.medsender.com/api/v2/sent_faxes \
-u your_api_key:your_client_secret \
-F patientName='Bob' \
-F patientDob='1990-02-15' \
-F fromNumber='your_fax_number' \
-F toNumber='9174732192' \
-F senderName='Dr. Hubert Farnsworth' \
-F recipientName='Dr. John Zoidberg' \
-F note='This document is a patient referral'\
-F documentType='' \
-F callbackUrl='https://your.callback.url'
let apiInstance = new MedsenderAPI.ReceivedFaxesApi();
let faxId = 'c5ac4dd675d1'; // String | The send token associated with the received fax.
let toNumber = "9174732192";
let opts = {
  'fromNumber': "your_fax_number", // String | The fax number you'd like to send from. Must be a fax number linked to your developer account.
  'patientName': "Philip J. Fry",
  'patientDob': "1974-08-14",
  'note': "This document is a patient referral",
  'senderName': "Dr. Hubert Farnsworth",
  'recipientName': "Dr. John Zoidberg",
  'documentType': "",
  'callback_url': "https://your.callback.url"
};
apiInstance.forwardReceivedFax(faxId, toNumber, opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure HTTP basic authorization: medsenderAuth
$config = MedsenderPHI\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');
$apiInstance = new MedsenderPHI\Api\ReceivedFaxesApi(
    new GuzzleHttp\Client(),
    $config
);

$fax_id = 'c5ac4dd675d1';
$to_number = '9174732192';
$from_number = 'your_fax_number';
$patient_name = 'Philip J. Fry';
$patient_dob = '1974-08-14';
$note = 'This document is a patient referral';
$sender_name = 'Dr. Hubert Farnsworth';
$recipient_name = 'Dr. John Zoidberg';
$document_type = '';
$callback_url = 'https://your.callback.url';

try {
    $result = $apiInstance->forwardReceivedFax($fax_id, $to_number, $from_number, $patient_name, $patient_dob, $note, $sender_name, $recipient_name, $document_type, $callback_url);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ReceivedFaxesApi->forwardReceivedFax: ', $e->getMessage(), PHP_EOL;
}
?>
api_instance = MedsenderAPI::ReceivedFaxesApi.new
fax_id = 'c5ac4dd675d1' # String | The send token associated with the received fax.
to_number = '9174732192'
opts = {
  from_number: 'your_fax_number',
  patient_name: 'Philip J. Fry',
  patient_dob: '1974-08-14',
  note: 'This document is a patient referral',
  sender_name: 'Dr. Hubert Farnsworth',
  recipient_name: 'Dr. John Zoidberg',
  document_type: '',
  callback_url: 'https://your.callback.url'
}

begin
  #Forward received PHI via fax.
  result = api_instance.forward_received_fax(fax_id, to_number, opts)
  p result
rescue MedsenderAPI::ApiError => e
  puts "Exception when calling ReceivedFaxesApi->forward_received_fax: #{e}"
end
ReceivedFaxesApi apiInstance = new ReceivedFaxesApi(defaultClient);
String faxId = "c5ac4dd675d1";
String toNumber = "9174732192";
String fromNumber = "your_fax_number";
String patientName = "Philip J. Fry";
String patientDob = "1974-08-14";
String note = "This document is a patient referral";
String senderName = "Dr. Hubert Farnsworth";
String recipientName = "Dr. John Zoidberg";
Boolean documentType = "";
String callbackUrl = "https://your.callback.url";
try {
  SentFaxSuccessResponse result = apiInstance.forwardReceivedFax(faxId, toNumber, fromNumber, patientName, patientDob, note, senderName, recipientName, documentType, callbackUrl);
  System.out.println(result);
} catch (ApiException e) {
  System.err.println("Exception when calling ReceivedFaxesApi#forwardReceivedFax");
  System.err.println("Status code: " + e.getCode());
  System.err.println("Reason: " + e.getResponseBody());
  System.err.println("Response headers: " + e.getResponseHeaders());
  e.printStackTrace();
}
var apiInstance = new ReceivedFaxesApi(Configuration.Default);
var faxId = "c5ac4dd675d1";
var toNumber = "9174732192";
var fromNumber = "your_fax_number";
var patientName = "Philip J. Fry";
var patientDob = "1974-08-14";
var note = "This document is a patient referral";
var senderName = "Dr. Hubert Farnsworth";
var recipientName = "Dr. John Zoidberg";
var documentType = "";
var callbackUrl = "https://your.callback.url;

try
{
    SentFaxSuccessResponse result = apiInstance.ForwardReceivedFax(faxId, toNumber, fromNumber, patientName, patientDob, note, senderName, recipientName, documentType, callbackUrl);
    Debug.WriteLine(result);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling ReceivedFaxesApi.ForwardReceivedFax: " + e.Message );
    Debug.Print("Status Code: "+ e.ErrorCode);
    Debug.Print(e.StackTrace);
}
with medsenderphi.ApiClient(configuration) as api_client:
  api_instance = received_faxes_api.ReceivedFaxesApi(api_client)
  fax_id = "c5ac4dd675d1"
  to_number = "9174732192"
  from_number = "your_fax_number"
  patient_name = "Philip J. Fry"
  patient_dob = "1974-08-14"
  note = "This is a patient referral."
  sender_name = "Dr. Hubert Farnsworth"
  recipient_name = "Dr. John Zoidberg"
  document_type = ""
  callback_url = "https://your.callback.url"

  try:
    api_response = api_instance.forward_received_fax(fax_id, to_number, from_number=from_number, patient_name=patient_name, patient_dob=patient_dob, note=note, sender_name=sender_name, recipient_name=recipient_name, document_type=document_type, callback_url=callback_url)
    pprint(api_response)
  except medsenderphi.ApiException as e:
    print("Exception when calling ReceivedFaxesApi->forward_received_fax: %s\n" % e)

The above command will return JSON structured like this:

{
  "message": "Record has been sent, we will send a callback upon completion.",
  "faxId": "f5cfd99304f9"
}

Arguments

from_number

The number you'd like to send the fax from. Can be provided in any phone number format. Must be a fax number linked to your developer account. To port your fax number over or provision a new fax number, please contact us at api@medsender.com.

to_number

The number you'd like to send the fax to. Can be provided in any phone number format.

patient_name

The name of the patient this record belongs to. If provided, will be listed on the cover sheet we generate.

patient_dob

The date of birth of the patient this record belongs to. Must be provided in YYYY-MM-DD format. Optional.

note

If provided, a note to include in the cover sheet of the fax. Usually a helpful description of the document to help the recipient.

sender_name

The name of the person sending this record. If provided, will be listed on the cover sheet we generate.

recipient_name

The name of the intended recipient of this record. If provided, will be listed on the cover sheet we generate.

document_type

Can accept three string values: document_only, access_code_sheet_only, or both. document_only will send just the document, access_code_sheet_only will send only the access code sheet, and both will send the access code sheet along with the document.

callback_url

The callback url to use when the fax has finished sending. If left blank, we'll use the callback url associated with the fax number you're sending from.

Response

If the arguments passed are valid, it will return the send token (listed as fax ID) that you can then use to keep track of the transmission. If the arguments passed are invalid, we'll return an error object with more information.

List all Received Faxes

Code to retrieve all received faxes:

curl "https://api.medsender.com/api/v2/received_faxes" \
  -u "your_api_key:your_client_secret"
<?php
$config = MedsenderPHI\Configuration::getDefaultConfiguration()
              ->setUsername('your_api_key')
              ->setPassword('your_client_secret');


$apiInstance = new MedsenderPHI\Api\ReceivedFaxesApi(
    new GuzzleHttp\Client(),
    $config
);

$from_number = "";
$to_number = "";
$caller_name = "";
$fax_status = "";
$date_start = "";
$date_end = "";
$order_by_date = "";
$is_test = false;
$client = "";
$callback_status = "success";
$page = 1;
$page_size = 50;

try {
    $result = $apiInstance->getReceivedFaxes($from_number, $to_number, $caller_name, $fax_status, $date_start, $date_end, $order_by_date, $is_test, $client, $callback_status, $page, $page_size);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ReceivedFaxesApi->getReceivedFaxes: ', $e->getMessage(), PHP_EOL;
}
?>
const apiInstance = new MedsenderAPI.ReceivedFaxesApi();
const opts = {
  'fromNumber': "",
  'toNumber': "",
  'callerName': "",
  'faxStatus': "",
  'dateStart': "",
  'dateEnd': "",
  'orderByDate': "",
  'isTest': false,
  'client': "",
  'callbackStatus': "success",
  'page': 1,
  'pageSize': 50
};
apiInstance.getReceivedFaxes(opts).then(function(data) {
  console.log(data);
}, function(error) {
  console.error(error);
});
ReceivedFaxesApi apiInstance = new ReceivedFaxesApi(defaultClient);
String fromNumber = "";
String toNumber = "";
String callerName = "";
String faxStatus = "";
String dateStart = "";
String dateEnd = "";
String orderByDate = "";
Boolean isTest = false;
String client = "";
String callbackStatus = "success";
Integer page = 1;
Integer pageSize = 50;
try {
  ReceivedFaxesSuccessResponse result = apiInstance.getReceivedFaxes(fromNumber, toNumber, callerName, faxStatus, dateStart, dateEnd, orderByDate, isTest, client, callbackStatus, page, pageSize);
  System.out.println(result);
} catch (ApiException e) {
  System.err.println("Exception when calling ReceivedFaxesApi#getReceivedFaxes");
}
api_instance = MedsenderAPI::ReceivedFaxesApi.new
opts = {
  from_number: '',
  to_number: '',
  caller_name: '',
  fax_status: '',
  date_start: '',
  date_end: '',
  order_by_date: '',
  is_test: false,
  client: '',
  callback_status: 'success',
  page: 1,
  page_size: 50
}

begin
  result = api_instance.get_received_faxes(opts)
  p result
rescue MedsenderAPI::ApiError => e
  puts "Exception when calling ReceivedFaxesApi->get_received_faxes: #{e}"
end
var apiInstance = new ReceivedFaxesApi(Configuration.Default);
var fromNumber = "9178473555";
var toNumber = "9178473555";
var callerName = "Doe County Hospital";
var faxStatus = "success";
var dateStart = "1994-02-22";
var dateEnd = "2020-01-20";
var orderByDate = "asc";
var isTest = true;
var _client = "b9ef49db-b8ce-446b-9698-2f109a6f1660";
var callbackStatus = "success";
var page = 1;
var pageSize = 10;

try
{
    ReceivedFaxesSuccessResponse result = apiInstance.GetReceivedFaxes(fromNumber, toNumber, callerName, faxStatus, dateStart, dateEnd, orderByDate, isTest, _client, callbackStatus, page, pageSize);
    Debug.WriteLine(result);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling ReceivedFaxesApi.GetReceivedFaxes: " + e.Message );
    Debug.Print("Status Code: "+ e.ErrorCode);
    Debug.Print(e.StackTrace);
}
with medsenderphi.ApiClient(configuration) as api_client:
  # Create an instance of the API class
  api_instance = received_faxes_api.ReceivedFaxesApi(api_client)
  from_number = "9178473555"
  to_number = "9178473555"
  caller_name = "Doe County Hospital"
  fax_status = "success"
  date_start = "1994-02-22"
  date_end = "2020-01-20"
  order_by_date = "asc"
  is_test = True
  client = "b9ef49db-b8ce-446b-9698-2f109a6f1660"
  callback_status = "callback_status_example"
  page = 1
  page_size = 10

  try:
    # Get Past Received Faxes
    api_response = api_instance.get_received_faxes(from_number=from_number, to_number=to_number, caller_name=caller_name, fax_status=fax_status, date_start=date_start, date_end=date_end, order_by_date=order_by_date, is_test=is_test, client=client, callback_status=callback_status, page=page, page_size=page_size)
    pprint(api_response)
  except medsenderphi.ApiException as e:
    print("Exception when calling ReceivedFaxesApi->get_received_faxes: %s\n" % e)

The above command will return JSON structured like this:

{
  "receivedFaxes": [
    {
      "fromNumber": "+9135758385",
      "toNumber": "+12076077796",
      "sendToken": "887183cc2a5f",
      "callerName": "TEST HOSPITAL",
      "sentAt": "2020-02-18T00:00:00.000Z",
      "completedAt": "2020-02-18T23:59:59.000Z",
      "numPages": 3,
      "isTest": false,
      "faxStatus": "success",
      "callbackStatus": "success",
      "errorDetails": null,
      "client": "42486f1b-9297-401e-a3f4-869ce409c927"
    }
  ],
  "meta": {
    "totalCount": 1,
    "totalPages": 1,
    "perPage": 10,
    "page": 1
  }
}

Returns a list of all faxes you've previously received. By default, the endpoint returns all received faxes with the latest faxes received first. We also allow filtering via query parameters.

Arguments

from_number

The fax number you received the fax from. Can be provided in any phone number format.

to_number

The fax number you received the fax to. Can be provided in any phone number format. Must be a number linked to your developer account.

caller_name

The caller ID associated with the fax number of the sender. Sometimes, this isn't provided by the sender.

fax_status

Only return faxes that were either success or failure.

date_start

Inclusively filter faxes beginning by the date they were received. Must be specified in YYYY-MM-DD format.

date_end

Inclusively filter faxes ending by the date they were received. Must be specified in YYYY-MM-DD format.

order_by_date

Order the results in either asc (ascending) or dsc (descending). Default is descending.

is_test

Filter results based on whether they were test transmission or not. Default is false, only return real transmissions.

client

The client ID to filter for. Will only return faxes belonging to fax numbers linked to this client.

callback_status

The status of the callback sent when receiving a fax. Can be either pending, success, or failed.

page

We paginate our results, with 10 results per page. You can specify which page to view using this parameter.

page_size

The number of results to show per page. Default is 10. Allowed values are 1 to 100, inclusive.

Returns

An array of receivedFaxes which contains ReceivedFax objects. If you have no received faxes, we will return an empty array. If there was an error with the request, we'll return an error object explaining why.

Fax Numbers

The Fax Number Object

Attributes

id

A unique ID used to identify the fax number.

number

The fax number linked to your developer account.

client

An object representing a client linked to this fax number. Contains the client_id and name of the client.

callback_url

The callback URL to be used when sending or receiving from this fax number.

uri

The link to the view this fax number.

Retrieve a fax number

Code to retrieve a fax number:

curl "https://api.medsender.com/api/v2/fax_numbers/:id" \
  -u "your_api_key:your_client_secret"
<?php
$config = MedsenderPHI\Configuration::getDefaultConfiguration()
              ->setUsername('your_api_key')
              ->setPassword('your_client_secret');


$apiInstance = new MedsenderPHI\Api\FaxNumberApi(
    new GuzzleHttp\Client(),
    $config
);

$fax_number_id = "your_fax_number_id";

try {
    $result = $apiInstance->getFaxNumberById($fax_number_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling FaxNumberApi->getFaxNumberById: ', $e->getMessage(), PHP_EOL;
}
?>
const apiInstance = new MedsenderAPI.FaxNumberApi();
const faxNumberId = "your_fax_number_id";
apiInstance.getFaxNumberById(faxNumberId).then((data) => {
  console.log(data);
}, (error) => {
  console.log(error);
});
FaxNumberApi apiInstance = new FaxNumberApi(defaultClient);
String faxNumberId = "your_fax_number_id";
try {
  FaxNumberSuccessResponse result = apiInstance.getFaxNumberById(faxNumberId);
  System.out.println(result);
} catch (ApiException e) {
  System.err.println("Exception when calling FaxNumberApi#getFaxNumberById");
}
api_instance = MedsenderAPI::FaxNumberApi.new
fax_number_id = 'your_fax_number_id'

begin
  result = api_instance.get_fax_number_by_id(fax_number_id)
  p result
rescue MedsenderAPI::ApiError => e
  puts "Exception when calling FaxNumberApi->get_fax_number_by_id: #{e}"
end
var apiInstance = new FaxNumberApi(Configuration.Default);
var faxNumberId = "ab726e43-dbfe-48ce-9a3a-ed0fa60f2504";

try
{
    FaxNumberSuccessResponse result = apiInstance.GetFaxNumberById(faxNumberId);
    Debug.WriteLine(result);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FaxNumberApi.GetFaxNumberById: " + e.Message );
    Debug.Print("Status Code: "+ e.ErrorCode);
    Debug.Print(e.StackTrace);
}
with medsenderphi.ApiClient(configuration) as api_client:
  api_instance = fax_number_api.FaxNumberApi(api_client)
  fax_number_id = "ab726e43-dbfe-48ce-9a3a-ed0fa60f2504"

  try:
    api_response = api_instance.get_fax_number_by_id(fax_number_id)
    pprint(api_response)
  except medsenderphi.ApiException as e:
    print("Exception when calling FaxNumberApi->get_fax_number_by_id: %s\n" % e)

The above command will return JSON structured like this:

{
  "faxNumber": {
    "id": "4110ad4e-b5a9-438f-a3eb-a81a75c3400b",
    "number": "+12076077796",
    "client": {
      "clientId": "42486f1b-9297-401e-a3f4-869ce409c927",
      "name": "Client clinic"
    },
    "callbackUrl": "https://your.callback.url",
    "uri": "https://api.medsender.com/api/v2/fax_numbers/4110ad4e-b5a9-438f-a3eb-a81a75c3400b"
  }
}

Retrieve a specific fax number linked to your developer account using it's ID.

Arguments

None

Returns

A FaxNumber object. If you have no fax numbers, we will return an empty object. If there was an error with the request, we'll return an error object explaining why.

Retrieve all fax numbers

Code to retrieve all fax numbers:

curl "https://api.medsender.com/api/v2/fax_numbers" \
  -u "your_api_key:your_client_secret"
<?php
$config = MedsenderPHI\Configuration::getDefaultConfiguration()
              ->setUsername('your_api_key')
              ->setPassword('your_client_secret');


$apiInstance = new MedsenderPHI\Api\FaxNumberApi(
    new GuzzleHttp\Client(),
    $config
);
try {
    $result = $apiInstance->getAllFaxNumbers();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling FaxNumberApi->getAllFaxNumbers: ', $e->getMessage(), PHP_EOL;
}
?>
const apiInstance = new MedsenderAPI.FaxNumberApi();
apiInstance.getAllFaxNumbers().then((data) => {
  console.log(data);
}, (error) => {
  console.log(error);
});
FaxNumberApi apiInstance = new FaxNumberApi(defaultClient);
try {
  FaxNumbersSuccessResponse result = apiInstance.getAllFaxNumbers();
  System.out.println(result);
} catch (ApiException e) {
  System.err.println("Exception when calling FaxNumberApi#getAllFaxNumbers");
}
api_instance = MedsenderAPI::FaxNumberApi.new

begin
  result = api_instance.get_all_fax_numbers
  p result
rescue MedsenderAPI::ApiError => e
  puts "Exception when calling FaxNumberApi->get_all_fax_numbers: #{e}"
end
var apiInstance = new FaxNumberApi(Configuration.Default);

try
{
    FaxNumbersSuccessResponse result = apiInstance.GetAllFaxNumbers();
    Debug.WriteLine(result);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FaxNumberApi.GetAllFaxNumbers: " + e.Message );
    Debug.Print("Status Code: "+ e.ErrorCode);
    Debug.Print(e.StackTrace);
}
with medsenderphi.ApiClient(configuration) as api_client:
  api_instance = fax_number_api.FaxNumberApi(api_client)

  try:
    api_response = api_instance.get_all_fax_numbers()
    pprint(api_response)
  except medsenderphi.ApiException as e:
    print("Exception when calling FaxNumberApi->get_all_fax_numbers: %s\n" % e)

The above command will return JSON structured like this:

{
  "faxNumbers": [
    {
      "id": "4110ad4e-b5a9-438f-a3eb-a81a75c3400b",
      "number": "+12076077796",
      "client": {
        "clientId": "42486f1b-9297-401e-a3f4-869ce409c927",
        "name": "Client clinic"
      },
      "callbackUrl": "https://your.callback.url",
      "uri": "https://api.medsender.com/api/v2/fax_numbers/4110ad4e-b5a9-438f-a3eb-a81a75c3400b"
    },
    {...},
    {...}
  ]
}

Retrieve all fax numbers linked to your developer account.

Arguments

None

Returns

An array of FaxNumber objects. If you have no fax numbers, we will return an empty array. If there was an error with the request, we'll return an error object explaining why.

Provision a new fax number

Code to provision a fax number:

curl "https://api.medsender.com/api/v2/fax_numbers/:id" \
  -u "your_api_key:your_client_secret" \
  -F area_code="919" \
  -F callback_url="https://your.callback.url" \
  -F client_id="your_client_id"
<?php
$config = MedsenderPHI\Configuration::getDefaultConfiguration()
              ->setUsername('your_api_key')
              ->setPassword('your_client_secret');

$apiInstance = new MedsenderPHI\Api\FaxNumberApi(
    new GuzzleHttp\Client(),
    $config
);

$area_code = 919;
$callback_url = 'https://your.callback.url';
$client_id = 'your_client_id';

try {
    $result = $apiInstance->createFaxNumber($area_code, $callback_url, $client_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling FaxNumberApi->createFaxNumber: ', $e->getMessage(), PHP_EOL;
}
?>
const apiInstance = new MedsenderAPI.FaxNumberApi();
const areaCode = 919;
const callbackUrl = "https://your.callback.url";
const opts = {
  'clientId': "your_client_id"
};

apiInstance.createFaxNumber(areaCode, callbackUrl, opts).then((data) => {
  console.log(data);
}, (error) => {
  console.log(error);
});
FaxNumberApi apiInstance = new FaxNumberApi(defaultClient);
Integer areaCode = 919;
String callbackUrl = "https://your.callback.url";
String clientId = "your_client_id";
try {
  FaxNumberSuccessResponse result = apiInstance.createFaxNumber(areaCode, callbackUrl, clientId);
  System.out.println(result);
} catch (ApiException e) {
  System.err.println("Exception when calling FaxNumberApi#createFaxNumber");
}
var apiInstance = new FaxNumberApi(Configuration.Default);
var areaCode = 56;
var callbackUrl = "https://your.callback.url";
var clientId = "your_client_id";

try
{
    FaxNumberSuccessResponse result = apiInstance.CreateFaxNumber(areaCode, callbackUrl, clientId);
    Debug.WriteLine(result);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FaxNumberApi.CreateFaxNumber: " + e.Message );
    Debug.Print("Status Code: "+ e.ErrorCode);
    Debug.Print(e.StackTrace);
}
with medsenderphi.ApiClient(configuration) as api_client:
  api_instance = fax_number_api.FaxNumberApi(api_client)
  area_code = 1
  callback_url = "https://your.callback.url"
  client_id = "9178473555"

  try:
    api_response = api_instance.create_fax_number(area_code, callback_url, client_id=client_id)
    pprint(api_response)
  except medsenderphi.ApiException as e:
    print("Exception when calling FaxNumberApi->create_fax_number: %s\n" % e)

The above command will return JSON structured like this:

{
  "faxNumber": {
    "id": "4110ad4e-b5a9-438f-a3eb-a81a75c3400b",
    "number": "+12076077796",
    "client": {
      "clientId": "42486f1b-9297-401e-a3f4-869ce409c927",
      "name": "Client clinic"
    },
    "callbackUrl": "https://your.callback.url",
    "uri": "https://api.medsender.com/api/v2/fax_numbers/4110ad4e-b5a9-438f-a3eb-a81a75c3400b"
  }
}

Provision a new fax number. You can provide a client ID to link this fax number to that client. The new number is active as soon as it's created. If you'd like to port an existing number, please fill out the form at https://medsender.com/port/

Arguments

area_code

The desired area code you'd like for the new fax number.

callback_url

The desired callback URL we would use to send/receive faxes from.

client_id

The ID of the client you'd like to associate this fax number to. Optional.

Returns

A FaxNumber object. If there was an error with the request, we'll return an error object explaining why.

Updating the client ID and callback url

Code to update the callback url and/or client id:

curl --request PATCH "https://api.medsender.com/api/v2/fax_numbers/:id" \
  -u "your_api_key:your_client_secret" \
  -F callback_url="https://your.callback.url" \
  -F client_id="your_client_id"
<?php
$config = MedsenderPHI\Configuration::getDefaultConfiguration()
              ->setUsername('your_api_key')
              ->setPassword('your_client_secret');


$apiInstance = new MedsenderPHI\Api\FaxNumberApi(
    new GuzzleHttp\Client(),
    $config
);
$fax_number_id = "your_fax_number_id";
$callback_url = "https://your.callback.url";
$client_id = 'your_client_id';

try {
    $result = $apiInstance->updateCallbackUrl($fax_number_id, $callback_url, $client_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling FaxNumberApi->updateCallbackUrl: ', $e->getMessage(), PHP_EOL;
}
?>
const apiInstance = new MedsenderAPI.FaxNumberApi();
const faxNumberId = "your_fax_number_id";
const opts = {
  'callbackUrl': "https://your.callback.url",
  'clientId': "your_client_id"
};
apiInstance.updateCallbackUrl(faxNumberId, opts).then((data) => {
  console.log(data);
}, (error) => {
  console.log(error);
});
FaxNumberApi apiInstance = new FaxNumberApi(defaultClient);
String faxNumberId = "your_fax_number_id";
String callbackUrl = "https://your.callback.url";
String clientId = "your_client_id";

try {
  FaxNumberSuccessResponse result = apiInstance.updateCallbackUrl(faxNumberId, callbackUrl, clientId);
  System.out.println(result);
} catch (ApiException e) {
  System.err.println("Exception when calling FaxNumberApi#updateCallbackUrl");
}
api_instance = MedsenderAPI::FaxNumberApi.new
fax_number_id = 'your_fax_number_id'
opts = {
  callback_url: 'https://your.callback.url',
  client_id: 'your_client_id'
}

begin
  result = api_instance.update_callback_url(fax_number_id, opts)
  p result
rescue MedsenderAPI::ApiError => e
  puts "Exception when calling FaxNumberApi->update_callback_url: #{e}"
end
var apiInstance = new FaxNumberApi(Configuration.Default);
var faxNumberId = "ab726e43-dbfe-48ce-9a3a-ed0fa60f2504";
var callbackUrl = "https://your.callback.url";
var clientId = "your_client_id;

try
{
    FaxNumberSuccessResponse result = apiInstance.UpdateCallbackUrl(faxNumberId, callbackUrl, clientId);
    Debug.WriteLine(result);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FaxNumberApi.UpdateCallbackUrl: " + e.Message );
    Debug.Print("Status Code: "+ e.ErrorCode);
    Debug.Print(e.StackTrace);
}
with medsenderphi.ApiClient(configuration) as api_client:
  api_instance = fax_number_api.FaxNumberApi(api_client)
  fax_number_id = "ab726e43-dbfe-48ce-9a3a-ed0fa60f2504"
  callback_url = "https://your.callback.url"
  client_id = "your_client_id"

  try:
    api_response = api_instance.update_callback_url(fax_number_id, callback_url=callback_url, client_id=client_id)
    pprint(api_response)
  except medsenderphi.ApiException as e:
    print("Exception when calling FaxNumberApi->update_callback_url: %s\n" % e)

The above command will return JSON structured like this:

{
  "faxNumber": {
    "id": "4110ad4e-b5a9-438f-a3eb-a81a75c3400b",
    "number": "+12076077796",
    "client": {
      "clientId": "42486f1b-9297-401e-a3f4-869ce409c927",
      "name": "Client clinic"
    },
    "callbackUrl": "https://your.callback.url",
    "uri": "https://api.medsender.com/api/v2/fax_numbers/4110ad4e-b5a9-438f-a3eb-a81a75c3400b"
  }
}

Update the callback url and or client ID associated to a specific fax number. Number must be linked to your developer account and client ID must belong to a client that exists and belongs to your developer account.

Arguments

None

Returns

A FaxNumber object containing the updated callback url. If there was an error with the request, we'll return an error object explaining why.

Clients

The Client Object

Attributes

client_id

A unique ID used to identify the client.

name

The name of the client.

fax_numbers

An array of objects. Each object contains a fax number object linked to this client.

Retrieve a client

Code to retrieve a client:

curl "https://api.medsender.com/api/v2/clients/:client_id" \
  -u "your_api_key:your_client_secret"
<?php
$config = MedsenderPHI\Configuration::getDefaultConfiguration()
              ->setUsername('your_api_key')
              ->setPassword('your_client_secret');

$apiInstance = new MedsenderPHI\Api\ClientsApi(
    new GuzzleHttp\Client(),
    $config
);
$client_id = "your_client_id";

try {
    $result = $apiInstance->getClientById($client_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ClientsApi->getClientById: ', $e->getMessage(), PHP_EOL;
}
?>
const apiInstance = new MedsenderAPI.ClientsApi();
const clientId = "your_client_id";
apiInstance.getClientById(clientId).then((data) => {
  console.log(data);
}, (error) => {
  console.log(error);
});
ClientsApi apiInstance = new ClientsApi(defaultClient);
String clientId = "your_client_id";
try {
  ClientSuccessResponse result = apiInstance.getClientById(clientId);
  System.out.println(result);
} catch (ApiException e) {
  System.err.println("Exception when calling ClientsApi#getClientById");
}
api_instance = MedsenderAPI::ClientsApi.new
client_id = 'your_client_id'

begin
  result = api_instance.get_client_by_id(client_id)
  p result
rescue MedsenderAPI::ApiError => e
  puts "Exception when calling ClientsApi->get_client_by_id: #{e}"
end
var apiInstance = new ClientsApi(Configuration.Default);
var clientId = "ab726e43-dbfe-48ce-9a3a-ed0fa60f2504";

try
{
    ClientSuccessResponse result = apiInstance.GetClientById(clientId);
    Debug.WriteLine(result);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling ClientsApi.GetClientById: " + e.Message );
    Debug.Print("Status Code: "+ e.ErrorCode);
    Debug.Print(e.StackTrace);
}
with medsenderphi.ApiClient(configuration) as api_client:
  api_instance = clients_api.ClientsApi(api_client)
  client_id = "ab726e43-dbfe-48ce-9a3a-ed0fa60f2504"

  try:
    api_response = api_instance.get_client_by_id(client_id)
    pprint(api_response)
  except medsenderphi.ApiException as e:
    print("Exception when calling ClientsApi->get_client_by_id: %s\n" % e)

The above command will return JSON structured like this:

{
  "client": {
    "clientId": "32b08347-6001-4e16-877b-7228975af105",
    "name": "name_example",
    "faxNumbers": [
      {
        "id": "cc5d524c-dcae-4253-8a40-27dd765ddf47",
        "number": "+12076077796",
        "callbackUrl": "https://your.callback.url",
        "uri": "https://api.medsender.com/api/v2/fax_numbers/cc5d524c-dcae-4253-8a40-27dd765ddf47"
      }
    ]
  }
}

Retrieve a specific client linked to a fax number belonging to your developer account using it's ID.

Arguments

None

Returns

A Client object. If you have no clients, we will return an empty object. If there was an error with the request, we'll return an error object explaining why.

Create a client

Code to create a client:

curl "https://api.medsender.com/api/v2/clients" \
  -u "your_api_key:your_client_secret" \
  -F name="Client Hospital" \
  -F faxNumberId=""
<?php
$config = MedsenderPHI\Configuration::getDefaultConfiguration()
              ->setUsername('your_api_key')
              ->setPassword('your_client_secret');

$apiInstance = new MedsenderPHI\Api\ClientsApi(
    new GuzzleHttp\Client(),
    $config
);
$name = "hospital client";
$faxNumberId = "";

try {
    $result = $apiInstance->createClient($name, $faxNumberId);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ClientsApi->createClient: ', $e->getMessage(), PHP_EOL;
}
?>
const apiInstance = new MedsenderAPI.ClientsApi();
const name = "hospital client";
const opts = {
  'faxNumberId': ""
};
apiInstance.createClient(name, opts).then((data) => {
  console.log(data);
}, (error) => {
  console.log(error);
});
ClientsApi apiInstance = new ClientsApi(defaultClient);
String name = "Hospital Client";
String faxNumberId = "";
try {
  ClientSuccessResponse result = apiInstance.createClient(name, faxNumberId);
  System.out.println(result);
} catch (ApiException e) {
  System.err.println("Exception when calling ClientsApi#createClient");
}
api_instance = MedsenderAPI::ClientsApi.new
name = 'hospital_client'
opts = {
  fax_number_id: ''
}

begin
  result = api_instance.create_client(name, opts)
  p result
rescue MedsenderAPI::ApiError => e
  puts "Exception when calling ClientsApi->create_client: #{e}"
end
var apiInstance = new ClientsApi(Configuration.Default);
var name = "hospital_client";
var faxNumberId = "";

try
{
    ClientSuccessResponse result = apiInstance.CreateClient(name, faxNumberId);
    Debug.WriteLine(result);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling ClientsApi.CreateClient: " + e.Message );
    Debug.Print("Status Code: "+ e.ErrorCode);
    Debug.Print(e.StackTrace);
}
with medsenderphi.ApiClient(configuration) as api_client:
  api_instance = clients_api.ClientsApi(api_client)
  name = "hospital_client"
  fax_number_id = ""

  try:
    api_response = api_instance.create_client(name, fax_number_id=fax_number_id)
    pprint(api_response)
  except medsenderphi.ApiException as e:
    print("Exception when calling ClientsApi->create_client: %s\n" % e)

The above command will return JSON structured like this:

{
  "client": {
    "clientId": "32b08347-6001-4e16-877b-7228975af105",
    "name": "name_example",
    "faxNumbers": [
      {
        "id": "cc5d524c-dcae-4253-8a40-27dd765ddf47",
        "number": "+12076077796",
        "callbackUrl": "https://your.callback.url",
        "uri": "https://api.medsender.com/api/v2/fax_numbers/cc5d524c-dcae-4253-8a40-27dd765ddf47"
      }
    ]
  }
}

Create a new client. You can specify a fax number ID to link this client to a fax number.

Arguments

name

The name of the client you'd like to create.

fax_number_id

You can provide a fax number ID to link this client to a fax number upon creation. Optional.

Returns

A Client object. If there was an error with the request, we'll return an error object explaining why.

Retrieve all clients

Code to retrieve all clients:

curl "https://api.medsender.com/api/v2/clients" \
  -u "your_api_key:your_client_secret"
<?php
$config = MedsenderPHI\Configuration::getDefaultConfiguration()
              ->setUsername('your_api_key')
              ->setPassword('your_client_secret');

$apiInstance = new MedsenderPHI\Api\ClientsApi(
    new GuzzleHttp\Client(),
    $config
);
try {
    $result = $apiInstance->getAllClients();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ClientsApi->getAllClients: ', $e->getMessage(), PHP_EOL;
}
?>
const apiInstance = new MedsenderAPI.ClientsApi();
apiInstance.getAllClients().then((data) => {
  console.log(data);
}, (error) => {
  console.log(error);
});
ClientsApi apiInstance = new ClientsApi(defaultClient);
try {
  ClientsSuccessResponse result = apiInstance.getAllClients();
  System.out.println(result);
} catch (ApiException e) {
  System.err.println("Exception when calling ClientsApi#getAllClients");
}
api_instance = MedsenderAPI::ClientsApi.new

begin
  result = api_instance.get_all_clients
  p result
rescue MedsenderAPI::ApiError => e
  puts "Exception when calling ClientsApi->get_all_clients: #{e}"
end
var apiInstance = new ClientsApi(Configuration.Default);

try
{
    ClientsSuccessResponse result = apiInstance.GetAllClients();
    Debug.WriteLine(result);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling ClientsApi.GetAllClients: " + e.Message );
    Debug.Print("Status Code: "+ e.ErrorCode);
    Debug.Print(e.StackTrace);
}
with medsenderphi.ApiClient(configuration) as api_client:
    api_instance = clients_api.ClientsApi(api_client)

  try:
    api_response = api_instance.get_all_clients()
    pprint(api_response)
  except medsenderphi.ApiException as e:
    print("Exception when calling ClientsApi->get_all_clients: %s\n" % e)

The above command will return JSON structured like this:

{
  "clients": [
    {
      "clientId": "32b08347-6001-4e16-877b-7228975af105",
      "name": "name_example",
      "faxNumbers": [
        {
          "id": "cc5d524c-dcae-4253-8a40-27dd765ddf47",
          "number": "+12076077796",
          "callbackUrl": "https://medsender.com/bc74913d-2226-4797-83fd-00f410a7f8f0",
          "uri": "http://localhost:5000/api/v2/fax_numbers/cc5d524c-dcae-4253-8a40-27dd765ddf47"
        }
      ],
      [...]
    }
  ],
  [...]
}

Retrieve all clients associated with your developer account.

Arguments

None

Returns

An array of Client objects. If you have no clients, we will return an empty array. If there was an error with the request, we'll return an error object explaining why.

Updating the name of the client

Code to update the client name:

curl --request PATCH "https://api.medsender.com/api/v2/clients/:client_id" \
  -u "your_api_key:your_client_secret"\
  -F name="new client name"
<?php
$config = MedsenderPHI\Configuration::getDefaultConfiguration()
              ->setUsername('your_api_key')
              ->setPassword('your_client_secret');


$apiInstance = new MedsenderPHI\Api\ClientsApi(
    new GuzzleHttp\Client(),
    $config
);
$client_id = 'your_client_id';
$name = 'name_example';

try {
    $result = $apiInstance->updateClient($client_id, $name);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ClientsApi->updateClient: ', $e->getMessage(), PHP_EOL;
}
?>
const apiInstance = new MedsenderAPI.ClientsApi();
const clientId = "your_client_id";
const opts = {
  'name': "name_example"
};

apiInstance.updateClient(clientId, opts).then((data) => {
  console.log(data);
}, (error) => {
  console.log(error);
});
ClientsApi apiInstance = new ClientsApi(defaultClient);
String clientId = "your_client_id";
String name = "name_example";

try {
  ClientSuccessResponse result = apiInstance.updateClient(clientId, name);
  System.out.println(result);
} catch (ApiException e) {
  System.err.println("Exception when calling ClientsApi#updateClient");
}
api_instance = MedsenderAPI::ClientsApi.new
client_id = 'your_client_id'
opts = {
  name: 'name_example'
}

begin
  result = api_instance.update_client(client_id, opts)
  p result
rescue MedsenderAPI::ApiError => e
  puts "Exception when calling ClientsApi->update_client: #{e}"
end
var apiInstance = new ClientsApi(Configuration.Default);
var clientId = "ab726e43-dbfe-48ce-9a3a-ed0fa60f2504";
var name = "name_example;

try
{
    ClientSuccessResponse result = apiInstance.UpdateClient(clientId, name);
    Debug.WriteLine(result);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling ClientsApi.UpdateClient: " + e.Message );
    Debug.Print("Status Code: "+ e.ErrorCode);
    Debug.Print(e.StackTrace);
}
with medsenderphi.ApiClient(configuration) as api_client:
    api_instance = clients_api.ClientsApi(api_client)
    client_id = "ab726e43-dbfe-48ce-9a3a-ed0fa60f2504"
    name = "name_example"

  try:
    api_response = api_instance.update_client(client_id, name=name)
    pprint(api_response)
  except medsenderphi.ApiException as e:
    print("Exception when calling ClientsApi->update_client: %s\n" % e)

The above command will return JSON structured like this:

{
  "client": {
    "clientId": "32b08347-6001-4e16-877b-7228975af105",
    "name": "name_example",
    "faxNumbers": [
      {
        "id": "cc5d524c-dcae-4253-8a40-27dd765ddf47",
        "number": "+12076077796",
        "callbackUrl": "https://your.callback.url",
        "uri": "https://api.medsender.com/api/v2/fax_numbers/cc5d524c-dcae-4253-8a40-27dd765ddf47"
      }
    ]
  }
}

Update the name of the client.

Arguments

None

Returns

A Client object containing the new name. If there was an error with the request, we'll return an error object explaining why.

Medsender AI

Medsender AI allows you to parse healthcare documents and medical records programmatically, without any training needed. Use our AI to categorize, summarize, and extract data from documents to automate routing and data entry. Listed below are entities our AI can extract, but we are continuously adding new entities, so if you do not see one listed, it may already be in development. We are also able to quickly tune our models, so if there's something specific you need extracted, our AI models can be adapted to meet your needs.

We're constantly improving and training our AI for new features so keep on the lookout for new updates! If you have any questions, email us at api@medsender.com.

Run AI on a document

If you have a document that you'd like to run our AI on, simply use this endpoint. We'll return back field extraction and document category, and our AI can also summarize the document for you (feature available upon request). See below for supported entities:

Code to run AI on a file:

curl https://api.medsender.com/api/v2/ai \
-u your_api_key:your_client_secret \
-F file='@/path/to/file.pdf' \
-F callbackUrl='https://your.callback.url'
<?php
$config = MedsenderPHI\Configuration::getDefaultConfiguration()
              ->setUsername('your_api_key')
              ->setPassword('your_client_secret');


$apiInstance = new MedsenderPHI\Api\AIApi(
    new GuzzleHttp\Client(),
    $config
);
$file = '/path/to/file.pdf';
$callback_url = 'https://your.callback.url'

try {
    $result = $apiInstance->runAI($file, $callback_url);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ClientsApi->runAI: ', $e->getMessage(), PHP_EOL;
}
?>
const apiInstance = new MedsenderAPI.AIApi();
const file = "/path/to/file.pdf";
const callback_url: "https://your.callback.url";

apiInstance.runAI(file, callback_url).then((data) => {
  console.log(data);
}, (error) => {
  console.log(error);
});
ClientsApi apiInstance = new AIApi(defaultClient);
File file = new File("/path/to/file.pdf");
String callbackUrl = "https://your.callback.url";

try {
  AISuccessResponse result = apiInstance.runAI(file, callbackUrl);
  System.out.println(result);
} catch (ApiException e) {
  System.err.println("Exception when calling ClientsApi#runAI");
}
api_instance = MedsenderAPI::AIApi.new
file = '/path/to/file.pdf'
callback_url = 'https://your.callback.url'

begin
  result = api_instance.run_ai(file, callback_url)
  p result
rescue MedsenderAPI::ApiError => e
  puts "Exception when calling ClientsApi->run_ai: #{e}"
end
var apiInstance = new AIApi(Configuration.Default);
var file = BINARY_DATA_HERE;  // System.IO.Stream | The file you'd like to use.
var callbackUrl = "https://your.callback.url";

try
{
    AISuccessResponse result = apiInstance.RunAI(file, callbackUrl);
    Debug.WriteLine(result);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling ClientsApi.RunAI: " + e.Message );
    Debug.Print("Status Code: "+ e.ErrorCode);
    Debug.Print(e.StackTrace);
}
with medsenderphi.ApiClient(configuration) as api_client:
    api_instance = ai_api.AiApi(api_client)
    file = open('/path/to/file', 'rb')
    callback_url = "https://your.callback.url"

  try:
    api_response = api_instance.run_ai(file, callback_url)
    pprint(api_response)
  except medsenderphi.ApiException as e:
    print("Exception when calling ClientsApi->run_ai: %s\n" % e)

The above command will return JSON structured like this:

{
  "ai_result": {
    "ai_token": "32b08347-6001-4e16-877b-7228975af105",
    "patient_name": "name_example",
    "patient_dob": "01/01/2000",
    "document_classification": "Lab Result",
    "gender": "male",
    "phone_number": "111-222-3333",
    "summary": "Positive covid test result"
  }
}

Arguments

file

The path to the file you'd like to run our AI on. Must be a PDF, TIFF, PNG, or JPG.

callback_url

Response

If the arguments passed are valid, it will return the AI token that you can use to keep track of the AI job. Once the job is completed we will send a callback with the patient name and DOB, and document classification.

Errors

The Medsender API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key or client key isn't right.
403 Forbidden -- You don't have access to that PHI.
404 Not Found -- The specified PHI could not be found.
405 Method Not Allowed -- You tried to access a PHI with an invalid method.
406 Not Acceptable -- You requested a format that isn't supported.
410 Gone -- The PHI requested has been removed from our servers.
429 Too Many Requests -- You've hit the API rate limit.
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.