Skip to main content

GraphQL API Reference

GraphQL API

Query exactly the data you need with our GraphQL API. Reduce over-fetching, combine multiple resources in a single request, and build faster with strongly-typed schemas.

POST
https://api.transparentmedz.com/graphql

Authentication

Bearer token in Authorization header

Content-Type

application/json

Rate Limit

Based on query complexity

Max Depth

10 levels

Schema Explorer

Core types available in the TransparentMedz GraphQL schema.

type Drug
type Drug {
  id: ID!
  name: String!
  din: String!
  genericName: String
  manufacturer: String!
  dosageForm: String!
  strength: String!
  atcCode: String
  schedule: DrugSchedule!
  prices(city: String, province: String, limit: Int): [Price!]!
  generics: [Drug!]!
  coverage(province: Province): [Coverage!]!
  history(period: Period, granularity: Granularity): PriceHistory!
}
type Price
type Price {
  id: ID!
  drug: Drug!
  pharmacy: Pharmacy!
  amount: Float!
  currency: Currency!
  dispensingFee: Float!
  totalCost: Float!
  lastUpdated: DateTime!
  source: PriceSource!
}
type Pharmacy
type Pharmacy {
  id: ID!
  name: String!
  chain: String
  address: Address!
  phone: String
  hours: [OperatingHours!]!
  services: [String!]!
  latitude: Float!
  longitude: Float!
  prices(drugId: ID, limit: Int): [Price!]!
  rating: Float
}
type Coverage
type Coverage {
  province: Province!
  formularyStatus: FormularyStatus!
  criteria: String
  maxCoverage: Float
  deductible: Float
  copayPercent: Float
}

Full Schema Available in Playground

The GraphQL Playground includes built-in schema documentation with full introspection support. Explore all types, enums, inputs, and their descriptions interactively.

Query Examples

Copy and paste these examples into the GraphQL Playground to try them out.

Search Drugs
query
Search for drugs by name, DIN, or generic ingredient with pagination and filtering.

Query

query.graphql
query SearchDrugs($query: String!, $limit: Int, $offset: Int) {
  drugs(query: $query, limit: $limit, offset: $offset) {
    totalCount
    edges {
      node {
        id
        name
        din
        genericName
        manufacturer
        dosageForm
        strength
        schedule
      }
      cursor
    }
    pageInfo {
      hasNextPage
      endCursor
    }
  }
}

# Variables:
# {
#   "query": "metformin",
#   "limit": 10,
#   "offset": 0
# }

Response

response.json
{
  "data": {
    "drugs": {
      "totalCount": 24,
      "edges": [
        {
          "node": {
            "id": "drug_12345",
            "name": "Metformin 500mg",
            "din": "02248573",
            "genericName": "metformin hydrochloride",
            "manufacturer": "Apotex Inc.",
            "dosageForm": "Tablet",
            "strength": "500mg",
            "schedule": "PRESCRIPTION"
          },
          "cursor": "Y3Vyc29yXzE="
        }
      ],
      "pageInfo": {
        "hasNextPage": true,
        "endCursor": "Y3Vyc29yXzEw"
      }
    }
  }
}
Get Prices with Pharmacy Details
query
Fetch drug prices along with full pharmacy details including location, hours, and services in a single query.

Query

query.graphql
query DrugPricesWithPharmacy($drugId: ID!, $city: String, $limit: Int) {
  drug(id: $drugId) {
    id
    name
    din
    strength
    prices(city: $city, limit: $limit) {
      amount
      dispensingFee
      totalCost
      lastUpdated
      pharmacy {
        id
        name
        chain
        address {
          street
          city
          province
          postalCode
        }
        phone
        hours {
          day
          open
          close
        }
        services
        latitude
        longitude
        rating
      }
    }
    generics {
      id
      name
      din
      manufacturer
      prices(city: $city, limit: 1) {
        totalCost
        pharmacy {
          name
        }
      }
    }
  }
}

# Variables:
# {
#   "drugId": "drug_12345",
#   "city": "toronto",
#   "limit": 5
# }

Response

response.json
{
  "data": {
    "drug": {
      "id": "drug_12345",
      "name": "Metformin 500mg",
      "din": "02248573",
      "strength": "500mg",
      "prices": [
        {
          "amount": 8.99,
          "dispensingFee": 4.11,
          "totalCost": 13.10,
          "lastUpdated": "2026-04-05T10:00:00Z",
          "pharmacy": {
            "id": "pharm_001",
            "name": "Costco Pharmacy - Etobicoke",
            "chain": "Costco",
            "address": {
              "street": "50 Queen Elizabeth Blvd",
              "city": "Toronto",
              "province": "ON",
              "postalCode": "M8Z 1M1"
            },
            "phone": "416-555-0101",
            "hours": [
              { "day": "Monday", "open": "10:00", "close": "20:00" }
            ],
            "services": ["flu_vaccination", "delivery"],
            "latitude": 43.6232,
            "longitude": -79.5141,
            "rating": 4.6
          }
        }
      ],
      "generics": [
        {
          "id": "drug_22345",
          "name": "APO-Metformin 500mg",
          "din": "02257734",
          "manufacturer": "Apotex Inc.",
          "prices": [
            {
              "totalCost": 11.49,
              "pharmacy": { "name": "Shoppers Drug Mart #1234" }
            }
          ]
        }
      ]
    }
  }
}
Compare Pharmacies
query
Compare prices for a list of drugs across multiple pharmacies in a single request. Ideal for basket comparison use cases.

Query

query.graphql
query ComparePharmacies(
  $drugIds: [ID!]!
  $pharmacyIds: [ID!]
  $province: Province
) {
  comparePrices(
    drugIds: $drugIds
    pharmacyIds: $pharmacyIds
    province: $province
  ) {
    drugs {
      drug {
        id
        name
        din
      }
      pharmacyPrices {
        pharmacy {
          id
          name
          chain
        }
        amount
        dispensingFee
        totalCost
      }
      lowestPrice
      highestPrice
      averagePrice
      savingsFromAverage
    }
    summary {
      totalLowest
      totalHighest
      bestPharmacy {
        id
        name
      }
      totalSavings
    }
  }
}

# Variables:
# {
#   "drugIds": ["drug_12345", "drug_54321", "drug_11111"],
#   "province": "ON"
# }

Response

response.json
{
  "data": {
    "comparePrices": {
      "drugs": [
        {
          "drug": {
            "id": "drug_12345",
            "name": "Metformin 500mg",
            "din": "02248573"
          },
          "pharmacyPrices": [
            {
              "pharmacy": {
                "id": "pharm_001",
                "name": "Costco Pharmacy",
                "chain": "Costco"
              },
              "amount": 8.99,
              "dispensingFee": 4.11,
              "totalCost": 13.10
            },
            {
              "pharmacy": {
                "id": "pharm_002",
                "name": "Shoppers Drug Mart",
                "chain": "Shoppers"
              },
              "amount": 12.49,
              "dispensingFee": 11.99,
              "totalCost": 24.48
            }
          ],
          "lowestPrice": 13.10,
          "highestPrice": 24.48,
          "averagePrice": 18.79,
          "savingsFromAverage": 5.69
        }
      ],
      "summary": {
        "totalLowest": 42.30,
        "totalHighest": 78.94,
        "bestPharmacy": {
          "id": "pharm_001",
          "name": "Costco Pharmacy"
        },
        "totalSavings": 36.64
      }
    }
  }
}
Subscribe to Price Alerts
mutation
Create a price alert subscription for a drug. You will be notified via webhook when the price drops below the specified threshold.

Mutation

mutation.graphql
mutation CreatePriceAlert($input: PriceAlertInput!) {
  createPriceAlert(input: $input) {
    id
    drug {
      id
      name
    }
    targetPrice
    currentLowestPrice
    status
    createdAt
  }
}

# Variables:
# {
#   "input": {
#     "drugId": "drug_12345",
#     "targetPrice": 10.00,
#     "province": "ON",
#     "notificationMethod": "WEBHOOK"
#   }
# }

Response

response.json
{
  "data": {
    "createPriceAlert": {
      "id": "alert_abc123",
      "drug": {
        "id": "drug_12345",
        "name": "Metformin 500mg"
      },
      "targetPrice": 10.00,
      "currentLowestPrice": 13.10,
      "status": "ACTIVE",
      "createdAt": "2026-04-05T14:30:00Z"
    }
  }
}

GraphQL Features

Query Complexity Analysis
Automatic complexity scoring prevents expensive queries. Each field has a cost weight; total must stay under your plan limit.
Persisted Queries
Register query hashes ahead of time for production use. Reduces payload size and prevents arbitrary query injection.
Automatic Documentation
Full introspection support with descriptions on every type and field. Works with GraphiQL, Apollo Studio, and Postman.
Batched Queries
Send multiple queries in a single HTTP request. Each query is executed independently and results are returned in order.
Depth Limiting
Maximum query depth of 10 levels prevents circular or deeply nested queries from impacting performance.
Cursor Pagination
Relay-style cursor pagination on all list fields for efficient, consistent pagination across large datasets.

Try It in the Playground

Our interactive GraphQL Playground includes schema documentation, auto-complete, and query history. No setup required.