Use the Surescripts Directory Service API; send a DirectoryLookup request with the provider NPI or pharmacy NCPDP provider ID (NPI) to retrieve their Surescripts Provider Identifier (SPI)
Confirm the routing record includes ServiceLevel (indicating which SCRIPT transactions the endpoint supports, e.g., NewRx, CancelRx, RxFill), and MailboxID for message delivery
For pharmacy lookups, validate the pharmacy's NCPDP pharmacy NPI and confirm it is listed as 'Active' and enabled for the transaction type you intend to send
Cache directory results with a TTL aligned to Surescripts guidance (check current documentation; directory data changes frequently during provider onboarding and address changes)
Re-query the directory in real time for new patient encounters or when a prior message to that SPI returned a routing error
For prescriber searches, also cross-reference the NPI Registry (nppes.cms.hhs.gov) to confirm the NPI is active and taxonomy code matches expected provider type
Known gotchas
A provider having an active NPI does not mean they are enrolled in the Surescripts network; enrollment is a separate process and the SPI will not exist until enrollment is complete
Pharmacies that have closed or changed ownership may retain an active NCPDP record for a transitional period; always check the Surescripts directory status rather than relying solely on the NCPDP NCPDP provider database
Bulk directory downloads are available but lag real-time status; for production prescription routing, real-time directory lookups are safer than batch-refreshed local caches
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp