client.agent.create(request) -> AgentResponse
-
-
-
Creates a new PhenoAgent with specified configuration
-
-
-
client.agent().create( AgentCreateRequest .builder() .name("name") .prompts( new ArrayList<String>( Arrays.asList("prompt_123", "prompt_456") ) ) .provider( AgentCreateRequestProvider.of("provider") ) .build() );
-
-
-
request:
AgentCreateRequest
-
-
client.agent.list() -> AgentListResponse
-
-
-
Retrieves a list of PhenoAgents belonging to the authenticated user
-
-
-
client.agent().list( AgentListRequest .builder() .tags("tags") .build() );
-
-
-
tags:
Optional<String>β Filter by tags
-
-
client.agent.get(id) -> AgentResponse
-
-
-
Retrieves a specific agent by its ID
-
-
-
client.agent().get("id");
-
-
-
id:
Stringβ Agent ID
-
-
client.agent.update(id, request) -> AgentResponse
-
-
-
Updates an existing agent's configuration
-
-
-
client.agent().update( "id", AgentCreateRequest .builder() .name("name") .prompts( new ArrayList<String>( Arrays.asList("prompt_123", "prompt_456") ) ) .provider( AgentCreateRequestProvider.of("provider") ) .build() );
-
-
-
id:
Stringβ Agent ID
-
request:
AgentCreateRequest
-
-
client.agent.delete(id) -> AgentDeleteResponse
-
-
-
Deletes an existing agent
-
-
-
client.agent().delete("id");
-
-
-
id:
Stringβ Agent ID
-
-
client.agent.patch(id, request) -> AgentResponse
-
-
-
Patches an existing agent's configuration
-
-
-
client.agent().patch( "id", new ArrayList<JsonPatchOperation>( Arrays.asList( JsonPatchOperation .builder() .op(JsonPatchOperationOp.REPLACE) .path("/name") .value("Updated Agent Name") .build(), JsonPatchOperation .builder() .op(JsonPatchOperationOp.ADD) .path("/tags/-") .value("new-tag") .build(), JsonPatchOperation .builder() .op(JsonPatchOperationOp.REMOVE) .path("/description") .build() ) ) );
-
-
-
id:
Stringβ Agent ID
-
request:
List<JsonPatchOperation>
-
-
client.agent.chat(request) -> AgentChatResponse
-
-
-
Send a message to an agent and receive a JSON response.
-
-
-
client.agent().chat( AgentChatRequest .builder() .message("What is the patient's current condition?") .agentId("agent-123") .phenomlOnBehalfOf("Patient/550e8400-e29b-41d4-a716-446655440000") .phenomlFhirProvider("550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...") .build() );
-
-
-
phenomlOnBehalfOf:
Optional<String>Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity. Must be in the format: Patient/{uuid} or Practitioner/{uuid}
-
phenomlFhirProvider:
Optional<String>Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}. Multiple FHIR provider integrations can be provided as comma-separated values.
-
message:
Stringβ The message to send to the agent
-
context:
Optional<String>β Optional context for the conversation
-
sessionId:
Optional<String>β Optional session ID for conversation continuity
-
agentId:
Stringβ The ID of the agent to chat with
-
enhancedReasoning:
Optional<Boolean>β Enable enhanced reasoning capabilities, will increase latency but will also improve response quality and reliability.
-
-
client.agent.streamChat(request) -> Optional<AgentChatStreamEvent>
-
-
-
Send a message to an agent and receive the response as a Server-Sent Events (SSE) stream. Events include message_start, content_delta, tool_use, tool_result, message_end, and error.
-
-
-
client.agent().streamChat( AgentStreamChatRequest .builder() .message("What is the patient's current condition?") .agentId("agent-123") .phenomlOnBehalfOf("Patient/550e8400-e29b-41d4-a716-446655440000") .phenomlFhirProvider("550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...") .build() );
-
-
-
phenomlOnBehalfOf:
Optional<String>Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity. Must be in the format: Patient/{uuid} or Practitioner/{uuid}
-
phenomlFhirProvider:
Optional<String>Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}. Multiple FHIR provider integrations can be provided as comma-separated values.
-
message:
Stringβ The message to send to the agent
-
context:
Optional<String>β Optional context for the conversation
-
sessionId:
Optional<String>β Optional session ID for conversation continuity
-
agentId:
Stringβ The ID of the agent to chat with
-
enhancedReasoning:
Optional<Boolean>β Enable enhanced reasoning capabilities, will increase latency but will also improve response quality and reliability.
-
-
client.agent.getChatMessages() -> AgentGetChatMessagesResponse
-
-
-
Retrieves a list of chat messages for a given chat session
-
-
-
client.agent().getChatMessages( AgentGetChatMessagesRequest .builder() .chatSessionId("chat_session_id") .numMessages(1) .role(AgentGetChatMessagesRequestRole.USER) .order(AgentGetChatMessagesRequestOrder.ASC) .build() );
-
-
-
chatSessionId:
Stringβ Chat session ID
-
numMessages:
Optional<Integer>β Number of messages to return
-
role:
Optional<AgentGetChatMessagesRequestRole>Filter by one or more message roles. Multiple roles can be specified as a comma-separated string. If not specified, messages with all roles are returned.
Available roles:
user- Messages from the userassistant- Text responses from the AI assistantmodel- Function/tool call requests from the modelfunction- Function/tool call results
-
order:
Optional<AgentGetChatMessagesRequestOrder>β Order of messages
-
-
client.agent.prompts.create(request) -> AgentPromptsResponse
-
-
-
Creates a new agent prompt
-
-
-
client.agent().prompts().create( AgentPromptsCreateRequest .builder() .name("Medical Assistant System Prompt") .content("You are a helpful medical assistant specialized in FHIR data processing...") .build() );
-
-
-
name:
Stringβ Prompt name
-
description:
Optional<String>β Prompt description
-
content:
Stringβ Prompt content
-
isDefault:
Optional<Boolean>β Whether this is a default prompt
-
tags:
Optional<List<String>>β Tags for categorizing the prompt
-
-
client.agent.prompts.list() -> PromptsListResponse
-
-
-
Retrieves a list of agent prompts belonging to the authenticated user
-
-
-
client.agent().prompts().list();
-
-
client.agent.prompts.get(id) -> AgentPromptsResponse
-
-
-
Retrieves a specific prompt by its ID
-
-
-
client.agent().prompts().get("id");
-
-
-
id:
Stringβ Prompt ID
-
-
client.agent.prompts.update(id, request) -> AgentPromptsResponse
-
-
-
Updates an existing prompt
-
-
-
client.agent().prompts().update( "id", AgentPromptsUpdateRequest .builder() .build() );
-
-
-
id:
Stringβ Prompt ID
-
name:
Optional<String>β Prompt name
-
description:
Optional<String>β Prompt description
-
content:
Optional<String>β Prompt content
-
isDefault:
Optional<Boolean>β Whether this is a default prompt
-
tags:
Optional<List<String>>β Tags for categorizing the prompt
-
-
client.agent.prompts.delete(id) -> PromptsDeleteResponse
-
-
-
Deletes a prompt
-
-
-
client.agent().prompts().delete("id");
-
-
-
id:
Stringβ Prompt ID
-
-
client.agent.prompts.patch(id, request) -> AgentPromptsResponse
-
-
-
Patches an existing prompt
-
-
-
client.agent().prompts().patch( "id", new ArrayList<JsonPatchOperation>( Arrays.asList( JsonPatchOperation .builder() .op(JsonPatchOperationOp.REPLACE) .path("/name") .value("Updated Agent Name") .build(), JsonPatchOperation .builder() .op(JsonPatchOperationOp.ADD) .path("/tags/-") .value("new-tag") .build(), JsonPatchOperation .builder() .op(JsonPatchOperationOp.REMOVE) .path("/description") .build() ) ) );
-
-
-
id:
Stringβ Agent Prompt ID
-
request:
List<JsonPatchOperation>
-
-
client.agent.prompts.loadDefaults() -> SuccessResponse
-
-
-
Loads default agent prompts for the authenticated user
-
-
-
client.agent().prompts().loadDefaults();
-
-
client.authtoken.auth.generateToken(request) -> AuthGenerateTokenResponse
-
-
-
Obtain an access token using client credentials
-
-
-
client.authtoken().auth().generateToken( AuthGenerateTokenRequest .builder() .username("username") .password("password") .build() );
-
-
-
username:
Stringβ The user's username or email
-
password:
Stringβ The user's password
-
-
client.authtoken.auth.getToken(request) -> TokenResponse
-
-
-
OAuth 2.0 client credentials token endpoint (RFC 6749 Β§4.4). Accepts client_id and client_secret in the request body (JSON or form-encoded) or via Basic Auth header (RFC 6749 Β§2.3.1), and returns an access token with expiration information.
-
-
-
client.authtoken().auth().getToken( ClientCredentialsRequest .builder() .build() );
-
-
-
grantType:
Optional<String>β Must be "client_credentials" if provided
-
clientId:
Optional<String>β The client ID (credential username)
-
clientSecret:
Optional<String>β The client secret (credential password)
-
-
client.cohort.analyze(request) -> CohortResponse
-
-
-
Converts natural language text into structured FHIR search queries for patient cohort analysis
-
-
-
client.cohort().analyze( CohortRequest .builder() .text("female patients over 65 with diabetes but not hypertension") .build() );
-
-
-
text:
Stringβ Natural language text describing patient cohort criteria
-
-
client.construe.uploadCodeSystem(request) -> ConstrueUploadCodeSystemResponse
-
-
-
Upload a custom medical code system with codes and descriptions for use in code extraction. Requires a paid plan. Returns 202 immediately; embedding generation runs asynchronously. Poll GET /construe/codes/systems/{codesystem}?version={version} to check when status transitions from "processing" to "ready" or "failed".
-
-
-
client.construe().uploadCodeSystem( UploadRequest .builder() .name("CUSTOM_CODES") .version("1.0") .format(UploadRequestFormat.CSV) .build() );
-
-
-
name:
StringName of the code system. Names are case-insensitive and stored uppercase. Builtin system names (e.g. ICD-10-CM, SNOMED_CT_US_LITE, LOINC, CPT, etc.) are reserved and cannot be used for custom uploads; attempts return HTTP 403 Forbidden.
-
version:
Stringβ Version of the code system
-
revision:
Optional<Float>β Optional revision number
-
format:
UploadRequestFormatβ Upload format
-
file:
Optional<String>The file contents as a base64-encoded string. For CSV format, this is the CSV file contents. For JSON format, this is a base64-encoded JSON array; prefer using 'codes' instead.
-
codeCol:
Optional<String>β Column name containing codes (required for CSV format)
-
descCol:
Optional<String>β Column name containing descriptions (required for CSV format)
-
defnCol:
Optional<String>β Optional column name containing long definitions (for CSV format)
-
codes:
Optional<List<CodeResponse>>The codes to upload as a JSON array (JSON format only). This is the preferred way to upload JSON codes, as it avoids unnecessary base64 encoding. If both 'codes' and 'file' are provided, 'codes' takes precedence.
-
replace:
Optional<Boolean>If true, replaces an existing code system with the same name and version. Builtin systems cannot be replaced; attempts to do so return HTTP 403 Forbidden. When false (default), uploading a duplicate returns 409 Conflict.
-
-
client.construe.extractCodes(request) -> ExtractCodesResult
-
-
-
Converts natural language text into structured medical codes.
Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
-
-
-
client.construe().extractCodes( ExtractRequest .builder() .text("Patient is a 14-year-old female, previously healthy, who is here for evaluation of abnormal renal ultrasound with atrophic right kidney") .build() );
-
-
-
text:
Stringβ Natural language text to extract codes from
-
system:
Optional<ExtractRequestSystem>
-
config:
Optional<ExtractRequestConfig>
-
-
client.construe.listAvailableCodeSystems() -> ListCodeSystemsResponse
-
-
-
Returns the terminology server's catalog of available code systems, including both built-in standard terminologies and custom uploaded systems.
-
-
-
client.construe().listAvailableCodeSystems();
-
-
client.construe.getCodeSystemDetail(codesystem) -> GetCodeSystemDetailResponse
-
-
-
Returns full metadata for a single code system, including timestamps and builtin status.
-
-
-
client.construe().getCodeSystemDetail( "ICD-10-CM", GetConstrueCodesSystemsCodesystemRequest .builder() .version("2025") .build() );
-
-
-
codesystem:
Stringβ Code system name (e.g., "ICD-10-CM", "SNOMED_CT_US_LITE")
-
version:
Optional<String>β Specific version of the code system. Required if multiple versions exist.
-
-
client.construe.deleteCustomCodeSystem(codesystem) -> DeleteCodeSystemResponse
-
-
-
Deletes a custom (non-builtin) code system and all its codes. Builtin systems cannot be deleted. Only available on dedicated instances. Large systems may take up to a minute to delete.
-
-
-
client.construe().deleteCustomCodeSystem( "CUSTOM_CODES", DeleteConstrueCodesSystemsCodesystemRequest .builder() .version("version") .build() );
-
-
-
codesystem:
Stringβ Code system name
-
version:
Optional<String>β Specific version of the code system. Required if multiple versions exist.
-
-
client.construe.exportCustomCodeSystem(codesystem) -> ExportCodeSystemResponse
-
-
-
Exports a custom (non-builtin) code system as a JSON file compatible with the upload format. The exported file can be re-uploaded directly via POST /construe/upload with format "json". Only available on dedicated instances. Builtin systems cannot be exported.
-
-
-
client.construe().exportCustomCodeSystem( "CUSTOM_CODES", GetConstrueCodesSystemsCodesystemExportRequest .builder() .version("version") .build() );
-
-
-
codesystem:
Stringβ Code system name
-
version:
Optional<String>β Specific version of the code system. Required if multiple versions exist.
-
-
client.construe.listCodesInACodeSystem(codesystem) -> ListCodesResponse
-
-
-
Returns a paginated list of all codes in the specified code system from the terminology server.
Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
-
-
-
client.construe().listCodesInACodeSystem( "ICD-10-CM", GetConstrueCodesCodesystemRequest .builder() .version("2025") .cursor("cursor") .limit(1) .build() );
-
-
-
codesystem:
Stringβ Code system name (e.g., "ICD-10-CM", "SNOMED_CT_US_LITE")
-
version:
Optional<String>β Specific version of the code system. Required if multiple versions exist.
-
cursor:
Optional<String>β Pagination cursor from previous response
-
limit:
Optional<Integer>β Maximum number of codes to return (default 20)
-
-
client.construe.getASpecificCode(codesystem, codeId) -> GetCodeResponse
-
-
-
Looks up a specific code in the terminology server and returns its details.
Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
-
-
-
client.construe().getASpecificCode( "ICD-10-CM", "E11.65", GetConstrueCodesCodesystemCodeIdRequest .builder() .version("version") .build() );
-
-
-
codesystem:
Stringβ Code system name
-
codeId:
Stringβ The code identifier
-
version:
Optional<String>β Specific version of the code system
-
-
client.construe.semanticSearchEmbeddingBased(codesystem) -> SemanticSearchResponse
-
-
-
Performs semantic similarity search using vector embeddings.
Availability: This endpoint works for both built-in and custom code systems.
When to use: Best for natural language queries where you want to find conceptually related codes, even when different terminology is used. The search understands meaning, not just keywords.
Examples:
- Query "trouble breathing at night" finds codes like "Sleep apnea", "Orthopnea", "Nocturnal dyspnea" β semantically related but no exact keyword matches
- Query "heart problems" finds "Myocardial infarction", "Cardiac arrest", "Arrhythmia"
Trade-offs: Slower than text search (requires embedding generation), but finds conceptually similar results that keyword search would miss.
See also:
/search/textfor faster keyword-based lookup with typo tolerance.Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
-
-
-
client.construe().semanticSearchEmbeddingBased( "ICD-10-CM", GetConstrueCodesCodesystemSearchSemanticRequest .builder() .text("patient has trouble breathing at night and wakes up gasping") .version("version") .limit(1) .build() );
-
-
-
codesystem:
Stringβ Code system name
-
text:
Stringβ Natural language text to find semantically similar codes for
-
version:
Optional<String>β Specific version of the code system
-
limit:
Optional<Integer>β Maximum number of results (default 10, max 50)
-
-
client.construe.submitFeedbackOnExtractionResults(request) -> FeedbackResponse
-
-
-
Submits user feedback on results from the Construe extraction endpoint. Feedback includes the full extraction result received and the result the user expected.
-
-
-
client.construe().submitFeedbackOnExtractionResults( FeedbackRequest .builder() .text("Patient has type 2 diabetes with hyperglycemia") .receivedResult( ExtractCodesResult .builder() .system( ExtractRequestSystem .builder() .build() ) .codes( new ArrayList<ExtractedCodeResult>( Arrays.asList( ExtractedCodeResult .builder() .code("195967001") .description("Asthma") .valid(true) .build() ) ) ) .build() ) .expectedResult( ExtractCodesResult .builder() .system( ExtractRequestSystem .builder() .build() ) .codes( new ArrayList<ExtractedCodeResult>( Arrays.asList( ExtractedCodeResult .builder() .code("195967001") .description("Asthma") .valid(true) .build() ) ) ) .build() ) .build() );
-
-
-
text:
Stringβ The natural language text that was used for code extraction
-
receivedResult:
ExtractCodesResult
-
expectedResult:
ExtractCodesResult
-
detail:
Optional<String>β Optional details explaining the feedback
-
-
client.construe.terminologyServerTextSearch(codesystem) -> TextSearchResponse
-
-
-
Performs fast full-text search over code IDs and descriptions.
Availability: This endpoint is only available for built-in code systems. Custom code systems uploaded via
/construe/uploadare not indexed for full-text search and will return empty results. Use/search/semanticto search custom code systems.When to use: Best for autocomplete UIs, code lookup, or when users know part of the code ID or specific keywords. Fast response times suitable for typeahead interfaces.
Features:
- Substring matching on code IDs (e.g., "11.65" finds "E11.65")
- Typo tolerance on descriptions (not on code IDs)
- Fast response times (~10-50ms)
Examples:
- Query "E11" finds all codes starting with E11 (diabetes codes)
- Query "diabtes" (typo) still finds "diabetes" codes
Trade-offs: Faster than semantic search, but only matches keywords/substrings. Won't find conceptually related codes with different terminology.
See also:
/search/semanticfor finding conceptually similar codes.Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
-
-
-
client.construe().terminologyServerTextSearch( "ICD-10-CM", GetConstrueCodesCodesystemSearchTextRequest .builder() .q("E11.65") .version("version") .limit(1) .build() );
-
-
-
codesystem:
Stringβ Code system name
-
q:
Stringβ Search query (searches code IDs and descriptions)
-
version:
Optional<String>β Specific version of the code system
-
limit:
Optional<Integer>β Maximum number of results (default 20, max 100)
-
-
client.fhir.search(fhirProviderId, fhirPath) -> FhirSearchResponse
-
-
-
Retrieves FHIR resources from the specified provider. Supports both individual resource retrieval and search operations based on the FHIR path and query parameters.
The request is proxied to the configured FHIR server with appropriate authentication headers.
-
-
-
client.fhir().search( "550e8400-e29b-41d4-a716-446655440000", "Patient", FhirSearchRequest .builder() .phenomlOnBehalfOf("Patient/550e8400-e29b-41d4-a716-446655440000") .phenomlFhirProvider("550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...") .build() );
-
-
-
fhirProviderId:
StringThe ID of the FHIR provider to use. Can be either:
- A UUID representing the provider ID
- A provider name (legacy support - will just use the most recently updated provider with this name)
-
fhirPath:
StringThe FHIR resource path to operate on. This follows FHIR RESTful API conventions. Examples:
- "Patient" (for resource type operations)
- "Patient/123" (for specific resource operations)
- "Patient/123/_history" (for history operations)
-
queryParameters:
Optional<Map<String, Optional<String>>>FHIR-compliant query parameters for search operations. Supports standard FHIR search parameters including:
- Resource-specific search parameters (e.g., name for Patient, status for Observation)
- Common search parameters (_id, _lastUpdated, _tag, _profile, _security, _text, _content, _filter)
- Result parameters (_count, _offset, _sort, _include, _revinclude, _summary, _elements)
- Search prefixes for dates, numbers, quantities (eq, ne, gt, ge, lt, le, sa, eb, ap)
-
phenomlOnBehalfOf:
Optional<String>Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity. Must be in the format: Patient/{uuid} or Practitioner/{uuid}
-
phenomlFhirProvider:
Optional<String>Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}. Multiple FHIR provider integrations can be provided as comma-separated values.
-
-
client.fhir.create(fhirProviderId, fhirPath, request) -> FhirResource
-
-
-
Creates a new FHIR resource on the specified provider. The request body should contain a valid FHIR resource in JSON format.
The request is proxied to the configured FHIR server with appropriate authentication headers.
-
-
-
client.fhir().create( "550e8400-e29b-41d4-a716-446655440000", "Patient", FhirCreateRequest .builder() .body( FhirResource .builder() .resourceType("Patient") .build() ) .phenomlOnBehalfOf("Patient/550e8400-e29b-41d4-a716-446655440000") .phenomlFhirProvider("550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...") .build() );
-
-
-
fhirProviderId:
StringThe ID of the FHIR provider to use. Can be either:
- A UUID representing the provider ID
- A provider name (legacy support - will just use the most recently updated provider with this name)
-
fhirPath:
StringThe FHIR resource path to operate on. This follows FHIR RESTful API conventions. Examples:
- "Patient" (for resource type operations)
- "Patient/123" (for specific resource operations)
- "Patient/123/_history" (for history operations)
-
phenomlOnBehalfOf:
Optional<String>Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity. Must be in the format: Patient/{uuid} or Practitioner/{uuid}
-
phenomlFhirProvider:
Optional<String>Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}. Multiple FHIR provider integrations can be provided as comma-separated values.
-
request:
FhirResource
-
-
client.fhir.upsert(fhirProviderId, fhirPath, request) -> FhirResource
-
-
-
Creates or updates a FHIR resource on the specified provider. If the resource exists, it will be updated; otherwise, it will be created.
The request is proxied to the configured FHIR server with appropriate authentication headers.
-
-
-
client.fhir().upsert( "550e8400-e29b-41d4-a716-446655440000", "Patient", FhirUpsertRequest .builder() .body( FhirResource .builder() .resourceType("Patient") .id("123") .build() ) .phenomlOnBehalfOf("Patient/550e8400-e29b-41d4-a716-446655440000") .phenomlFhirProvider("550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...") .build() );
-
-
-
fhirProviderId:
StringThe ID of the FHIR provider to use. Can be either:
- A UUID representing the provider ID
- A provider name (legacy support - will just use the most recently updated provider with this name)
-
fhirPath:
StringThe FHIR resource path to operate on. This follows FHIR RESTful API conventions. Examples:
- "Patient" (for resource type operations)
- "Patient/123" (for specific resource operations)
- "Patient/123/_history" (for history operations)
-
phenomlOnBehalfOf:
Optional<String>Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity. Must be in the format: Patient/{uuid} or Practitioner/{uuid}
-
phenomlFhirProvider:
Optional<String>Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}. Multiple FHIR provider integrations can be provided as comma-separated values.
-
request:
FhirResource
-
-
client.fhir.delete(fhirProviderId, fhirPath) -> Map<String, Object>
-
-
-
Deletes a FHIR resource from the specified provider.
The request is proxied to the configured FHIR server with appropriate authentication headers.
-
-
-
client.fhir().delete( "550e8400-e29b-41d4-a716-446655440000", "Patient", FhirDeleteRequest .builder() .phenomlOnBehalfOf("Patient/550e8400-e29b-41d4-a716-446655440000") .phenomlFhirProvider("550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...") .build() );
-
-
-
fhirProviderId:
StringThe ID of the FHIR provider to use. Can be either:
- A UUID representing the provider ID
- A provider name (legacy support - will just use the most recently updated provider with this name)
-
fhirPath:
StringThe FHIR resource path to operate on. This follows FHIR RESTful API conventions. Examples:
- "Patient" (for resource type operations)
- "Patient/123" (for specific resource operations)
- "Patient/123/_history" (for history operations)
-
phenomlOnBehalfOf:
Optional<String>Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity. Must be in the format: Patient/{uuid} or Practitioner/{uuid}
-
phenomlFhirProvider:
Optional<String>Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}. Multiple FHIR provider integrations can be provided as comma-separated values.
-
-
client.fhir.patch(fhirProviderId, fhirPath, request) -> FhirResource
-
-
-
Partially updates a FHIR resource on the specified provider using JSON Patch operations as defined in RFC 6902.
The request body should contain an array of JSON Patch operations. Each operation specifies:
op: The operation type (add, remove, replace, move, copy, test)path: JSON Pointer to the target location in the resourcevalue: The value to use (required for add, replace, and test operations)
The request is proxied to the configured FHIR server with appropriate authentication headers.
-
-
-
client.fhir().patch( "550e8400-e29b-41d4-a716-446655440000", "Patient", FhirPatchRequest .builder() .body( new ArrayList<FhirPatchRequestBodyItem>( Arrays.asList( FhirPatchRequestBodyItem .builder() .op(FhirPatchRequestBodyItemOp.REPLACE) .path("/name/0/family") .value("NewFamilyName") .build() ) ) ) .phenomlOnBehalfOf("Patient/550e8400-e29b-41d4-a716-446655440000") .phenomlFhirProvider("550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...") .build() );
-
-
-
fhirProviderId:
StringThe ID of the FHIR provider to use. Can be either:
- A UUID representing the provider ID
- A provider name (legacy support - will just use the most recently updated provider with this name)
-
fhirPath:
StringThe FHIR resource path to operate on. This follows FHIR RESTful API conventions. Examples:
- "Patient" (for resource type operations)
- "Patient/123" (for specific resource operations)
- "Patient/123/_history" (for history operations)
-
phenomlOnBehalfOf:
Optional<String>Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity. Must be in the format: Patient/{uuid} or Practitioner/{uuid}
-
phenomlFhirProvider:
Optional<String>Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}. Multiple FHIR provider integrations can be provided as comma-separated values.
-
request:
List<FhirPatchRequestBodyItem>β Array of JSON Patch operations following RFC 6902
-
-
client.fhir.executeBundle(fhirProviderId, request) -> FhirBundle
-
-
-
Executes a FHIR Bundle transaction or batch operation on the specified provider. This allows multiple FHIR resources to be processed in a single request.
The request body should contain a valid FHIR Bundle resource with transaction or batch type.
The request is proxied to the configured FHIR server with appropriate authentication headers.
-
-
-
client.fhir().executeBundle( "550e8400-e29b-41d4-a716-446655440000", FhirExecuteBundleRequest .builder() .body( FhirBundle .builder() .resourceType("Bundle") .entry( new ArrayList<FhirBundleEntryItem>( Arrays.asList( FhirBundleEntryItem .builder() .resource( new HashMap<String, Object>() {{ put("resourceType", "Patient"); put("name", new ArrayList<Object>() {Arrays.asList(new HashMap<String, Object>() {{put("family", "Doe"); put("given", new ArrayList<Object>() {Arrays.asList("John") }); }}) }); }} ) .request( FhirBundleEntryItemRequest .builder() .method(FhirBundleEntryItemRequestMethod.POST) .url("Patient") .build() ) .build(), FhirBundleEntryItem .builder() .resource( new HashMap<String, Object>() {{ put("resourceType", "Observation"); put("status", "final"); put("subject", new HashMap<String, Object>() {{put("reference", "Patient/123"); }}); }} ) .request( FhirBundleEntryItemRequest .builder() .method(FhirBundleEntryItemRequestMethod.POST) .url("Observation") .build() ) .build() ) ) ) .build() ) .phenomlOnBehalfOf("Patient/550e8400-e29b-41d4-a716-446655440000") .phenomlFhirProvider("550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...") .build() );
-
-
-
fhirProviderId:
StringThe ID of the FHIR provider to use. Can be either:
- A UUID representing the provider ID
- A provider name (legacy support - will just use the most recently updated provider with this name)
-
phenomlOnBehalfOf:
Optional<String>Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity. Must be in the format: Patient/{uuid} or Practitioner/{uuid}
-
phenomlFhirProvider:
Optional<String>Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}. Multiple FHIR provider integrations can be provided as comma-separated values.
-
request:
FhirBundle
-
-
client.fhirProvider.create(request) -> FhirProviderResponse
-
-
-
Creates a new FHIR provider configuration with authentication credentials.
Note: The "sandbox" provider type cannot be created via this API - it is managed internally.
-
-
-
client.fhirProvider().create( FhirProviderCreateRequest .builder() .name("Epic Sandbox") .provider(Provider.ATHENAHEALTH) .baseUrl("https://fhir.epic.com/interconnect-fhir-oauth/api/FHIR/R4") .auth( FhirProviderCreateRequestAuth.jwt( JwtAuth .builder() .clientId("your-client-id") .build() ) ) .build() );
-
-
-
name:
Stringβ Display name for the FHIR provider
-
description:
Optional<String>β Optional description of the FHIR provider
-
provider:
Provider
-
baseUrl:
Stringβ Base URL of the FHIR server
-
auth:
FhirProviderCreateRequestAuth
-
-
client.fhirProvider.list() -> FhirProviderListResponse
-
-
-
Retrieves a list of all active FHIR providers for the authenticated user.
On shared instances, only sandbox providers are returned. Sandbox providers return FhirProviderSandboxInfo.
-
-
-
client.fhirProvider().list();
-
-
client.fhirProvider.get(fhirProviderId) -> FhirProviderResponse
-
-
-
Retrieves a specific FHIR provider configuration by its ID.
Sandbox providers return FhirProviderSandboxInfo. On shared instances, only sandbox providers can be accessed.
-
-
-
client.fhirProvider().get("fhir_provider_id");
-
-
-
fhirProviderId:
Stringβ ID of the FHIR provider to retrieve
-
-
client.fhirProvider.delete(fhirProviderId) -> FhirProviderDeleteResponse
-
-
-
Deletes a FHIR provider.
Note: Sandbox providers cannot be deleted.
-
-
-
client.fhirProvider().delete("fhir_provider_id");
-
-
-
fhirProviderId:
Stringβ ID of the FHIR provider to delete
-
-
client.fhirProvider.addAuthConfig(fhirProviderId, request) -> FhirProviderResponse
-
-
-
Adds a new authentication configuration to an existing FHIR provider. This enables key rotation and multiple auth configurations per provider.
Note: Sandbox providers cannot be modified.
-
-
-
client.fhirProvider().addAuthConfig( "1716d214-de93-43a4-aa6b-a878d864e2ad", FhirProviderAddAuthConfigRequest.jwt( JwtAuth .builder() .clientId("your-client-id") .build() ) );
-
-
-
fhirProviderId:
Stringβ ID of the FHIR provider to add auth config to
-
request:
FhirProviderAddAuthConfigRequest
-
-
client.fhirProvider.setActiveAuthConfig(fhirProviderId, request) -> FhirProviderResponse
-
-
-
Sets which authentication configuration should be active for a FHIR provider. Only one auth config can be active at a time.
If the specified auth config is already active, the request succeeds without making any changes and returns a message indicating the config is already active.
Note: Sandbox providers cannot be modified.
-
-
-
client.fhirProvider().setActiveAuthConfig( "1716d214-de93-43a4-aa6b-a878d864e2ad", FhirProviderSetActiveAuthConfigRequest .builder() .authConfigId("auth-config-123") .build() );
-
-
-
fhirProviderId:
Stringβ ID of the FHIR provider
-
authConfigId:
Stringβ ID of the auth configuration to set as active
-
-
client.fhirProvider.removeAuthConfig(fhirProviderId, request) -> FhirProviderRemoveAuthConfigResponse
-
-
-
Removes an authentication configuration from a FHIR provider. Cannot remove the currently active auth configuration.
Note: Sandbox providers cannot be modified.
-
-
-
client.fhirProvider().removeAuthConfig( "1716d214-de93-43a4-aa6b-a878d864e2ad", FhirProviderRemoveAuthConfigRequest .builder() .authConfigId("auth-config-123") .build() );
-
-
-
fhirProviderId:
Stringβ ID of the FHIR provider
-
authConfigId:
Stringβ ID of the auth configuration to remove
-
-
client.lang2Fhir.create(request) -> Map<String, Object>
-
-
-
Converts natural language text into a structured FHIR resource
-
-
-
client.lang2Fhir().create( CreateRequest .builder() .version("R4") .resource(CreateRequestResource.AUTO) .text("Patient has severe asthma with acute exacerbation") .build() );
-
-
-
version:
Stringβ FHIR version to use
-
resource:
CreateRequestResourceβ Type of FHIR resource to create. Use 'auto' for automatic resource type detection, or specify a supported US Core profile. Recommended to use the supported US Core Profiles for validated results but you can also use any custom profile you've uploaded (if you're a develop or launch customer)
-
text:
Stringβ Natural language text to convert
-
-
client.lang2Fhir.createMulti(request) -> CreateMultiResponse
-
-
-
Analyzes natural language text and extracts multiple FHIR resources, returning them as a transaction Bundle. Automatically detects Patient, Condition, MedicationRequest, Observation, and other resource types from the text. Resources are linked with proper references (e.g., Conditions reference the Patient).
-
-
-
client.lang2Fhir().createMulti( CreateMultiRequest .builder() .text("John Smith, 45-year-old male, diagnosed with Type 2 Diabetes. Prescribed Metformin 500mg twice daily.") .build() );
-
-
-
text:
Stringβ Natural language text containing multiple clinical concepts to extract
-
version:
Optional<String>β FHIR version to use
-
provider:
Optional<String>β Optional FHIR provider name for provider-specific profiles
-
-
client.lang2Fhir.search(request) -> SearchResponse
-
-
-
Converts natural language text into FHIR search parameters. Automatically identifies the appropriate FHIR resource type and generates valid search query parameters.
Supported resource types include: AllergyIntolerance, Appointment, CarePlan, CareTeam, Condition, Coverage, Device, DiagnosticReport, DocumentReference, Encounter, Goal, Immunization, Location, Medication, MedicationRequest, Observation, Organization, Patient, PlanDefinition, Practitioner, PractitionerRole, Procedure, Provenance, Questionnaire, QuestionnaireResponse, RelatedPerson, Schedule, ServiceRequest, Slot, and Specimen.
-
-
-
client.lang2Fhir().search( SearchRequest .builder() .text("Appointments between March 2-9, 2025") .build() );
-
-
-
text:
StringNatural language text to convert into FHIR search parameters. The system will automatically identify the appropriate resource type and generate valid search parameters.
Examples:
- "Appointments between March 2-9, 2025" β Appointment search with date range
- "Patients with diabetes" β Condition search with code parameter
- "Active medication requests for metformin" β MedicationRequest search
- "Lab results for creatinine" β DiagnosticReport search
- "Dr. Smith's schedule" β Practitioner or Schedule search
-
-
client.lang2Fhir.uploadProfile(request) -> Lang2FhirUploadProfileResponse
-
-
-
Upload a custom FHIR StructureDefinition profile for use with the lang2fhir service.
All metadata is derived from the StructureDefinition JSON itself. The lowercase
idfield from the StructureDefinition is used as the profile's unique identifier and lookup key. To use the uploaded profile with/lang2fhir/create, pass this id as theresourceparameter.Uploads will be rejected if:
- A built-in US Core or R4 base profile already exists with the same id
- A custom profile with the same id has already been uploaded
- A custom profile with the same url has already been uploaded
-
-
-
client.lang2Fhir().uploadProfile( ProfileUploadRequest .builder() .profile("(base64 encoded FHIR StructureDefinition JSON)") .build() );
-
-
-
profile:
Stringβ Base64 encoded JSON string of a FHIR StructureDefinition. The profile must include id, url, type, and a snapshot with elements. All metadata (version, resource type, identifier) is derived from the StructureDefinition itself. The lowercase id from the StructureDefinition becomes the profile's lookup key.
-
-
client.lang2Fhir.document(request) -> Map<String, Object>
-
-
-
Extracts text from a document (PDF or image) and converts it into a structured FHIR resource
-
-
-
client.lang2Fhir().document( DocumentRequest .builder() .version("R4") .resource("questionnaire") .content("content") .build() );
-
-
-
version:
Stringβ FHIR version to use
-
resource:
Stringβ Type of FHIR resource to create. Accepts any FHIR resource type or US Core profile name.
-
content:
StringBase64 encoded file content. Supported file types: PDF (application/pdf), PNG (image/png), JPEG (image/jpeg). File type is auto-detected from content magic bytes.
-
-
client.lang2Fhir.extractMultipleFhirResourcesFromADocument(request) -> CreateMultiResponse
-
-
-
Extracts text from a document (PDF or image) and converts it into multiple FHIR resources, returned as a transaction Bundle. Combines document text extraction with multi-resource detection. Automatically detects Patient, Condition, MedicationRequest, Observation, and other resource types. Resources are linked with proper references (e.g., Conditions reference the Patient).
-
-
-
client.lang2Fhir().extractMultipleFhirResourcesFromADocument( DocumentMultiRequest .builder() .version("R4") .content("content") .build() );
-
-
-
version:
Stringβ FHIR version to use
-
content:
StringBase64 encoded file content. Supported file types: PDF (application/pdf), PNG (image/png), JPEG (image/jpeg). File type is auto-detected from content magic bytes.
-
provider:
Optional<String>β Optional FHIR provider name for provider-specific profiles
-
-
client.summary.listTemplates() -> SummaryListTemplatesResponse
-
-
-
Retrieves all summary templates for the authenticated user
-
-
-
client.summary().listTemplates();
-
-
client.summary.createTemplate(request) -> CreateSummaryTemplateResponse
-
-
-
Creates a summary template from an example using LLM function calling
-
-
-
client.summary().createTemplate( CreateSummaryTemplateRequest .builder() .name("name") .exampleSummary("Patient John Doe, age 45, presents with hypertension diagnosed on 2024-01-15.") .targetResources( new ArrayList<String>( Arrays.asList("Patient", "Condition", "Observation") ) ) .mode("mode") .build() );
-
-
-
name:
Stringβ Name of the template
-
description:
Optional<String>β Description of the template
-
exampleSummary:
Stringβ Example summary note to generate template from
-
targetResources:
List<String>β List of target FHIR resources
-
exampleFhirData:
Optional<Map<String, Object>>β Optional example FHIR data that corresponds to the example summary
-
mode:
Stringβ Template mode (stored with the template)
-
-
client.summary.getTemplate(id) -> SummaryGetTemplateResponse
-
-
-
Retrieves a specific summary template
-
-
-
client.summary().getTemplate("id");
-
-
-
id:
Stringβ Template ID
-
-
client.summary.updateTemplate(id, request) -> SummaryUpdateTemplateResponse
-
-
-
Updates an existing summary template
-
-
-
client.summary().updateTemplate( "id", UpdateSummaryTemplateRequest .builder() .name("name") .template("template") .targetResources( new ArrayList<String>( Arrays.asList("target_resources") ) ) .mode("mode") .build() );
-
-
-
id:
Stringβ Template ID
-
name:
String
-
description:
Optional<String>
-
template:
Stringβ Updated template with placeholders
-
targetResources:
List<String>
-
mode:
Stringβ Template mode
-
-
client.summary.deleteTemplate(id) -> SummaryDeleteTemplateResponse
-
-
-
Deletes a summary template
-
-
-
client.summary().deleteTemplate("id");
-
-
-
id:
Stringβ Template ID
-
-
client.summary.create(request) -> CreateSummaryResponse
-
-
-
Creates a summary from FHIR resources using one of three modes:
- narrative: Uses a template to substitute FHIR data into placeholders (requires template_id)
- flatten: Flattens FHIR resources into a searchable format for RAG/search (no template needed)
- ips: Generates an International Patient Summary (IPS) narrative per ISO 27269/HL7 FHIR IPS IG. Requires a Bundle with exactly one Patient resource (returns 400 error if no Patient or multiple Patients are present). Automatically filters resources to those referencing the patient and generates sections for allergies, medications, problems, immunizations, procedures, and vital signs.
-
-
-
client.summary().create( CreateSummaryRequest .builder() .fhirResources( CreateSummaryRequestFhirResources.ofFhirResource( FhirResource .builder() .resourceType("resourceType") .build() ) ) .build() );
-
-
-
mode:
Optional<CreateSummaryRequestMode>Summary generation mode:
- narrative: Substitute FHIR data into a template (requires template_id)
- flatten: Flatten FHIR resources for RAG/search (no template needed)
- ips: Generate International Patient Summary (IPS) narrative per ISO 27269/HL7 FHIR IPS IG
-
templateId:
Optional<String>β ID of the template to use (required for narrative mode)
-
fhirResources:
CreateSummaryRequestFhirResourcesFHIR resources (single resource or Bundle). For IPS mode, must be a Bundle containing exactly one Patient resource with at least one identifier (id, fullUrl, or identifier field). Returns an error if no Patient is found, if multiple Patients are present, or if the Patient has no identifiers. Resources are automatically filtered to only include those referencing the patient.
-
-
client.tools.createFhirResource(request) -> Lang2FhirAndCreateResponse
-
-
-
Converts natural language to FHIR resource and optionally stores it in a FHIR server
-
-
-
client.tools().createFhirResource( Lang2FhirAndCreateRequest .builder() .resource(Lang2FhirAndCreateRequestResource.AUTO) .text("Patient John Doe has severe asthma with acute exacerbation") .phenomlOnBehalfOf("Patient/550e8400-e29b-41d4-a716-446655440000") .phenomlFhirProvider("550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...") .build() );
-
-
-
phenomlOnBehalfOf:
Optional<String>Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity. Must be in the format: Patient/{uuid} or Practitioner/{uuid}
-
phenomlFhirProvider:
Optional<String>Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}. Multiple FHIR provider integrations can be provided as comma-separated values.
-
resource:
Lang2FhirAndCreateRequestResourceβ Type of FHIR resource to create. Use 'auto' for automatic resource type detection, or specify a supported US Core profile.
-
text:
Stringβ Natural language text to convert to FHIR resource
-
provider:
Optional<String>β FHIR provider ID - must be a valid UUID from existing FHIR providers. also supports provider by name (e.g. medplum)
-
-
client.tools.createFhirResourcesMulti(request) -> Lang2FhirAndCreateMultiResponse
-
-
-
Extracts multiple FHIR resources from natural language text and stores them in a FHIR server. Automatically detects Patient, Condition, MedicationRequest, Observation, and other resource types. Resources are linked with proper references and submitted as a transaction bundle. For FHIR servers that don't auto-resolve urn:uuid references, this endpoint will automatically resolve them via PUT requests after the initial bundle creation.
-
-
-
client.tools().createFhirResourcesMulti( Lang2FhirAndCreateMultiRequest .builder() .text("John Smith, 45-year-old male, diagnosed with Type 2 Diabetes. Prescribed Metformin 500mg twice daily.") .provider("medplum") .phenomlOnBehalfOf("Patient/550e8400-e29b-41d4-a716-446655440000") .phenomlFhirProvider("550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...") .build() );
-
-
-
phenomlOnBehalfOf:
Optional<String>Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity. Must be in the format: Patient/{uuid} or Practitioner/{uuid}
-
phenomlFhirProvider:
Optional<String>Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}. Multiple FHIR provider integrations can be provided as comma-separated values.
-
text:
Stringβ Natural language text containing multiple clinical concepts to extract
-
version:
Optional<String>β FHIR version to use
-
provider:
Stringβ FHIR provider ID or name
-
-
client.tools.searchFhirResources(request) -> Lang2FhirAndSearchResponse
-
-
-
Converts natural language to FHIR search parameters and executes search in FHIR server
-
-
-
client.tools().searchFhirResources( Lang2FhirAndSearchRequest .builder() .text("Find all appointments for patient John Doe next week") .phenomlOnBehalfOf("Patient/550e8400-e29b-41d4-a716-446655440000") .phenomlFhirProvider("550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...") .build() );
-
-
-
phenomlOnBehalfOf:
Optional<String>Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity. Must be in the format: Patient/{uuid} or Practitioner/{uuid}
-
phenomlFhirProvider:
Optional<String>Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}. Multiple FHIR provider integrations can be provided as comma-separated values.
-
text:
Stringβ Natural language text to convert to FHIR search parameters
-
patientId:
Optional<String>β Patient ID to filter results
-
practitionerId:
Optional<String>β Practitioner ID to filter results
-
count:
Optional<Integer>β Maximum number of results to return
-
provider:
Optional<String>β FHIR provider ID - must be a valid UUID from existing FHIR providers. also supports provider by name (e.g. medplum)
-
-
client.tools.analyzeCohort(request) -> CohortResponse
-
-
-
Uses LLM to extract search concepts from natural language and builds patient cohorts with inclusion/exclusion criteria
-
-
-
client.tools().analyzeCohort( CohortRequest .builder() .text("female patients over 20 with diabetes but not hypertension") .provider("550e8400-e29b-41d4-a716-446655440000") .phenomlOnBehalfOf("Patient/550e8400-e29b-41d4-a716-446655440000") .phenomlFhirProvider("550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...") .build() );
-
-
-
phenomlOnBehalfOf:
Optional<String>Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity. Must be in the format: Patient/{uuid} or Practitioner/{uuid}
-
phenomlFhirProvider:
Optional<String>Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}. Multiple FHIR provider integrations can be provided as comma-separated values.
-
text:
Stringβ Natural language text describing the patient cohort criteria
-
provider:
Stringβ FHIR provider ID - must be a valid UUID from existing FHIR providers. also supports provider by name (e.g. medplum)
-
-
client.tools.mcpServer.create(request) -> McpServerResponse
-
-
-
Creates a new MCP server
-
-
-
client.tools().mcpServer().create( McpServerCreateRequest .builder() .name("My MCP Server") .mcpServerUrl("https://mcp.example.com") .build() );
-
-
-
name:
Stringβ Name of the MCP server
-
mcpServerUrl:
Stringβ URL of the MCP server
-
-
client.tools.mcpServer.list() -> McpServerResponse
-
-
-
Lists all MCP servers for a specific user
-
-
-
client.tools().mcpServer().list();
-
-
client.tools.mcpServer.get(mcpServerId) -> McpServerResponse
-
-
-
Gets a MCP server by ID
-
-
-
client.tools().mcpServer().get("mcp_server_id");
-
-
-
mcpServerId:
Stringβ ID of the MCP server to retrieve
-
-
client.tools.mcpServer.delete(mcpServerId) -> McpServerResponse
-
-
-
Deletes a MCP server by ID
-
-
-
client.tools().mcpServer().delete("mcp_server_id");
-
-
-
mcpServerId:
Stringβ ID of the MCP server to delete
-
-
client.tools.mcpServer.tools.list(mcpServerId) -> McpServerToolResponse
-
-
-
Lists all MCP server tools for a specific MCP server
-
-
-
client.tools().mcpServer().tools().list("mcp_server_id");
-
-
-
mcpServerId:
Stringβ ID of the MCP server to list tools for
-
-
client.tools.mcpServer.tools.get(mcpServerToolId) -> McpServerToolResponse
-
-
-
Gets a MCP server tool by ID
-
-
-
client.tools().mcpServer().tools().get("mcp_server_tool_id");
-
-
-
mcpServerToolId:
Stringβ ID of the MCP server tool to retrieve
-
-
client.tools.mcpServer.tools.delete(mcpServerToolId) -> McpServerToolResponse
-
-
-
Deletes a MCP server tool by ID
-
-
-
client.tools().mcpServer().tools().delete("mcp_server_tool_id");
-
-
-
mcpServerToolId:
Stringβ ID of the MCP server tool to delete
-
-
client.tools.mcpServer.tools.call(mcpServerToolId, request) -> McpServerToolCallResponse
-
-
-
Calls a MCP server tool
-
-
-
client.tools().mcpServer().tools().call( "mcp_server_tool_id", McpServerToolCallRequest .builder() .arguments( new HashMap<String, Object>() {{ put("title", "PhenoML Agent API"); }} ) .build() );
-
-
-
mcpServerToolId:
Stringβ ID of the MCP server tool to call
-
arguments:
Map<String, Object>β Arguments to pass to the MCP server tool
-
-
client.workflows.list() -> ListWorkflowsResponse
-
-
-
Retrieves all workflow definitions for the authenticated user
-
-
-
client.workflows().list( WorkflowsListRequest .builder() .verbose(true) .build() );
-
-
-
verbose:
Optional<Boolean>β If true, includes full workflow implementation details in workflow_details field
-
-
client.workflows.create(request) -> CreateWorkflowResponse
-
-
-
Creates a new workflow definition with graph generation from workflow instructions
-
-
-
client.workflows().create( CreateWorkflowRequest .builder() .name("Patient Data Mapping Workflow") .workflowInstructions("Given diagnosis data, find the patient and create condition record") .sampleData( new HashMap<String, Object>() {{ put("patient_last_name", "Rippin"); put("patient_first_name", "Clay"); put("diagnosis_code", "I10"); }} ) .fhirProviderId( CreateWorkflowRequestFhirProviderId.of("550e8400-e29b-41d4-a716-446655440000") ) .verbose(true) .build() );
-
-
-
verbose:
Optional<Boolean>β If true, includes full workflow implementation details in workflow_details field
-
name:
Stringβ Human-readable name for the workflow
-
workflowInstructions:
Stringβ Natural language instructions that define the workflow logic
-
sampleData:
Map<String, Object>β Sample data to use for workflow graph generation
-
fhirProviderId:
CreateWorkflowRequestFhirProviderIdβ FHIR provider ID(s) - must be valid UUID(s) from existing FHIR providers
-
dynamicGeneration:
Optional<Boolean>β Enable dynamic lang2fhir calls instead of pre-populated templates
-
-
client.workflows.get(id) -> WorkflowsGetResponse
-
-
-
Retrieves a workflow definition by its ID
-
-
-
client.workflows().get( "id", WorkflowsGetRequest .builder() .verbose(true) .build() );
-
-
-
id:
Stringβ ID of the workflow to retrieve
-
verbose:
Optional<Boolean>β If true, includes full workflow implementation details in workflow_details field
-
-
client.workflows.update(id, request) -> WorkflowsUpdateResponse
-
-
-
Updates an existing workflow definition
-
-
-
client.workflows().update( "id", UpdateWorkflowRequest .builder() .name("Updated Patient Data Mapping Workflow") .workflowInstructions("Given diagnosis data, find the patient and create condition record") .sampleData( new HashMap<String, Object>() {{ put("patient_last_name", "Smith"); put("patient_first_name", "John"); put("diagnosis_code", "E11"); }} ) .fhirProviderId( UpdateWorkflowRequestFhirProviderId.of("550e8400-e29b-41d4-a716-446655440000") ) .verbose(true) .build() );
-
-
-
id:
Stringβ ID of the workflow to update
-
verbose:
Optional<Boolean>β If true, includes full workflow implementation details in workflow_details field
-
name:
Stringβ Human-readable name for the workflow
-
workflowInstructions:
Stringβ Natural language instructions that define the workflow logic
-
sampleData:
Map<String, Object>β Sample data to use for workflow graph generation
-
fhirProviderId:
UpdateWorkflowRequestFhirProviderIdβ FHIR provider ID(s) - must be valid UUID(s) from existing FHIR providers
-
dynamicGeneration:
Optional<Boolean>β Enable dynamic lang2fhir calls instead of pre-populated templates
-
-
client.workflows.delete(id) -> WorkflowsDeleteResponse
-
-
-
Deletes a workflow definition by its ID
-
-
-
client.workflows().delete("id");
-
-
-
id:
Stringβ ID of the workflow to delete
-
-
client.workflows.execute(id, request) -> ExecuteWorkflowResponse
-
-
-
Executes a workflow with provided input data and returns results
-
-
-
client.workflows().execute( "id", ExecuteWorkflowRequest .builder() .inputData( new HashMap<String, Object>() {{ put("patient_last_name", "Johnson"); put("patient_first_name", "Mary"); put("diagnosis_code", "M79.3"); put("encounter_date", "2024-01-15"); }} ) .build() );
-
-
-
id:
Stringβ ID of the workflow to execute
-
inputData:
Map<String, Object>β Input data for workflow execution
-
preview:
Optional<Boolean>β If true, create operations return mock resources instead of persisting to the FHIR server
-
-