Sync Patients

A patient record must be added to Photon before a prescription can be written.

Patients can be created manually in the Photon UI, however most partners opt to sync patients from a backend - usually after a patient onboarding flow or whenever a patient record changes.

Create or Update a Patient

A request to the createPatient mutation will create a patient in Photon. If a needed, the updatePatient mutation works in a similar fashion, and can be used to update an existing patient record.

Patient metadata, including allergies and medication history are shared with pharmacies once prescriptions and written and ordered.

Below is an example of how to create a patient from a backend. Refer to authentication guide for instructions on how to authenticate these requests.

const graphQLClient = new GraphQLClient("", {
  headers: {
    authorization: "YOUR_AUTH_TOKEN",

const query = gql`
  mutation createPatient(
    $externalId: ID,
    $name: NameInput!,
    $dateOfBirth: AWSDate!,
    $sex: SexType!,
    $phone: AWSPhone!,
    $allergies: [AllergenInput],
    $medicationHistory: [MedHistoryInput],
  ) {
      externalId: $externalId,
      name: $name
      dateOfBirth: $dateOfBirth
      sex: $sex
      phone: $phone
      allergies: $allergies,
      medicationHistory: $medicationHistory,
    ) {

const variables = {
  externalId: "YOUR_ID", // optional
  name: {
    first: "Jane",
    last: "Doe",
  dateOfBirth: "1970-01-01",
  sex: "FEMALE",
  phone: "+12025550102",

const results = await graphQLClient.request(query, variables);