Developer Quickstart
Get up and running with the TransparentMedz API in 5 minutes. Follow these steps to make your first request and build a working integration.
Sign up for a free TransparentMedz developer account to get access to the API. The free tier includes 1,000 requests per month.
# No code needed — sign up at:
# https://transparentmedz.ca/register
# Once registered, navigate to your dashboard:
# https://transparentmedz.ca/dashboardYour free tier includes 1,000 API requests per month, access to drug search, price comparison, and pharmacy endpoints.
Create an API key from your dashboard. Select the permissions your application needs. Keep your key secure and never expose it in client-side code.
# Go to Dashboard > API Keys > Create Key
# Select permissions:
# - drugs:read (search and retrieve drug data)
# - prices:read (access pricing information)
# - pharmacies:read (list pharmacies)
# Your key will look like:
# tm_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6
# Store it securely as an environment variable:
export TRANSPARENTMEDZ_API_KEY="tm_live_your_key_here"The API key is shown only once at creation. Copy it immediately and store it in a secure location like environment variables or a secrets manager.
Use your API key to search for a drug. All requests go to https://api.transparentmedz.com/v1 and require a Bearer token in the Authorization header.
# Search for a drug using curl
curl -X GET "https://api.transparentmedz.com/v1/drugs/search?query=metformin&limit=3" \
-H "Authorization: Bearer $TRANSPARENTMEDZ_API_KEY" \
-H "Content-Type: application/json"Expected Output
{
"data": [
{
"id": "drug_123",
"name": "Metformin",
"strength": "500mg",
"form": "Tablet",
"generic": true
}
],
"pagination": {
"total": 24,
"limit": 3,
"offset": 0,
"has_more": true
}
}The API returns JSON by default. Use the 'limit' and 'offset' parameters for pagination.
Parse the response data and handle errors gracefully. Every response includes rate limit headers so you can monitor your usage.
import { TransparentMedz } from '@transparentmedz/sdk';
const client = new TransparentMedz({
apiKey: process.env.TRANSPARENTMEDZ_API_KEY!,
});
async function findBestPrice(drugName: string, postalCode: string) {
try {
// Step 1: Search for the drug
const drugs = await client.drugs.search({ query: drugName, limit: 1 });
if (drugs.data.length === 0) {
console.log('Drug not found');
return;
}
const drug = drugs.data[0];
console.log(`Found: ${drug.name} (${drug.din})`);
// Step 2: Compare prices
const prices = await client.prices.compare({
drugId: drug.id,
postalCode,
radius: 25,
});
// Step 3: Find the cheapest option
const cheapest = prices.data.sort(
(a, b) => parseFloat(a.price) - parseFloat(b.price)
)[0];
console.log(`Best price: $${cheapest.price} at ${cheapest.pharmacy}`);
} catch (error) {
if (error.status === 429) {
console.log(`Rate limited. Retry after ${error.retryAfter}s`);
} else {
console.error('API error:', error.message);
}
}
}
findBestPrice('metformin 500mg', 'M5V 2H1');Expected Output
Found: Metformin (500mg)
Best price: $8.50 at Test PharmacyAlways check for rate limit headers (X-RateLimit-Remaining) and implement exponential backoff for 429 responses.
Review the production checklist to ensure your integration is reliable, secure, and ready for real users.
# Production Checklist
# 1. Environment variables (never hardcode keys)
TRANSPARENTMEDZ_API_KEY=tm_live_...
# 2. Error handling
- Handle all error codes (400, 401, 403, 404, 429, 500, 503)
- Implement retry logic with exponential backoff
- Log request_id from error responses for debugging
# 3. Rate limiting
- Monitor X-RateLimit-Remaining header
- Queue requests to stay within limits
- Consider upgrading plan if hitting limits regularly
# 4. Caching
- Cache drug search results (TTL: 1 hour)
- Cache pharmacy lists (TTL: 24 hours)
- Never cache prices for more than 15 minutes
# 5. Security
- Use separate API keys for staging and production
- Rotate keys periodically
- Use minimum required permissions per keyStart with the free tier and upgrade as your traffic grows. Contact support@transparentmedz.ca for enterprise pricing with custom rate limits.