# Subscription

Canonical page: https://docs.ovok.com/api/fhir/r4/subscription

The subscription resource is used to define a push-based subscription from a server to another system. Once a subscription is registered with the server, the server checks every resource that is created or updated, and if the resource matches the given criteria, it sends a message on the defined "channel" so that another system can take an appropriate action.

These interaction paths describe standard FHIR R4 patterns. Availability can depend on the API capabilities enabled for your Ovok project.

| **Interaction** | **Method** | **Path** |
| --- | --- | --- |
| Read | `GET` | `/fhir/R4/Subscription/[id]` |
| Vread | `GET` | `/fhir/R4/Subscription/[id]/_history/[vid]` |
| Update | `PUT` | `/fhir/R4/Subscription/[id]` |
| Patch | `PATCH` | `/fhir/R4/Subscription/[id]` |
| Delete | `DELETE` | `/fhir/R4/Subscription/[id]` |
| Create | `POST` | `/fhir/R4/Subscription` |
| Search | `GET` | `/fhir/R4/Subscription` |
| History | `GET` | `/fhir/R4/Subscription/[id]/_history` |

## Top-level elements [#top-level-elements]

| **Element** | **Type** | **Cardinality** | **Description** |
| --- | --- | --- | --- |
| <span id="element-id"></span>`id` | [string](/fhir-elements/primitive/string) | `0..1` | Logical id of this artifact |
| <span id="element-meta"></span>`meta` | [Meta](/fhir-elements/complex/meta) | `0..1` | Metadata about the resource |
| <span id="element-implicit-rules"></span>`implicitRules` | [uri](/fhir-elements/primitive/uri) | `0..1` | A set of rules under which this content was created |
| <span id="element-language"></span>`language` | [code](/fhir-elements/primitive/code) | `0..1` | Language of the resource content |
| <span id="element-text"></span>`text` | [Narrative](/fhir-elements/complex/narrative) | `0..1` | Text summary of the resource, for human interpretation |
| <span id="element-contained"></span>`contained` | [Resource](/fhir-elements/foundation/resource) | `0..*` | Contained, inline Resources |
| <span id="element-extension"></span>`extension` | [Extension](/fhir-elements/complex/extension) | `0..*` | Additional content defined by implementations |
| <span id="element-modifier-extension"></span>`modifierExtension` | [Extension](/fhir-elements/complex/extension) | `0..*` | Extensions that cannot be ignored |
| <span id="element-status"></span>`status` | [code](/fhir-elements/primitive/code) | `1..1` | requested \| active \| error \| off |
| <span id="element-contact"></span>`contact` | [ContactPoint](/fhir-elements/complex/contact-point) | `0..*` | Contact details for source (e.g. troubleshooting) |
| <span id="element-end"></span>`end` | [instant](/fhir-elements/primitive/instant) | `0..1` | When to automatically delete the subscription |
| <span id="element-reason"></span>`reason` | [string](/fhir-elements/primitive/string) | `1..1` | Description of why this subscription was created |
| <span id="element-criteria"></span>`criteria` | [string](/fhir-elements/primitive/string) | `1..1` | Rule for server push |
| <span id="element-error"></span>`error` | [string](/fhir-elements/primitive/string) | `0..1` | Latest error note |
| <span id="element-channel"></span>`channel` | [BackboneElement](/fhir-elements/complex/backbone-element) | `1..1` | The channel on which to report matches to the criteria |

## Resource-specific search parameters [#resource-specific-search-parameters]

| **Parameter** | **Type** | **Description** |
| --- | --- | --- |
| `contact` | token | Contact details for the subscription |
| `criteria` | string | The search rules used to determine when to send a notification |
| `payload` | token | The mime-type of the notification payload |
| `status` | token | The current state of the subscription |
| `type` | token | The type of channel for the sent notifications |
| `url` | uri | The uri that will receive the notifications |

## Reference [#reference]

Official FHIR R4 spec: [Subscription](https://hl7.org/fhir/R4/subscription.html).  
Maturity: Trial Use 3 (FMM 3).
