Oystehr
CPT Code Search

CPT Code Search

Search CPT (Current Procedural Terminology) codes by code or description. The search supports exact matches, prefix searches, and full-text search with BM25 ranking.

Searching for CPT Codes

You can search for CPT codes using the SDK or API:

Search for CPT codes with the SDK:

import Oystehr from '@oystehr/sdk';
 
const oystehr = new Oystehr({
  accessToken: "<your_access_token>",
});
 
const result = await oystehr.terminology.searchCpt({
  query: "99213",
});

Query Parameters

  • query (required): Search query string (code or description text)
  • searchType (optional): Type of search to perform
    • code - searches only code field
    • description - searches all description fields
    • all - searches both code and descriptions (default)
  • limit (optional): Number of results per page (1-100, default: 10)
  • cursor (optional): Cursor for pagination. Use the nextCursor from a previous response to get the next page
  • strictMatch (optional): When true, only returns exact matches without fuzzy search or prefix matching (default: false)

Response

{
  "codes": [
    {
      "code": "99213",
      "display": "Office or other outpatient visit for the evaluation and management of an established patient"
    }
  ],
  "metadata": {
    "nextCursor": "MS4zOjk5MjEz" // Base64-encoded cursor, null if no more results
  }
}

Pagination

The API uses cursor-based pagination. To retrieve the next page of results, pass the nextCursor value from the previous response as the cursor parameter in your next request:

// First page
const page1 = await oystehr.terminology.searchCpt({
  query: "office",
  limit: 10,
});
 
// Next page (if available)
if (page1.metadata.nextCursor) {
  const page2 = await oystehr.terminology.searchCpt({
    query: "office",
    limit: 10,
    cursor: page1.metadata.nextCursor,
  });
}

Search Behavior

The search uses MiniSearch with BM25 scoring and searches across multiple fields.

Prefix Search

For code-based searches, the system supports prefix matching (e.g., "9921" matches "99213", "99214", etc.).

Full-Text Search

For description-based searches, the system performs full-text search across all description fields with relevance ranking.

Access Policy

Access Policy Action: Terminology:SearchCodes Access Policy Resource: Terminology:Code:*