Skip to content
Last updated

PHIL Transfer Rx Intake API Documentation

The purpose of this API is to intake a prescription transfer request from an originating pharmacy seeking to transfer a prescription to Phil. This API accepts one script per request in the standard NCPDP SCRIPT RxTransferResponse XML format.

When the API is called, it performs key field and schema validations and provides an immediate request acceptance or reject status (with relevant error messages).

Once the transfer script is received we follow the standard pharmacy transfer-in process to validate remaining refills, confirm the originating pharmacy details, and process the transfer.

NOTE: In NCPDP terminology, RxTransferResponse is used because the originating pharmacy sends the full prescription data as its response to the patient's request to transfer to Phil. This is the standard NCPDP SCRIPT 2017 format for pharmacy-to-pharmacy transfer data pushes.

HOST URLs

Production Endpoint URLhttps://tbd/api/v1/intake/transfer-rx
Staging Endpoint URLhttps://tbd/api/v1/intake/transfer-rx

Credentials for Staging

Username: tbd

API Key: tbd

Base64 encoded String: tbd

Key Headers

Content-Type: application/json

Authorization: Basic username:api_key //for Staging you can use the value above

NOTE: the "username:api_key" combined string will need to be base64 encoded. We will share the auth details separately in a secure email for both production environment

Request Format

{ "transaction_id": <unique transaction id>, "message": "base64-encoded-transfer-script.xml" }

NOTE:

1. "transaction_id" should be a unique value to identify each request for tracking purposes

2. The "message" field is a single base64 encoded RxTransferResponse Script XML representing the prescription transfer being requested. Only one script is accepted per API call.

Response Format

Response has 2 parts. If the http request itself fails then error will be based on http status such as 404 (unauthorized), 400 (client error) or 500 for internal server error

But, if the http request is good and the API call fails because of bad XML data or others, the JSON response will be sent back to the client with http status 200 or 201. But, JSON response has 1 of 2 possible statuses: "OK" or "ERROR"

JSON response body for status "OK":

{ "error": "", "status": "OK", "data": <formatted string showing the results> }

NOTE: TransactionID is the same id sent by the originating pharmacy system and is used for tracking purposes

JSON response body for status "ERROR":

{ "error": <any error message>, "data": null, "status": "ERROR" }

NOTE: the error value will reference the MessageID from the Script XML to identify which script failed. Example:

"error": "erx_message_id:error_msg"

erx_message_id is the MessageID value from the Script XML

TransferRx Script XML Format

RxTransferResponse XML - sent as part of the request body (base64 encoded)

NOTE:

  • PHIL Rx NCPDP ID: 3685508

  • Any tags with the comment //NOTE: can remain same can be static. Meaning can use the exact same value

  • Header qualifiers: <To Qualifier="D"> identifies PHIL as the recipient; <From Qualifier="P"> identifies the originating pharmacy by NCPDP ID

  • Two <Pharmacy> elements are required. Both use the same tag, differentiated by <TransferType>. Sending pharmacy first (TRANSFER FROM PHARMACY), PHIL second (TRANSFER TO PHARMACY)

  • PHIL's <Pharmacist> block inside the second <Pharmacy> uses a flat structure: <Name/> followed by <FirstName> and <LastName> as direct children (not nested under <Name>)

  • The medication block is nested inside <MedicationTransferred> with <PrescriptionPreviouslyFilled>: "true" if a LastFillDate exists; "false" if the script was never dispensed

  • <BenefitsCoordination> appears BEFORE <MedicationTransferred> in the element ordering

  • <HistorySource> inside <MedicationPrescribed> carries the originating pharmacy identity, original Rx number, fill dates, and authorized/remaining refill counts. Required when the Rx number is known.

  • <NumberOfRefills> should be RefillsRemaining + 1 to account for the current fill being transferred

<?xml version="1.0" encoding="utf-8"?> <Message DatatypesVersion="20170715" TransportVersion="20170715" TransactionDomain="SCRIPT" TransactionVersion="20170715" StructuresVersion="20170715" ECLVersion="20170715" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="transport.xsd"> <Header> <To Qualifier="D">3685508</To> //PHIL NCPDP ID <From Qualifier="P">[Originating Pharmacy NCPDP ID]</From> <MessageID>[SendingNCPDP]-[OriginalRxNumber]</MessageID> //alphanumeric 1-35 len <SentTime>2025-03-04T20:25:03.5Z</SentTime> <Security> <UsernameToken> <Username>3685508</Username> //PHIL NCPDP ID //NOTE: can remain same <Password Type="PasswordDigest"></Password> <Nonce>[MessageID]</Nonce> //same value as MessageID above <Created>2025-03-04T20:25:03.5Z</Created> </UsernameToken> <Sender /> <Receiver /> </Security> <SenderSoftware> <SenderSoftwareDeveloper>SoftwareDeveloper</SenderSoftwareDeveloper> <SenderSoftwareProduct>PharmacySystem</SenderSoftwareProduct> <SenderSoftwareVersionRelease>X</SenderSoftwareVersionRelease> </SenderSoftware> </Header> <Body> <RxTransferResponse> <Response> <Approved /> //Indicates the originating pharmacy approves the transfer </Response> <Patient> <HumanPatient> <Name> <LastName>DOE</LastName> <FirstName>JOHN</FirstName> </Name> <Gender>M</Gender> <DateOfBirth> <Date>1955-01-01</Date> </DateOfBirth> <Address> <AddressLine1>1234 Elm Street</AddressLine1> <City>SPRINGFIELD</City> <StateProvince>IL</StateProvince> <PostalCode>62701</PostalCode> <CountryCode>US</CountryCode> </Address> <CommunicationNumbers> //PRIMARY number is required <PrimaryTelephone> <Number>xxxxxxxxxx</Number> </PrimaryTelephone> <OtherTelephone> <Number>xxxxxxxxxx</Number> <SupportsSMS>Y</SupportsSMS> //Y if patient consents to SMS </OtherTelephone> </CommunicationNumbers> </HumanPatient> </Patient> <!-- Two <Pharmacy> elements are required. Both use the <Pharmacy> tag; <TransferType> differentiates sending from receiving. Order: sending pharmacy FIRST, PHIL (receiving) SECOND. --> <Pharmacy> //Originating (sending) pharmacy <Identification> <NCPDPID>[Originating Pharmacy NCPDP ID]</NCPDPID> <NPI>[Originating Pharmacy NPI]</NPI> </Identification> <StoreName>[Originating Pharmacy Store Name]</StoreName> <BusinessName>[Originating Pharmacy Business Name]</BusinessName> <Address> <AddressLine1>1705 ROUTE 46</AddressLine1> <AddressLine2>STE 4</AddressLine2> <City>LEDGEWOOD</City> <StateProvince>NJ</StateProvince> <PostalCode>07852</PostalCode> <CountryCode>US</CountryCode> </Address> <CommunicationNumbers> <PrimaryTelephone> <Number>xxxxxxxxxx</Number> </PrimaryTelephone> <Fax> <Number>xxxxxxxxxx</Number> </Fax> </CommunicationNumbers> <TransferType>TRANSFER FROM PHARMACY</TransferType> </Pharmacy> <Pharmacy> //Receiving pharmacy (PHIL) //NOTE: can remain same <Identification> <NCPDPID>3685508</NCPDPID> <DEANumber>FP7647677</DEANumber> <NPI>1487163598</NPI> </Identification> <Pharmacist> //Note: FirstName/LastName are direct children, not under <Name> <Name/> <FirstName>HALEY</FirstName> <LastName>DECOY</LastName> </Pharmacist> <StoreName>PHIL PHARMACY SOLUTIONS</StoreName> //NOTE: can remain same <BusinessName>PHIL PHARMACY SOLUTIONS</BusinessName> //NOTE: can remain same <Address> <AddressLine1>150 E Campus View Blvd</AddressLine1> <AddressLine2>STE 210</AddressLine2> <City>COLUMBUS</City> <StateProvince>OH</StateProvince> <PostalCode>43235</PostalCode> <CountryCode>US</CountryCode> </Address> <CommunicationNumbers> <PrimaryTelephone> <Number>8559770975</Number> </PrimaryTelephone> <Fax> <Number>8889750603</Number> </Fax> </CommunicationNumbers> <TransferType>TRANSFER TO PHARMACY</TransferType> </Pharmacy> <Prescriber> <NonVeterinarian> <Identification> <DEANumber>Prescriber DEA - if applicable</DEANumber> <NPI>Prescriber NPI</NPI> </Identification> <PracticeLocation> //IF applicable <BusinessName>Practice/Clinic Name</BusinessName> </PracticeLocation> <Name> <LastName>DOE</LastName> <FirstName>JOHN</FirstName> </Name> <Address> <AddressLine1>500 OLD PKWY</AddressLine1> <AddressLine2>#605</AddressLine2> <City>DULUTH</City> <StateProvince>CA</StateProvince> <PostalCode>95292</PostalCode> <CountryCode>US</CountryCode> </Address> <CommunicationNumbers> <PrimaryTelephone> <Number>xxxxxxxxxx</Number> </PrimaryTelephone> <OtherTelephone> <Number>xxxxxxxxxx</Number> </OtherTelephone> <ElectronicMail>prescriber@email.com</ElectronicMail> <Fax> <Number>xxxxxxxxxx</Number> </Fax> </CommunicationNumbers> </NonVeterinarian> </Prescriber> <Pharmacist> //Top-level sending pharmacist — mirrors Pharmacy[0] authorizing pharmacist <Name> <LastName>KARLSON</LastName> <FirstName>JOHN</FirstName> </Name> </Pharmacist> <AllergyOrAdverseEvent> //IF applicable <Allergy> <SourceOfInformation>O</SourceOfInformation> <AdverseEvent> <Text>Allergy</Text> </AdverseEvent> <DrugProductCoded> <Qualifier>MSKDC</Qualifier> <Text>Penicillin</Text> <Code>00985</Code> </DrugProductCoded> </Allergy> </AllergyOrAdverseEvent> <BenefitsCoordination> //IF applicable — appears BEFORE MedicationTransferred <PayerIdentification> <IINNumber>xxxx</IINNumber> //BIN </PayerIdentification> <PatientRelationship>1</PatientRelationship> <CommunicationNumbers> <PrimaryTelephone> <Number>xxxxxxxxxx</Number> </PrimaryTelephone> </CommunicationNumbers> <PayerName>CIGNA</PayerName> <CardholderID>xxxxxxxxx</CardholderID> <GroupID>xxxxxxxxxxxxxxxxx</GroupID> </BenefitsCoordination> <MedicationTransferred> <PrescriptionPreviouslyFilled>false</PrescriptionPreviouslyFilled> <!-- Set to "true" if a LastFillDate exists (previously dispensed). Set to "false" if the script was never dispensed at the originating pharmacy. --> <MedicationPrescribed> <DrugDescription>VEVYE</DrugDescription> <DrugCoded> <ProductCode> <Code>82667090002</Code> //NDC <Qualifier>ND</Qualifier> </ProductCode> <Strength> <StrengthValue>0.1 %</StrengthValue> </Strength> <DrugDBCode> <Code>C28254</Code> <Qualifier>ND</Qualifier> </DrugDBCode> </DrugCoded> <Quantity> <Value>2</Value> <CodeListQualifier>38</CodeListQualifier> <QuantityUnitOfMeasure> <Code>C28254</Code> </QuantityUnitOfMeasure> </Quantity> <DaysSupply>30</DaysSupply> <WrittenDate> <Date>2025-03-12</Date> </WrittenDate> <LastFillDate> <Date>2025-03-12</Date> //Most recent dispense date at originating pharmacy </LastFillDate> <Substitutions>0</Substitutions> <NumberOfRefills>12</NumberOfRefills> //RefillsRemaining + 1 (accounts for current fill) <RefillsRemaining>12</RefillsRemaining> //Refills still available to dispense <Prescriber> //Prescriber repeated inside MedicationPrescribed <NonVeterinarian> <Identification> <DEANumber>Prescriber DEA - if applicable</DEANumber> <NPI>Prescriber NPI</NPI> </Identification> <PracticeLocation> //IF applicable <BusinessName>Practice/Clinic Name</BusinessName> </PracticeLocation> <Name> <LastName>DOE</LastName> <FirstName>JOHN</FirstName> </Name> <Address> <AddressLine1>500 OLD PKWY</AddressLine1> <AddressLine2>#605</AddressLine2> <City>DULUTH</City> <StateProvince>CA</StateProvince> <PostalCode>95292</PostalCode> <CountryCode>US</CountryCode> </Address> <CommunicationNumbers> <PrimaryTelephone> <Number>xxxxxxxxxx</Number> </PrimaryTelephone> <OtherTelephone> <Number>xxxxxxxxxx</Number> </OtherTelephone> <ElectronicMail>prescriber@email.com</ElectronicMail> <Fax> <Number>xxxxxxxxxx</Number> </Fax> </CommunicationNumbers> </NonVeterinarian> </Prescriber> <Sig> <SigText>INSTILL 1 SPRAY IN EACH NOSTRIL TWICE DAILY</SigText> </Sig> <HistorySource> //Required when the original Rx number is known <Source> <NCPDPID>[Originating Pharmacy NCPDP ID]</NCPDPID> <NPI>[Originating Pharmacy NPI]</NPI> <DEANumber>[Originating DEA - if applicable]</DEANumber> </Source> <SourceReference>[Original Rx Number]</SourceReference> <OriginCode>5</OriginCode> //5 = Transferred <WrittenDate> <Date>2025-03-12</Date> </WrittenDate> <OriginalFillDate> <Date>2025-03-12</Date> //Date of first dispense </OriginalFillDate> <LastFillDate> <Date>2025-03-12</Date> </LastFillDate> <RefillsAuthorized>12</RefillsAuthorized> <RefillsRemaining>12</RefillsRemaining> </HistorySource> </MedicationPrescribed> </MedicationTransferred> </RxTransferResponse> </Body> </Message>