Medplum · Arazzo Workflow

Medplum Upsert Patient

Version 2.0.0

Update a Patient matched by identifier, or create it, in one FHIR conditional update.

1 workflow 1 source API 1 provider
View Spec View on GitHub HealthcareFHIROpen SourceDeveloper PlatformHIPAASMART on FHIRClinicalInteroperabilityArazzoWorkflows

Provider

medplum

Workflows

upsert-patient
Upsert a Patient keyed on a business identifier with FHIR conditional update.
Sends PUT /fhir/R4/Patient?identifier=|. Medplum updates the matching Patient (200) or creates a new one (201); multiple matches return 412.
1 step inputs: birthDate, familyName, givenName, identifierSystem, identifierValue outputs: patientId
1
upsertPatient
Conditional update of Patient on identifier. The body carries the same identifier so a created Patient matches the criteria next time.

Source API Descriptions

Arazzo Workflow Specification

Raw ↑
arazzo: 1.0.1
info:
  title: Medplum Upsert Patient
  summary: Update a Patient matched by identifier, or create it, in one FHIR conditional update.
  description: >-
    A common master-patient-index pattern, done in a single call. FHIR conditional
    update (PUT /fhir/R4/Patient?identifier=...) updates the one Patient that
    matches the search criteria, or creates it when nothing matches. Medplum's
    OpenAPI declares it as operationId conditionalUpdate on
    PUT /fhir/R4/{resourceType} with a form-exploded `criteria` query parameter:
    200 when a match was updated, 201 when the resource was created, 412 when the
    criteria match more than one resource (nothing is written).
  version: 2.0.0
  x-realizes-capability-ids:
  - BC-2900.60
  x-capability-derivation:
    method: 'deterministic join: sourceDescriptions -> per-tag OpenAPI -> tag/capability edge. No classification at this step.'
    min_confidence: 0.7
    sources:
    - capability_id: BC-2900.60
      capability_name: Healthcare Interoperability Operations
      spec: medplum-fhir-api-openapi.yml
      confidence: 0.7
    model: Turbo EA Capabilities by Vincent Verdet — Turbo EA, https://github.com/vincentmakes/turbo-ea-capabilities, CC BY 4.0
sourceDescriptions:
- name: fhirApi
  url: ../openapi/medplum-fhir-api-openapi.yml
  type: openapi
workflows:
- workflowId: upsert-patient
  summary: Upsert a Patient keyed on a business identifier with FHIR conditional update.
  description: >-
    Sends PUT /fhir/R4/Patient?identifier=<system>|<value>. Medplum updates the
    matching Patient (200) or creates a new one (201); multiple matches return 412.
  inputs:
    type: object
    required:
    - identifierSystem
    - identifierValue
    - familyName
    - givenName
    properties:
      identifierSystem:
        type: string
        description: The identifier system URI (for example an MRN namespace).
      identifierValue:
        type: string
        description: The identifier value within that system.
      familyName:
        type: string
        description: The patient's family (last) name to write.
      givenName:
        type: string
        description: The patient's given (first) name to write.
      birthDate:
        type: string
        description: The patient's date of birth in YYYY-MM-DD form.
  steps:
  - stepId: upsertPatient
    description: >-
      Conditional update of Patient on identifier. The body carries the same
      identifier so a created Patient matches the criteria next time.
    operationId: conditionalUpdate
    parameters:
    - name: resourceType
      in: path
      value: Patient
    - name: criteria
      in: query
      value:
        identifier: '{$inputs.identifierSystem}|{$inputs.identifierValue}'
    requestBody:
      contentType: application/fhir+json
      payload:
        resourceType: Patient
        identifier:
        - system: $inputs.identifierSystem
          value: $inputs.identifierValue
        name:
        - family: $inputs.familyName
          given:
          - $inputs.givenName
        birthDate: $inputs.birthDate
    successCriteria:
    - condition: $statusCode == 200 || $statusCode == 201
    outputs:
      patientId: $response.body#/id
      created: $statusCode == 201
  outputs:
    patientId: $steps.upsertPatient.outputs.patientId

Work with this as data

Every workflow here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for arazzo workflows

4 MCP tools reach this
  • find_arazzoBrowse and filter every workflow in the catalog.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This workflow
curl "https://apis.io/api/v1/arazzo/medplum-upsert-patient-workflow"
All arazzo workflows
curl "https://apis.io/api/v1/arazzo?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.