Current Build
Vocabulary Work Group Maturity Level: 5Normative Compartments: N/A

Normative Candidate Note: This page is candidate normative content for R4 in the Conformance Package. Once normative, it will lose it's Maturity Level, and breaking changes will no longer be made.

The definition of a value set is used to create a simple collection of codes suitable for use for data entry or validation.

If the operation is not called at the instance level, one of the in parameters url, context or valueSet must be provided. An expanded value set will be returned, or an OperationOutcome with an error message.

The official URL for this operation definition is

Formal Definition (as a OperationDefinition).

URL: [base]/ValueSet/$expand

URL: [base]/ValueSet/[id]/$expand

This is an idempotent operation

In Parameters:

A canonical url for a value set. The server must know the value set (e.g. it is defined explicitly in the server's value sets, or it is defined implicitly by some code system known to the server


The value set is provided directly as part of the request. Servers may choose not to accept value sets in this fashion


The identifier that is used to identify a specific version of the value set to be used when generating the expansion. This is an arbitrary value managed by the value set author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available.


The context of the value set, so that the server can resolve this to a value set to expand. The recommended format for this URI is [Structure Definition URL]#[name or path into structure definition] e.g. Other forms may be used but are not defined. This form is only usable if the terminology server also has access to the profile registry that the server is using, but can be used to delegate the mapping from an application context to a binding at run-time


A text filter that is applied to restrict the codes that are returned (this is useful in a UI context). The interpretation of this is delegated to the server in order to allow to determine the most optimal search approach for the context


A reference to an ExpansionProfile that provides additional control information about how the expansion is performed. Known uses for profile include:

  • whether to return the value set content logical definition with the expansion
  • whether to include inactive concepts

The date for which the expansion should be generated. if a date is provided, it means that the server should use the value set / code system definitions as they were on the given date, or return an error if this is not possible. Normally, the date is the current conditions (which is the default value) but under some circumstances, systems need to generate an expansion as it would have been in the past. A typical example of this would be where code selection is constrained to the set of codes that were available when the patient was treated, not when the record is being edited. Note that which date is appropriate is a matter for implementation policy.


Paging support - where to start if a subset is desired (default = 0). Offset is number of records (not number of pages)


Paging support - how many codes should be provided in a partial page view. Paging only applies to flat expansions - servers ignore paging if the expansion is not flat. If count = 0, the client is asking how large the expansion is. Servers SHOULD honor this request for hierarchical expansions as well, and simply return the overall count


Controls whether concept designations are to be included or excluded in value set expansions. Overrides the value in the expansion profile if there is one


Controls whether the value set definition is included or excluded in value set expansions. Overrides the value in the expansion profile if there is one


Controls whether inactive concepts are included or excluded in value set expansions. Overrides the value in the expansion profile if there is one. Note that if the value set explicitly specifies that inactive codes are included, this parameter can still remove them from a specific expansion, but this parameter cannot include them if the value set excludes them


Controls whether or not the value set expansion nests codes or not (i.e. ValueSet.expansion.contains.contains). Overrides the value in the expansion profile if there is one


Controls whether or not the value set expansion includes codes which cannot be displayed in user interfaces. Overrides the value in the expansion profile if there is one


Controls whether or not the value set expansion includes post coordinated codes. Overrides the value in the expansion profile if there is one


Specifies the language to be used for description in the expansions i.e. the language to be used for ValueSet.expansion.contains.display. Overrides the value in the expansion profile if there is one


If the value set being expanded is incomplete (because it is too big to expand), return a limited expansion (a subset) with an indicator that the expansion is incomplete (can use an OperationOutcome plus, if the total number of codes is known). The selection and number of codes that are returned in a limited expansion is at the discretion of the server. This operation parameter overrides the value of ExpansionProfile.limitedExpansion, if there is one.

Out Parameters:

The result of the expansion

Note: as this the only out parameter, it is a resource, and it has the name 'return', the result of this operation is returned directly as a resource

The value set expansion returned by this query should be treated as a transient result that will change over time (whether it does or not depends on how the value set is specified), so applications should repeat the operation each time the value set is used.

If the expansion is too large (at the discretion of the server), the server will return an error (OperationOutcome with code too-costly). Clients can work through large flat expansions in a set of pages (partial views of the full expansion) instead of just getting the full expansion in a single exchange by using offset and count parameters. Servers are not obliged to support paging, but if they do, SHALL support both the offset and count parameters. Hierarchical expansions are not subject to paging and servers simply return the entire expansion.

Different servers may return different results from expanding a value set for the following reasons:

  • The underlying code systems are different (e.g. different versions, possibly with different defined behavior)
  • The server optimizes filter includes differently, such as sorting by code frequency
  • Servers introduce arbitrary groups to assist a user to navigate the lists based either on extensions in the definition, or additional knowledge available to the server

When a server cannot correctly expand a value set because it does not fully understand the code systems (e.g. it has the wrong version, or incomplete definitions) then it SHALL return an error. If the value set itself is unbounded due to the inclusion of post-coordinated value sets (e.g. SNOMED CT, UCUM), then the extension can be used to indicate that the expansion is incomplete

Expanding a value set that is already registered on the server as "23", with a text filter of "abdo" (Request):

GET [base]/ValueSet/23/$expand?filter=abdo

Expanding a value set that is specififed by the client (using JSON) (Request):

POST [base]/ValueSet/23/$expand
[other headers]

  "resourceType" : "Parameters",
  "parameter" : [
     "name" : "valueSet",
     "resource" : {
       "resourceType" : "ValueSet",
     [value set details]


HTTP/1.1 200 OK
[other headers]

<ValueSet xmlns="">
  <!-- the server SHOULD populate the id with a newly created UUID
    so clients can easily track a particular expansion  -->
  <id value="43770626-f685-4ba8-8d66-fb63e674c467"/>
  <!-- no need for meta, though it is allowed for security labels, profiles -->

  <!-- other value set details -->
    <!-- when expanded -->
    <timestamp value="20141203T08:50:00+11:00"/>
    <!-- expansion contents -->


For more information about operations, including how they are invoked, see Operations.