swagger: '2.0' info: version: v7.78.1 title: Fitbit Plus API x-logo: url: 'http://developer.twinehealth.com/images/Fitbit_Plus_lockup_2C_RGB-32.png' contact: email: apiteam@twinehealth.com description: | # Overview The Fitbit Plus API is a RESTful API. The requests and responses are formated according to the [JSON API](http://jsonapi.org/format/1.0/) specification. In addition to this documentation, we also provide an [OpenAPI](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md) "yaml" file describing the API: [Fitbit Plus API Specification](swagger.yaml). # Authentication Authentication for the Fitbit Plus API is based on the [OAuth 2.0 Authorization Framework](https://tools.ietf.org/html/rfc6749). Fitbit Plus currently supports grant types of **client_credentials** and **refresh_token**. See [POST /oauth/token](#operation/createToken) for details on the request and response formats. ## Building Integrations We will provide customers with unique client credentials for each application/integration they build, allowing us to enforce appropriate access controls and monitor API usage. The client credentials will be scoped to the organization, and allow full access to all patients and related data within that organization. These credentials are appropriate for creating an integration that does one of the following: - background reporting/analysis - synchronizing data with another system (such as an EMR) The API credentials and oauth flows we currently support are **not** well suited for creating a user-facing application that allows a user (patient, coach, or admin) to login and have access to data which is appropriate to that specific user. It is possible to build such an application, but it is not possible to use Fitbit Plus as a federated identity provider. You would need to have a separate means of verifying a user's identity. We do not currently support the required password-based oauth flow to make this possible. # Paging The Fitbit Plus API supports two different pagination strategies for GET collection endpoints. #### Skip-based paging Skip-based paging uses the query parameters `page[size]` and `page[number]` to specify the max number of resources returned and the page number. We default to skip-based paging if there are no page parameters. The response will include a `links` object containing links to the first, last, prev, and next pages of data. If the contents of the collection change while you are iterating through the collection, you will see duplicate or missing documents. For example, if you are iterating through the `calender_event` resource via `GET /pub/calendar_event?sort=start_at&page[size]=50&page[number]=1`, and a new `calendar_event` is created that has a `start_at` value before the first `calendar_event`, when you fetch the next page at `GET /pub/calendar_event?sort=start_at&page[size]=50&page[number]=2`, the first entry in the second response will be a duplicate of the last entry in the first response. #### Cursor-based paging Cursor-based paging uses the query parameters `page[limit]` and `page[after]` to specify the max number of entries returned and identify where to begin the next page. Add `page[limit]` to the parameters to use cursor-based paging. The response will include a `links` object containing a link to the next page of data, if the next page exists. Cursor-based paging is not subject to duplication if new resources are added to the collection. For example, if you are iterating through the `calender_event` resource via `GET /pub/calendar_event?sort=start_at&page[limit]=50`, and a new `calendar_event` is created that has a `start_at` value before the first `calendar_event`, you will not see a duplicate entry when you fetch the next page at `GET /pub/calendar_event?sort=start_at&page[limit]=50&page[after]=`. We encourage the use of cursor-based paging for performance reasons. In either form of paging, you can determine whether any resources were missed by comparing the number of fetched resources against `meta.count`. Set `page[size]` or `page[limit]` to 0 to get only the count. It is not valid to mix the two strategies. host: api.twinehealth.com basePath: /pub schemes: - https consumes: - application/vnd.api+json produces: - application/vnd.api+json securityDefinitions: OAuth2: type: oauth2 description: | Fitbit Plus allows customers to access data for their organization using client credentials. OAuth2 is a safe and secure way to give you access. flow: application tokenUrl: '/oauth/token' scopes: 'group': access patients and data within a group 'organization': access patients and data within an organization tags: - name: oauth description: Authentication operations - name: organization description: An organization is a Fitbit Plus customer. No data is accessible across organizations. - name: group description: A group is a cohort of patients within an organization. The creation of groups allows for the segmentation of dashboards and analytics. For example, a group might correspond to the patients in a particular practice or the employees of a particular employer. - name: coach description: A coach is a person that supports a patient - name: reward program description: A reward program provides the details for a rewards program for a group. Different rewards programs can be created for different periods of time specified by the start_at and end_at dates. A reward program can activated for a patient any time between these dates. An activated reward program for a patient is called a reward program activation. - name: action description: An action is an actionable item in a patient's plan. - name: bundle description: A bundle is a collection of actions (an action plan) in a patient's plan summary. - name: calendar event description: A calendar event represents an event involving or relevant to a patient which will or has occurred on a specific date or during a specific period of time. - name: calendar event response description: A calendar event response indicates the attendee's response to a calendar event. Only `POST` for creation is allowed as the responses are updated into the corresponding calendar events. - name: email history description: Email history represents a single email that was sent using Fitbit Plus. - name: health profile description: A health profile contains a set of health questions and answers for a patient. - name: health profile answer description: A health profile answer is the answer to a question for a patient. - name: health profile question description: A health profile question contains a health question and the corresponding answer for a patient. - name: health question definition description: A health question definition specifies a health question and the corresponding answer choices. - name: metric description: A metric is a quantitative result for a patient. For example, vital signs, lab results, etc. are all metrics. - name: patient description: A patient is the core user of Fitbit Plus. - name: plan description: A plan is the set of actions and associated goals for a patient. - name: result description: A patient health result is a quantitative result for a patient. - name: reward description: A reward allocates a portion of the budget from the reward program activation for achieving a particular goal and sets a target date. - name: reward earning description: A reward earning specifies the portion of a reward that was earned and at what date. - name: reward earning fulfillment description: A reward earning fulfillment specifies the portion of a reward earning that was fulfilled and at what date. - name: reward program activation description: A reward program activation is the activation of a reward program for a specific patient. x-tagGroups: - name: Authentication (oauth) tags: - oauth - name: Admin tags: - organization - group - coach - reward program - name: Patient Data tags: - action - bundle - calendar event - calendar event response - email history - health profile - health profile answer - health profile question - health question definition - metric - patient - plan - result - reward - reward earning - reward earning fulfillment - reward program activation paths: /oauth/token: post: tags: - oauth summary: Create an oauth token description: | Create an OAuth 2.0 Bearer token. A valid bearer token is required for all other API requests. Be sure to set the header `Content-Type: "application/vnd.api+json"`. Otherwise, you will get an error 403 Forbidden. Using `Content-Type: "application/json"` is permitted (to support older oauth clients) but when using `application/json` the body should have a body in the following format instead of nesting under `data.attributes`: ``` { "grant_type": "client_credentials", "client_id": "95c78ab2-167f-40b8-8bec-8398d4b87454", "client_secret": "35d18dc9-a3dd-4948-b787-063a490b9354" } ``` operationId: createToken consumes: - application/vnd.api+json - application/json parameters: - name: include description: List of related resources to include in the response in: query required: false type: string enum: - groups - organization - name: body in: body required: true schema: $ref: '#/definitions/CreateTokenRequest' responses: '201': description: Created schema: $ref: '#/definitions/CreateTokenResponse' '401': description: Unauthorized schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '409': description: Invalid Request schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' security: - OAuth2: - 'group' - 'organization' /oauth/token/{id}/groups: get: tags: - oauth summary: Get the groups for a token description: Get the list of groups a token can be used to access. operationId: fetchTokenGroups parameters: - name: id in: path description: Token identifier required: true type: string responses: '200': description: OK schema: $ref: '#/definitions/FetchGroupsResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' security: - OAuth2: - 'group' - 'organization' /oauth/token/{id}/organization: get: tags: - oauth summary: Get the organization for a token description: Get the organization a token can be used to access. operationId: fetchTokenOrganization parameters: - name: id in: path description: Token identifier required: true type: string responses: '200': description: OK schema: $ref: '#/definitions/FetchOrganizationResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' /organization/{id}: get: tags: - organization summary: Get an organization description: Get an organization record by id. operationId: fetchOrganization parameters: - name: id in: path description: Organization identifier required: true type: string responses: '200': description: OK schema: $ref: '#/definitions/FetchOrganizationResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' /group: post: tags: - group summary: Create a group description: Create a group record. operationId: createGroup parameters: - name: body in: body required: true schema: $ref: '#/definitions/CreateGroupRequest' responses: '201': description: Created schema: $ref: '#/definitions/CreateGroupResponse' '401': description: Unauthorized schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '409': description: Invalid Request schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' get: tags: - group summary: List groups description: Get a list of groups matching the specified filters. operationId: fetchGroups parameters: - name: filter[organization] in: query description: Organization identifier required: true type: string - name: filter[name] in: query description: Group name required: false type: string responses: '200': description: OK schema: $ref: '#/definitions/FetchGroupsResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' /group/{id}: get: tags: - group summary: Get a group description: Get a group record by id. operationId: fetchGroup parameters: - name: id in: path description: Group identifier required: true type: string responses: '200': description: OK schema: $ref: '#/definitions/FetchGroupResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' /coach: get: tags: - coach summary: List coaches description: Get a list of coaches matching the specified filters. operationId: fetchCoaches parameters: - name: filter[groups] in: query type: string description: | Comma-separated list of group ids. Note that one of the following filters must be specified: `filter[groups]`, `filter[organization]`. - name: filter[organization] in: query type: string description: | Fitbit Plus organization id. Note that one of the following filters must be specified: `filter[groups]`, `filter[organization]`. responses: '200': description: OK schema: $ref: '#/definitions/FetchCoachesResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' /coach/{id}: get: tags: - coach summary: Get a coach description: Get a coach record by id. operationId: fetchCoach parameters: - name: id in: path description: Coach identifier required: true type: string responses: '200': description: OK schema: $ref: '#/definitions/FetchCoachResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' /reward_program: post: tags: - reward program summary: Create a reward program description: Create a reward program for a group. operationId: createRewardProgram parameters: - name: body in: body required: true schema: $ref: '#/definitions/CreateRewardProgramRequest' responses: '200': description: OK schema: $ref: '#/definitions/CreateRewardProgramResponse' '401': description: Unauthorized schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '409': description: Invalid Request schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' get: tags: - reward program summary: List reward programs description: Get a list of reward programs matching the specified filters. operationId: fetchRewardPrograms parameters: - name: filter[groups] in: query description: | Comma-separated list of group identifiers. Note that one of the following filters must be specified: `filter[groups]`, `filter[organization]`. type: string - name: filter[organization] in: query type: string description: | Fitbit Plus organization id. Note that one of the following filters must be specified: `filter[groups]`, `filter[organization]`. responses: '200': description: OK schema: $ref: '#/definitions/FetchRewardProgramsResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' /reward_program/{id}: get: tags: - reward program summary: Get a reward program description: Get a reward program record by id. operationId: fetchRewardProgram parameters: - name: id in: path description: Reward program identifier required: true type: string responses: '200': description: OK schema: $ref: '#/definitions/FetchRewardProgramResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' /reward_program/{id}/group: get: tags: - reward program summary: Get group for a reward program description: Get the group related to a reward program. operationId: fetchRewardProgramGroup parameters: - name: id in: path description: Reward program identifier required: true type: string responses: '200': description: OK schema: $ref: '#/definitions/FetchGroupsResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' /action: post: tags: - action summary: Create action description: Create a plan action operationId: createAction parameters: - name: body in: body required: true schema: $ref: '#/definitions/CreateActionRequest' responses: '201': description: OK schema: $ref: '#/definitions/CreateActionResponse' '401': description: Unauthorized schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '409': description: Invalid Request schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' /action/{id}: get: tags: - action summary: Get an action description: Get a health action from a patient's plan. operationId: fetchAction parameters: - name: id in: path description: Action identifier required: true type: string responses: '200': description: OK schema: $ref: '#/definitions/FetchActionResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' patch: tags: - action summary: Update an action description: Update a health action from a patient's plan. operationId: updateAction parameters: - name: id in: path description: Action identifier required: true type: string - name: body in: body required: true schema: $ref: '#/definitions/UpdateActionRequest' responses: '200': description: OK schema: $ref: '#/definitions/UpdateActionResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' '409': description: Invalid Request schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' /bundle: post: tags: - bundle summary: Create bundle description: Create a bundle in a patient's plan operationId: createBundle parameters: - name: body in: body required: true schema: $ref: '#/definitions/CreateBundleRequest' responses: '200': description: OK schema: $ref: '#/definitions/CreateBundleResponse' '401': description: Unauthorized schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '409': description: Invalid Request schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' /bundle/{id}: get: tags: - bundle summary: Get a bundle description: Get a bundle from a patient's plan. operationId: fetchBundle parameters: - name: id in: path description: Bundle identifier required: true type: string responses: '200': description: OK schema: $ref: '#/definitions/FetchBundleResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' patch: tags: - bundle summary: Update a bundle description: Updte a bundle from a patient's plan. operationId: updateBundle parameters: - name: id in: path description: Bundle identifier required: true type: string - name: body in: body required: true schema: $ref: '#/definitions/UpdateBundleRequest' responses: '200': description: OK schema: $ref: '#/definitions/UpdateBundleResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' '409': description: Invalid Request schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' /calendar_event: post: tags: - calendar event summary: Create calendar event description: Create a calendar event for a patient. Attribute `all_day` must be set to `true` and `end_at` cannot be set for `plan-check-in` event type. operationId: createCalendarEvent parameters: - name: body in: body required: true schema: $ref: '#/definitions/CreateCalendarEventRequest' responses: '201': description: OK schema: $ref: '#/definitions/CreateCalendarEventResponse' '401': description: Unauthorized schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '409': description: Invalid Request schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' get: tags: - calendar event summary: List calendar events description: Get a list of calendar events operationId: fetchCalendarEvents parameters: - name: filter[patient] in: query type: string description: | Patient id to fetch calendar event. Note that one of the following filters must be specified: `filter[patient]`, `filter[group]`, `filter[organization]`, or `filter[attendees]`. - name: filter[groups] in: query type: string description: | Comma-separated list of group ids. Note that one of the following filters must be specified: `filter[patient]`, `filter[group]`, `filter[organization]`, or `filter[attendees]`. - name: filter[organization] in: query type: string description: | Fitbit Plus organization id. Note that one of the following filters must be specified: `filter[patient]`, `filter[group]`, `filter[organization]`, or `filter[attendees]`. - name: filter[attendees] in: query type: string description: | Comma-separated list of coach or patient ids. Note that one of the following filters must be specified: `filter[patient]`, `filter[group]`, `filter[organization]`, or `filter[attendees]`. - name: filter[type] in: query type: string description: Calendar event type enum: - plan-check-in - reminder - telephone-call - office-visit - video-call - name: filter[completed] in: query type: boolean description: If not specified, return all calendar events. If set to `true` return only events marked as completed, if set to `false`, return only events not marked as completed yet. - name: filter[start_at] in: query type: string description: | The start (inclusive) and end (exclusive) dates are ISO date and time strings separated by `..`. Example for events starting in November 2017 (America/New_York): `filter[start_at]=2017-11-01T00:00:00-04:00..2017-12-01T00:00:00-05:00` - name: filter[end_at] in: query type: string description: | The start (inclusive) and end (exclusive) dates are ISO date and time strings separated by `..`. Example for events ending in November 2017 (America/New_York): `filter[end_at]=2017-11-01T00:00:00-04:00..2017-12-01T00:00:00-05:00` - name: filter[completed_at] in: query type: string description: | The start (inclusive) and end (exclusive) dates are ISO date and time strings separated by `..`. Example for events completed in November 2017 (America/New_York): `filter[completed_at]=2017-11-01T00:00:00-04:00..2017-12-01T00:00:00-05:00` - name: filter[created_at] in: query type: string description: | The start (inclusive) and end (exclusive) dates are ISO date and time strings separated by `..`. Example for events created in November 2017 (America/New_York): `filter[created_at]=2017-11-01T00:00:00-04:00..2017-12-01T00:00:00-05:00` - name: filter[updated_at] in: query type: string description: | The start (inclusive) and end (exclusive) dates are ISO date and time strings separated by `..`. Example for events updated in November 2017 (America/New_York): `filter[updated_at]=2017-11-01T00:00:00-04:00..2017-12-01T00:00:00-05:00` - name: page[number] in: query description: Page number required: false type: integer default: 1 - name: page[size] in: query description: Page size required: false type: integer default: 10 minimum: 0 maximum: 50 - name: page[limit] in: query description: Page limit type: integer required: false default: 50 minimum: 0 - name: page[cursor] in: query description: Page cursor type: string required: false - name: include description: List of related resources to include in the response in: query required: false type: string enum: - owner responses: '200': description: OK schema: $ref: '#/definitions/FetchCalendarEventsResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' '409': description: Invalid Request schema: $ref: '#/definitions/FetchErrorResponse' /calendar_event/{id}: get: tags: - calendar event summary: Get a calendar event description: Get a calendar event by id operationId: fetchCalendarEvent parameters: - name: id in: path description: Calendar event identifier required: true type: string responses: '200': description: OK schema: $ref: '#/definitions/FetchCalendarEventResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' patch: tags: - calendar event summary: Update a calendar event description: Update a calendar event for a patient. Attribute `all_day` must be true and `end_at` cannot be specified for `plan-check-in` event type. To mark a calendar event as 'completed', set `completed_at` and `completed_by` to desired values. To mark a completed calendar event as 'not completed', set `completed_at` and `completed_by` to `null`. Attendees can be added or removed, but response status cannot be updated. Use the calendar event response api for response status updates instead. operationId: updateCalendarEvent parameters: - name: id in: path description: Calendar event identifier required: true type: string - name: body in: body required: true schema: $ref: '#/definitions/UpdateCalendarEventRequest' responses: '200': description: OK schema: $ref: '#/definitions/UpdateCalendarEventResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' '409': description: Invalid Request schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' delete: tags: - calendar event summary: Delete a calendar event description: Delete a calendar event by id operationId: deleteCalendarEvent parameters: - name: id in: path description: Calendar event identifier required: true type: string responses: '200': description: OK '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' /calendar_event_response: post: tags: - calendar event response summary: Create calendar event response description: Create a calendar event response for an attendee of a calendar event, the attendee can be a coach or patient. Calendar event responses cannot be fetched, updated nor deleted. Use calendar event api to fetch the response status for attendees. operationId: createCalendarEventResponse parameters: - name: body in: body required: true schema: $ref: '#/definitions/CreateCalendarEventResponseRequest' responses: '201': description: OK schema: $ref: '#/definitions/CreateCalendarEventResponseRequest' '401': description: Unauthorized schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '409': description: Invalid Request schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' /email_history: get: tags: - email history summary: List email histories description: Get a list of email histories operationId: fetchEmailHistories parameters: - name: filter[receiver] in: query type: string description: Fitbit Plus user id of email recipient. Required if filter[sender] is not defined. - name: filter[sender] in: query type: string description: Fitbit Plus user id of email sender. Required if filter[receiver] is not defined. - name: filter[emailType] in: query type: string description: Type of email - name: sort in: query description: > valid sorts: * send_time - ascending by send_time * -send_time - descending by send_time type: string enum: - send_time - -send_time responses: '200': description: OK schema: $ref: '#/definitions/FetchEmailHistoriesResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' '409': description: Invalid Request schema: $ref: '#/definitions/FetchErrorResponse' /email_history/{id}: get: tags: - email history summary: Get an email history description: Get an email history by id operationId: fetchEmailHistory parameters: - name: id in: path description: Email history identifier required: true type: string responses: '200': description: OK schema: $ref: '#/definitions/FetchEmailHistoryResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' /health_profile: get: tags: - health profile summary: List health profiles description: Get a list of health profiles operationId: fetchHealthProfiles parameters: - name: filter[patient] in: query type: string description: | Patient id to fetch health profile. Note that one of the following filters must be specified: `filter[patient]`, `filter[group]`, or `filter[organization]`. - name: filter[groups] in: query type: string description: | Comma-separated list of group ids. Note that one of the following filters must be specified: `filter[patient]`, `filter[group]`, or `filter[organization]`. - name: filter[organization] in: query type: string description: | Fitbit Plus organization id. Note that one of the following filters must be specified: `filter[patient]`, `filter[group]`, or `filter[organization]`. - name: page[number] in: query description: Page number required: false type: integer default: 1 - name: page[size] in: query description: Page size required: false type: integer default: 10 minimum: 0 maximum: 50 - name: page[limit] in: query description: Page limit type: integer required: false default: 50 minimum: 0 - name: page[cursor] in: query description: Page cursor type: string required: false - name: include description: List of related resources to include in the response in: query required: false type: string enum: - patient - questions responses: '200': description: OK schema: $ref: '#/definitions/FetchHealthProfilesResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' '409': description: Invalid Request schema: $ref: '#/definitions/FetchErrorResponse' /health_profile/{id}: get: tags: - health profile summary: Get a health profile description: Get a health profile by id operationId: fetchHealthProfile parameters: - name: id in: path description: Health profile identifier required: true type: string - name: include description: List of related resources to include in the response in: query required: false type: string enum: - patient - questions responses: '200': description: OK schema: $ref: '#/definitions/FetchHealthProfileResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' /health_profile_question: get: tags: - health profile question summary: List health profile questions description: Get a list of health profile questions operationId: fetchHealthProfileQuestions parameters: - name: filter[patient] in: query type: string description: | Patient id to fetch healt profile questions. Note that one of the following filters must be specified: `filter[patient]`, `filter[group]`, or `filter[organization]`. - name: filter[groups] in: query type: string description: | Comma-separated list of group ids. Note that one of the following filters must be specified: `filter[patient]`, `filter[group]`, or `filter[organization]`. - name: filter[organization] in: query type: string description: | Fitbit Plus organization id. Note that one of the following filters must be specified: `filter[patient]`, `filter[group]`, or `filter[organization]`. - name: include description: List of related resources to include in the response in: query required: false type: string enum: - question_definition - answer responses: '200': description: OK schema: $ref: '#/definitions/FetchHealthProfileQuestionsResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' '409': description: Invalid Request schema: $ref: '#/definitions/FetchErrorResponse' /health_profile_question/{id}: get: tags: - health profile question summary: Get a health profile question description: Get a health profile by id operationId: fetchHealthProfileQuestion parameters: - name: id in: path description: Health profile question identifier required: true type: string - name: include description: List of related resources to include in the response in: query required: false type: string enum: - question_definition - answer responses: '200': description: OK schema: $ref: '#/definitions/FetchHealthProfileQuestionResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' /health_profile_answer: get: tags: - health profile answer summary: List health profile answers description: Get a list of health profile answers operationId: fetchHealthProfileAnswers parameters: - name: filter[patient] in: query type: string description: | Patient id to fetch healt profile answers. Note that one of the following filters must be specified: `filter[patient]`, `filter[group]`, or `filter[organization]`. - name: filter[groups] in: query type: string description: | Comma-separated list of group ids. Note that one of the following filters must be specified: `filter[patient]`, `filter[group]`, or `filter[organization]`. - name: filter[organization] in: query type: string description: | Fitbit Plus organization id. Note that one of the following filters must be specified: `filter[patient]`, `filter[group]`, or `filter[organization]`. - name: page[number] in: query description: Page number required: false type: integer default: 1 - name: page[size] in: query description: Page size required: false type: integer default: 50 minimum: 0 maximum: 100 - name: page[limit] in: query description: Page limit type: integer required: false default: 50 minimum: 0 - name: page[cursor] in: query description: Page cursor type: string required: false - name: include description: List of related resources to include in the response in: query required: false type: string enum: - patient responses: '200': description: OK schema: $ref: '#/definitions/FetchHealthProfileAnswersResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' '409': description: Invalid Request schema: $ref: '#/definitions/FetchErrorResponse' /health_profile_answer/{id}: get: tags: - health profile answer summary: Get a health profile answer description: Get a health profile answer by id operationId: fetchHealthProfileAnswer parameters: - name: id in: path description: Health profile answer identifier required: true type: string - name: include description: List of related resources to include in the response in: query required: false type: string enum: - patient responses: '200': description: OK schema: $ref: '#/definitions/FetchHealthProfileAnswerResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' /health_question_definition: get: tags: - health question definition summary: List health question definitions description: Get a list of all health question definitions operationId: fetchHealthQuestionDefinitions responses: '200': description: OK schema: $ref: '#/definitions/FetchHealthQuestionDefinitionsResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' '409': description: Invalid Request schema: $ref: '#/definitions/FetchErrorResponse' /health_question_definition/{id}: get: tags: - health question definition summary: Get a health question definition description: Get a health question definition by id operationId: fetchHealthQuestionDefinition parameters: - name: id in: path description: Health question definition identifier required: true type: string responses: '200': description: OK schema: $ref: '#/definitions/FetchHealthQuestionDefinitionResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' /patient_health_metric: post: tags: - metric summary: Create patient health metrics description: | Create one or more patient health metrics. Example for creating a patient health result with a patient specified using `meta.query` instead of `id`: ```JSON { "data": { "type": "patient_health_metric", "attributes": { "code": { "system": "LOINC", "value": "13457-7" }, "type": "ldl_cholesterol", "occurred_at": "2017-03-14T11:00:57.000Z", "value": 121, "unit": "mg/dl" }, "relationships": { "patient": { "data": { "type": "patient", "meta": { "query": { "identifier": { "system": "medical-record-number", "value": "121212" }, "organization": "58c4554710123c5c40dbab81" } } } } } } } ``` operationId: createPatientHealthMetric parameters: - name: body in: body required: true schema: $ref: '#/definitions/CreatePatientHealthMetricRequest' responses: '200': description: OK schema: $ref: '#/definitions/CreatePatientHealthMetricResponse' '401': description: Unauthorized schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '409': description: Invalid Request schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' get: tags: - metric summary: List patient health metrics description: Get a list of patient health metrics. operationId: fetchPatientHealthMetrics parameters: - name: filter[patient] in: query description: | Filter the patient health metrics for a specified patient. Note that one of the following filters must be specified: `filter[patient]`, `filter[groups]`, `filter[organization]`. type: string - name: filter[groups] in: query type: string description: | Comma-separated list of group ids. Note that one of the following filters must be specified: `filter[patient]`, `filter[groups]`, `filter[organization]`. - name: filter[organization] in: query type: string description: | Fitbit Plus organization id. Note that one of the following filters must be specified: `filter[patient]`, `filter[groups]`, `filter[organization]`. - name: page[number] in: query description: Page number required: false type: integer default: 1 - name: page[size] in: query description: Page size required: false type: integer default: 10 minimum: 0 maximum: 50 - name: page[limit] in: query description: Page limit type: integer required: false default: 50 minimum: 0 - name: page[cursor] in: query description: Page cursor type: string required: false responses: '200': description: OK schema: $ref: '#/definitions/FetchPatientHealthMetricResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' '409': description: Invalid Request schema: $ref: '#/definitions/FetchErrorResponse' /patient_health_metric/{id}: get: tags: - metric summary: Get a patient health metric description: Get the plan summary for a patient. operationId: fetchPatientHealthMetric parameters: - name: id in: path description: Patient health metric identifier required: true type: string responses: '200': description: OK schema: $ref: '#/definitions/FetchPatientHealthMetricResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' /patient: post: tags: - patient summary: Create a patient description: | Create a patient record. Example for creating a patient with a group specified using `meta.query` instead of `id`: ```JSON { "data": { "type": "patient", "attributes": { "first_name": "Andrew", "last_name": "Smith" }, "relationships": { "groups": { "data": [ { "type": "group", "meta": { "query": { "organization": "58c88de7c93eb96357a87033", "name": "Patients Lead" } } } ] } } } } ``` operationId: createPatient parameters: - name: body in: body required: true schema: $ref: '#/definitions/CreatePatientRequest' responses: '201': description: Created schema: $ref: '#/definitions/CreatePatientResponse' '401': description: Unauthorized schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '409': description: Invalid Request schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' get: tags: - patient summary: List patients description: Get a list of patients. operationId: fetchPatients parameters: - name: filter[groups] in: query type: string description: Comma-separated list of group ids. Note that either `filter[group]` or `filter[organization]` must be specified. - name: filter[organization] in: query type: string description: Fitbit Plus organization id. Note that either `filter[group]` or `filter[organization]` must be specified. - name: filter[identifier][system] in: query type: string description: "Identifier system (example: \"MyEHR\") - requires a \"filter[identifier][value]\" parameter" - name: filter[identifier][value] in: query type: string description: "Identifier value (example: \"12345\") - requires a \"filter[identifier][system]\" parameter" - name: filter[archived] in: query type: boolean description: If not specified, return all patients. If set to 'true' return only archived patients, if set to 'false', return only patients who are not archived. - name: filter[created_at] in: query type: string description: | The start (inclusive) and end (exclusive) dates are ISO date and time strings separated by `..`. Example for patients created in November 2017 (America/New_York): `filter[created_at]=2017-11-01T00:00:00-04:00..2017-12-01T00:00:00-05:00` - name: filter[updated_at] in: query type: string description: | The start (inclusive) and end (exclusive) dates are ISO date and time strings separated by `..`. Example for patients updated in November 2017 (America/New_York): `filter[updated_at]=2017-11-01T00:00:00-04:00..2017-12-01T00:00:00-05:00` - name: page[number] in: query description: Page number required: false type: integer default: 1 - name: page[size] in: query description: Page size required: false type: integer default: 10 minimum: 0 maximum: 50 - name: page[limit] in: query description: Page limit type: integer required: false default: 50 minimum: 0 - name: page[cursor] in: query description: Page cursor type: string required: false responses: '200': description: OK schema: $ref: '#/definitions/FetchPatientsResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' '409': description: Invalid Request schema: $ref: '#/definitions/FetchErrorResponse' put: tags: - patient summary: Upsert patient description: Create a new patient or update an existing patient operationId: upsertPatient parameters: - name: body in: body required: true schema: $ref: '#/definitions/UpsertPatientRequest' responses: '200': description: OK schema: $ref: '#/definitions/CreatePatientResponse' '401': description: Unauthorized schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '409': description: Invalid Request schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' /patient/{id}: get: tags: - patient summary: Get a patient description: Gets a patient record by id. operationId: fetchPatient parameters: - name: id in: path description: Patient identifier required: true type: string responses: '200': description: OK schema: $ref: '#/definitions/FetchPatientResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' patch: tags: - patient summary: Update a patient description: Update a patient record. operationId: updatePatient parameters: - name: id in: path description: Patient identifier required: true type: string - name: body in: body required: true schema: $ref: '#/definitions/UpdatePatientRequest' responses: '200': description: OK schema: $ref: '#/definitions/UpdatePatientResponse' '401': description: Unauthorized schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '409': description: Invalid Request schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' /patient/{id}/groups: get: tags: - patient summary: List groups for a patient description: Get the list of groups for a patient. operationId: fetchPatientGroups parameters: - name: id in: path description: Patient identifier required: true type: string responses: '200': description: OK schema: $ref: '#/definitions/FetchGroupsResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' /patient/{id}/coaches: get: tags: - patient summary: List coaches for a patient description: Get the list of coaches for a patient. operationId: fetchPatientCoaches parameters: - name: id in: path description: Patient identifier required: true type: string responses: '200': description: OK schema: $ref: '#/definitions/FetchCoachesResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' /patient_plan_summary: get: tags: - plan summary: List patient plan summaries description: Get a list of patient plan summaries operationId: fetchPatientPlanSummaries parameters: - name: filter[patient] in: query type: string description: | Patient id to fetch plan summary for. Note that one of the following filters must be specified: `filter[patient]`, `filter[groups]`, `filter[organization]`. - name: filter[groups] in: query type: string description: | Comma-separated list of group ids. Note that one of the following filters must be specified: `filter[patient]`, `filter[groups]`, `filter[organization]`. - name: filter[organization] in: query type: string description: | Fitbit Plus organization id. Note that one of the following filters must be specified: `filter[patient]`, `filter[groups]`, `filter[organization]`. - name: include description: List of related resources to include in the response in: query required: false type: string enum: - actions - bundles - patient - current_results responses: '200': description: OK schema: $ref: '#/definitions/FetchPatientPlanSummariesResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' /patient_plan_summary/{id}: get: tags: - plan summary: Get the plan summary for a patient description: Get the plan summary for a patient. operationId: fetchPatientPlanSummary parameters: - name: id in: path description: Plan summary identifier required: true type: string - name: include description: List of related resources to include in the response in: query required: false type: string enum: - actions - bundles - patient - current_results responses: '200': description: OK schema: $ref: '#/definitions/FetchPatientPlanSummaryResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' patch: tags: - plan summary: Update a plan summary description: Update a plan summary record for a patient. operationId: updatePatientPlanSummary parameters: - name: id in: path description: Plan summary identifier required: true type: string - name: body in: body required: true schema: $ref: '#/definitions/UpdatePatientPlanSummaryRequest' responses: '200': description: OK schema: $ref: '#/definitions/UpdatePatientPlanSummaryResponse' '401': description: Unauthorized schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '409': description: Invalid Request schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' /result: get: tags: - result summary: List patient health results description: Get a list of patient health results. operationId: fetchPatientHealthResults parameters: - name: filter[patient] in: query description: Filter the patient health results for a specified patient required: true type: string - name: filter[actions] in: query description: A comma-separated list of action identifiers type: string - name: filter[start_at] in: query description: Filter results that occurred after the passed ISO date and time string type: string format: dateTime - name: filter[end_at] in: query description: Filter results that occurred before the passed ISO date and time string type: string format: dateTime - name: filter[threads] in: query description: A comma-separated list of thread identifiers type: string - name: filter[created_at] in: query type: string description: | The start (inclusive) and end (exclusive) dates are ISO date and time strings separated by `..`. Example for results created in November 2017 (America/New_York): `filter[created_at]=2017-11-01T00:00:00-04:00..2017-12-01T00:00:00-05:00` - name: filter[updated_at] in: query type: string description: | The start (inclusive) and end (exclusive) dates are ISO date and time strings separated by `..`. Example for results updated in November 2017 (America/New_York): `filter[updated_at]=2017-11-01T00:00:00-04:00..2017-12-01T00:00:00-05:00` - name: page[number] in: query description: Page number required: false type: integer default: 1 - name: page[size] in: query description: Page size required: false type: integer default: 10 minimum: 0 maximum: 50 - name: page[limit] in: query description: Page limit type: integer required: false default: 50 minimum: 0 - name: page[after] in: query description: Page cursor type: string required: false responses: '200': description: OK schema: $ref: '#/definitions/FetchPatientHealthResultResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' '409': description: Invalid Request schema: $ref: '#/definitions/FetchErrorResponse' /result/{id}: get: tags: - result summary: Get a patient health result description: Get patient health result by id. operationId: fetchPatientHealthResult parameters: - name: id in: path description: Patient health result identifier required: true type: string responses: '200': description: OK schema: $ref: '#/definitions/FetchPatientHealthResultResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' /reward: post: tags: - reward summary: Create a reward description: Create a reward for a patient. operationId: createReward parameters: - name: body in: body required: true schema: $ref: '#/definitions/CreateRewardRequest' responses: '200': description: OK schema: $ref: '#/definitions/CreateRewardResponse' '401': description: Unauthorized schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '409': description: Invalid Request schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' get: tags: - reward summary: List rewards description: Get a list of rewards matching the specified filters. operationId: fetchRewards parameters: - name: filter[patient] in: query description: | Patient identifier. Note that one of the following filters must be specified: `filter[patient]`, `filter[groups]`, `filter[organization]`. type: string - name: filter[reward_program_activation] in: query description: Reward program activation identifier type: string - name: filter[thread] in: query description: Thread identifier type: string - name: filter[groups] in: query type: string description: | Comma-separated list of group ids. Note that one of the following filters must be specified: `filter[patient]`, `filter[groups]`, `filter[organization]`. - name: filter[organization] in: query type: string description: | Fitbit Plus organization id. Note that one of the following filters must be specified: `filter[patient]`, `filter[groups]`, `filter[organization]`. responses: '200': description: OK schema: $ref: '#/definitions/FetchRewardsResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' /reward/{id}: get: tags: - reward summary: Get a reward description: Get a reward record by id. operationId: fetchReward parameters: - name: id in: path description: Reward identifier required: true type: string responses: '200': description: OK schema: $ref: '#/definitions/FetchRewardResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' /reward_earning: post: tags: - reward earning summary: Create a reward earning description: Create a reward earning for a reward. There can only be one earning for a reward. It is possilble to create multiple reward earnings simultaneously by providing and array of reward earnings in the data property. operationId: createRewardEarning parameters: - name: body in: body required: true schema: $ref: '#/definitions/CreateRewardEarningRequest' responses: '200': description: OK schema: $ref: '#/definitions/CreateRewardEarningResponse' '401': description: Unauthorized schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '409': description: Invalid Request schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' get: tags: - reward earning summary: List reward earnings description: Get a list of reward earnings matching the specified filters. operationId: fetchRewardEarnings parameters: - name: filter[groups] in: query description: Group identifiers required: true type: string - name: filter[patient] in: query description: Patient identifier required: true type: string - name: filter[ready_for_fulfillment] in: query description: If true, only returns those reward earnings for which ready_for_fulfillment is true and fulfilled_at is null. If false, only returns those reward earnings for which ready_for_fulfillment is false and fulfilled_at is null. type: boolean responses: '200': description: OK schema: $ref: '#/definitions/FetchRewardEarningsResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' /reward_earning/{id}: get: tags: - reward earning summary: Get a reward earning description: Get a reward earning record by id. operationId: fetchRewardEarning parameters: - name: id in: path description: Reward earning identifier required: true type: string responses: '200': description: OK schema: $ref: '#/definitions/FetchRewardEarningResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' /reward_earning_fulfillment: post: tags: - reward earning fulfillment summary: Create a reward earning fulfillment description: Create a reward earning fulfillment for a reward earning. There can only be one fulfillment for each earning. operationId: createRewardEarningFulfillment parameters: - name: body in: body required: true schema: $ref: '#/definitions/CreateRewardEarningFulfillmentRequest' responses: '200': description: OK schema: $ref: '#/definitions/CreateRewardEarningFulfillmentResponse' '401': description: Unauthorized schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '409': description: Invalid Request schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' get: tags: - reward earning fulfillment summary: List reward earning fulfillments description: Get a list of reward earning fulfillments matching the specified filters. operationId: fetchRewardEarningFulfillments parameters: - name: filter[patient] in: query description: Patient identifier required: true type: string responses: '200': description: OK schema: $ref: '#/definitions/FetchRewardEarningFulfillmentsResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' /reward_earning_fulfillment/{id}: get: tags: - reward earning fulfillment summary: Get a reward earning fulfillment description: Get a reward earning fulfillment record by id. operationId: fetchRewardEarningFulfillment parameters: - name: id in: path description: Reward earning fulfillment identifier required: true type: string responses: '200': description: OK schema: $ref: '#/definitions/FetchRewardEarningFulfillmentResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' /reward_program_activation: post: tags: - reward program activation summary: Create a reward program activation description: Create a reward program activation for a patient. There can only be one activation for a patient for a given reward program. operationId: createRewardProgramActivation parameters: - name: body in: body required: true schema: $ref: '#/definitions/CreateRewardProgramActivationRequest' responses: '200': description: OK schema: $ref: '#/definitions/CreateRewardProgramActivationResponse' '401': description: Unauthorized schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' '409': description: Invalid Request schema: $ref: '#/definitions/CreateOrUpdateErrorResponse' get: tags: - reward program activation summary: List reward program activations description: Get a list of reward program activations matching the specified filters. operationId: fetchRewardProgramActivations parameters: - name: filter[patient] in: query description: | Patient identifier. Note that one of the following filters must be specified: `filter[patient]`, `filter[groups]`, `filter[organization]`. type: string - name: filter[groups] in: query type: string description: | Comma-separated list of group ids. Note that one of the following filters must be specified: `filter[patient]`, `filter[groups]`, `filter[organization]`. - name: filter[organization] in: query type: string description: | Fitbit Plus organization id. Note that one of the following filters must be specified: `filter[patient]`, `filter[groups]`, `filter[organization]`. responses: '200': description: OK schema: $ref: '#/definitions/FetchRewardProgramActivationsResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' /reward_program_activation/{id}: get: tags: - reward program activation summary: Get a reward program activation description: Get a reward program activationrecord by id. operationId: fetchRewardProgramActivation parameters: - name: id in: path description: Reward program activation identifier required: true type: string responses: '200': description: OK schema: $ref: '#/definitions/FetchRewardProgramActivationResponse' '401': description: Unauthorized schema: $ref: '#/definitions/FetchErrorResponse' '403': description: Forbidden schema: $ref: '#/definitions/FetchErrorResponse' definitions: # BEGIN resource definitions Resource: type: object properties: type: type: string id: type: string attributes: type: object CreateOrUpdateMetaResponse: type: object properties: req_id: type: string ignored: type: array items: type: string FetchMetaResponse: type: object properties: req_id: type: string count: type: integer CollectionResponseLinks: type: object properties: self: type: string next: type: string prev: type: string last: type: string # END resource definitions # BEGIN error definitions Error: type: object properties: status: type: string code: type: string enum: - Forbidden - InvalidParameter - InvalidBodyParameter - ResourceNotFound - Unauthorized - InvalidCredentials - InvalidGrantType title: type: string detail: type: string source: type: object properties: parameter: type: string pointer: type: string CreateOrUpdateErrorResponse: type: object properties: meta: $ref: '#/definitions/CreateOrUpdateMetaResponse' errors: $ref: '#/definitions/Error' example: { "meta": { "req_id": "d07c8b12-c95e-4a06-8424-92aac94bb445" }, "errors": [{ "code": "Unauthorized", "detail": "A valid bearer token is required", "status":"401" } ] } FetchErrorResponse: type: object properties: meta: $ref: '#/definitions/FetchMetaResponse' errors: $ref: '#/definitions/Error' example: { "meta": { "req_id": "d07c8b12-c95e-4a06-8424-92aac94bb445" }, "errors": [{ "code": "Unauthorized", "detail": "A valid bearer token is required", "status":"401" } ] } # END error definitions # BEGIN /oauth/token definitions TokenResource: type: object required: - type - id properties: type: type: string example: token enum: - token id: type: string example: '57b36c9a04ad8c2224f2af35' attributes: required: - access_token - refresh_token - token_type - expires_in properties: access_token: type: string example: 'a01fe2bb-1977-48d9-b722-ac7f9135143f' refresh_token: type: string example: 'b452cb17-72e2-4e90-b9c6-d77a0b66cf7c' token_type: type: string enum: - bearer example: 'bearer' expires_in: type: integer example: 3600 relationships: type: object properties: groups: required: - links - data properties: data: type: array items: type: object required: - type - id properties: type: type: string enum: - group example: group id: type: string example: '57b36d6f04ad8c2224f2af36' links: required: - related properties: related: type: string pattern: '/oauth/token/[0-9a-z]+/groups' example: '/oauth/token/57b36d8804ad8c2224f2af37/groups' organization: required: - links - data properties: data: required: - type - id properties: type: type: string enum: - organization example: organization id: type: string example: '57b36d6f04ad8c2224f2af36' links: required: - related properties: related: type: string pattern: '/oauth/token/[0-9a-z]+/organization' example: '/oauth/token/57b36d8804ad8c2224f2af37/organization' CreateTokenRequest: type: object required: - data properties: data: type: object required: - attributes properties: type: type: string enum: - token example: token attributes: type: object required: - client_id - grant_type properties: grant_type: type: string enum: - refresh_token - client_credentials example: client_credentials client_id: type: string description: Contact Fitbit Plus API Support to get a client id and secret. example: '19391dc5-8af8-4152-93e8-74ff9361607e' client_secret: type: string description: Contact Fitbit Plus API Support to get a client id and secret. Secret is required if grant_type is "client_credentials" example: '63eca384-7a65-42e2-872b-afd3e8659d0a' refresh_token: type: string description: Required if grant_type is "refresh_token" example: 'b7dcc4a4-593b-4410-a0c5-97ae48939396' example: { "data": { "type": "oauth/token", "attributes": { "grant_type": "client_credentials", "client_id": "95c78ab2-167f-40b8-8bec-8398d4b87454", "client_secret": "35d18dc9-a3dd-4948-b787-063a490b9354" } } } CreateTokenResponse: type: object required: - data properties: meta: $ref: '#/definitions/CreateOrUpdateMetaResponse' data: $ref: '#/definitions/TokenResource' included: type: array items: $ref: '#/definitions/GroupResource' example: { "meta": { "req_id": "2de51f1a-bafa-4e48-a0d0-cd8d4a9ffb28" }, "data": { "type": "oauth/token", "id": "5817a24d678a7c2cbf5df3ee", "attributes": { "access_token": "c1b83534-76c1-4a27-b1d4-8140e24dd7c6", "refresh_token": "a38d192a-76fd-4b1d-954c-893c9d29c8f4", "token_type": "bearer", "expires_in": 3601 }, "relationships": { "groups": { "data": [{ "type": "group", "id": "5755db2a3db4179179999acf" }], "links": { "related": "/pub/oauth/token/5817a24d678a7c2cbf5df3ee/groups" } } } } } # END /oauth/token definitions # BEGIN /organization definitions OrganizationResource: type: object required: - id - type - attributes properties: id: type: string example: '57b36e3c04ad8c2224f2af38' type: type: string enum: - organization example: organization attributes: required: - name properties: name: type: string example: Health Activation Partners links: readOnly: true required: - self properties: self: type: string pattern: '/organization/[0-9a-z]+' example: '/organization/57b36e3c04ad8c2224f2af38' FetchOrganizationResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' data: $ref: '#/definitions/OrganizationResource' example: { "meta": { "req_id": "aeb94ed8-d7f9-4e72-a78f-e276c4f52c2a" }, "data": { "type": "organization", "id": "5873b63605376e337a89d64a", "attributes": { "name": "Health Activation Partners" }, "links": { "self": "/pub/organization/5873b63605376e337a89d64a" } } } # END /organization definitions # BEGIN /group definitions GroupResource: type: object required: - id - type - attributes properties: id: type: string example: '57b36e3c04ad8c2224f2af38' type: type: string enum: - group example: group attributes: type: object required: - name properties: name: type: string example: Team Health description: The name of the group bio: type: string description: A description of the group example: Team Health is all about the patient experience. links: type: object readOnly: true required: - self properties: self: type: string pattern: '/group/[0-9a-z]+' example: '/group/57b36e3c04ad8c2224f2af38' FetchGroupResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' data: $ref: '#/definitions/GroupResource' example: { "meta": { "req_id": "2b59851e-0f6c-4a8f-a8a6-15bd7c0346e7" }, "data": { "type":"group", "id":"5755db2a3db4179179999acf", "attributes": { "name":"Patients Lead" }, "links": { "self": "/pub/group/5755db2a3db4179179999acf" } } } FetchGroupsResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' data: type: array items: $ref: '#/definitions/GroupResource' example: { "meta": { "req_id": "ab554093-6081-4d37-aa7b-ca6312367ca4", "count":1 }, "links": { "self": "/pub/oauth/token/5817a24d678a7c2cbf5df3ee/groups" }, "data": [{ "type":"group", "id":"5755db2a3db4179179999acf", "attributes": { "name":"Patients Lead" }, "links": { "self":"/pub/group/5755db2a3db4179179999acf" } }] } CreateGroupRequest: type: object required: - data properties: data: $ref: '#/definitions/GroupResource' example: { "data": { "type":"group", "attributes": { "name":"New Group" } } } CreateGroupResponse: type: object required: - data properties: meta: $ref: '#/definitions/CreateOrUpdateMetaResponse' data: $ref: '#/definitions/GroupResource' example: { "meta": { "req_id": "6ac6d0f2-00b2-4031-8c35-97b2bfb0aced" }, "data": { "type": "group", "id": "5817acae6f5316c0d05ba8b8", "attributes": { "name": "New Group" }, "links": { "self": "/pub/group/5817acae6f5316c0d05ba8b8" } } } # END /group definitions # BEGIN /coach definitions CoachResource: type: object required: - id - type - attributes properties: id: type: string example: '57b36e3c04ad8c2224f2af38' type: type: string enum: - coach example: coach attributes: type: object properties: first_name: type: string example: Clarisa last_name: type: string example: Rivera links: type: object readOnly: true required: - self properties: self: type: string pattern: '/coach/[0-9a-z]+' example: '/coach/57b36e3c04ad8c2224f2af38' FetchCoachResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' data: $ref: '#/definitions/CoachResource' example: { "meta": { "req_id": "b928037e-98ed-434f-b0c4-d74b1a38a560" }, "data": { "type": "coach", "id": "581630c3237d84a9403533c6", "attributes": { "first_name": "Clarisa", "last_name": "Rivera" }, "links": { "self": "/pub/coach/581630c3237d84a9403533c6" } }, "included": [] } FetchCoachesResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' data: type: array items: $ref: '#/definitions/CoachResource' example: { "meta": { "req_id": "48c47326-0c8b-4c5e-85da-7fc0d00f1e4d", "count": 1 }, "links": { "self": "/pub/patient/58163112237d84a94035f78b/coaches" }, "data": [{ "type":"coach", "id":"581630c3237d84a9403533c6", "attributes": { "first_name": "Clarisa", "last_name":"Rivera" }, "links": { "self":"/pub/coach/581630c3237d84a9403533c6" } }], "included": [] } # END /coach definitions # BEGIN /reward_program definitions RewardProgramResource: type: object required: - type properties: type: type: string id: type: string attributes: type: object required: - name - start_at - end_at - budget_value properties: name: description: 'Name of the reward program' type: string tagline: description: 'Tagline of the reward program - designed to be one line' type: string description: description: 'Description of the reward program - designed to be a comprehensive text description' type: string start_at: description: 'Date at which the reward program starts.' type: string format: dateTime end_at: description: 'Date at which the reward program ends. (Must be after the start_at)' type: string format: dateTime budget_value: description: 'Value of the budget for the reward program. (Must be greater than 0)' type: number budget_unit: description: 'Unit of the budget for the reard program.' type: string enum: - dollar - point - credit default: dollar duration_active: description: 'Number of days that a program can be active after it has been activated for a patient. (Must be greater than 0)' type: number default: 540 fulfill_as_earned: description: 'If true, the rewards created for a patient for the program can be fulfulled as they are earned. If false, the rewards should only be fulfilled when the program is deactivated.' type: boolean default: false frozen: description: 'If true, the reward program cannot be activated for a patient and new rewards cannot be created for the program.' type: boolean default: false relationships: type: object required: - group properties: group: type: object required: - data properties: data: type: object required: - type - id properties: type: type: string id: type: string CreateRewardProgramRequest: type: object required: - data properties: data: $ref: '#/definitions/RewardProgramResource' CreateRewardProgramResponse: type: object required: - data properties: meta: $ref: '#/definitions/CreateOrUpdateMetaResponse' data: $ref: '#/definitions/RewardProgramResource' FetchRewardProgramResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' data: $ref: '#/definitions/RewardProgramResource' FetchRewardProgramsResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' data: type: array items: $ref: '#/definitions/RewardProgramResource' # END /reward_program definitions # BEGIN /action definitions Identifier: type: object required: - system - value properties: label: type: string system: type: string value: type: string ActionMetric: type: object properties: metric_type: type: string unit: type: string goal: type: object validations: type: object properties: minimum: type: object properties: value: type: number unit: type: string maximum: type: object properties: value: type: number unit: type: string ActionWindow: type: object required: - type properties: title: type: string type: type: string _id: type: string ActionResource: type: object required: - type - id properties: type: type: string id: type: string attributes: type: object required: - type - title - effective_from properties: type: type: string enum: - other_lifestyle title: type: string static_title: type: string readOnly: true effective_from: type: string format: dateTime effective_to: type: string format: dateTime tracking: type: boolean _thread: type: string adherence: type: object readOnly: true properties: due: type: integer complete: type: integer streak: type: object properties: count: type: integer updated_at: type: string format: dateTime frequency_goal: type: object properties: weeks: type: object properties: days: type: array items: description: 'Days of week that the action is scheduled for. Zero-indexed, ex 0 represents Sunday, etc.' type: integer maxItems: 7 enum: [0, 1, 2, 3, 4, 5, 6] identifiers: type: array items: $ref: '#/definitions/Identifier' details: type: object additionalProperties: true intake: type: object additionalProperties: true metric_required: type: boolean metrics: type: array items: $ref: '#/definitions/ActionMetric' windows: type: array items: $ref: '#/definitions/ActionWindow' relationships: type: object properties: plan: type: object properties: data: type: object properties: type: type: string id: type: string links: type: object CreateActionRequest: type: object required: - data properties: data: $ref: '#/definitions/ActionResource' example: { "data": { "type": "action", "attributes": { "effective_from": "2017-02-20T11:12:13.000Z", "title": "Record Blood Pressure", "type": "blood_pressure", "frequency_goal": { "weeks": { "days": [0] } }, "metrics": [ { "metric_type": "blood_pressure", "unit": "mmHg", "goal": { "data": { "systolic": { "value": 150, "unit": "mmHg" }, "diastolic": { "value": 95, "unit": "mmHg" } } } } ] }, "relationships": { "plan": { "data": { "type": "patient_plan_summary", "id": "58aacf0d076adcef394bac35" } }, "bundles": { "data": [ { "type": "bundle", "id": "58aacf0d076adcef394bac30" } ] } } } } CreateActionResponse: type: object required: - data properties: meta: $ref: '#/definitions/CreateOrUpdateMetaResponse' data: $ref: '#/definitions/ActionResource' example: { "data": { "type": "action", "id": "58aacf0d076adcef394bac36", "attributes": { "_thread": "blood_pressure", "adherence": { "due": 0, "complete": 0, "streak": { "count": 0 } }, "effective_from": "2017-02-20T11:12:13.000Z", "frequency_goal": { "weeks": { "days": [0] } }, "frequency_goal_prorated": 0, "identifiers": [], "metric_required": false, "metrics": [ { "metric_type": "blood_pressure", "unit": "mmHg", "goal": { "data": { "diastolic": { "unit": "mmHg", "value": 95 }, "systolic": { "unit": "mmHg", "value": 150 } } }, "_id": "58aacf0d076adcef394bac37", "accepted_values": [] } ], "title": "Record Blood Pressure", "tracking": true, "windows": [], "type": "blood_pressure", "options": [], "created_at": "2017-02-20T11:12:13.000Z", "created_by": "596541ec076adcef394bac2d", "updated_at": "2017-02-20T11:12:13.000Z", "updated_by": "596541ec076adcef394bac2d" }, "links": { "self": "/action/58aacf0d076adcef394bac36" }, "relationships": { "plan": { "links": { "related": "/action/58aacf0d076adcef394bac36/plan" }, "data": { "type": "patient_plan_summary", "id": "58aacf0d076adcef394bac35" } }, "bundles": { "links": { "related": "/action/58aacf0d076adcef394bac36/bundles" }, "data": [ { "type": "bundle", "id": "58aacf0d076adcef394bac30" } ] } } }, "included": [], "meta": { "req_id": "014ea6d2-4717-4915-b4bc-98454180614e" } } UpdateActionRequest: type: object required: - data properties: data: $ref: '#/definitions/ActionResource' UpdateActionResponse: type: object required: - data properties: meta: $ref: '#/definitions/CreateOrUpdateMetaResponse' data: $ref: '#/definitions/ActionResource' FetchActionResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' data: $ref: '#/definitions/ActionResource' example: { "data": { "type": "action", "id": "59653f699fc8be3938f04491", "attributes": { "_thread": "weight", "adherence": { "due": 1, "complete": 1, "streak": { "count": 1, "updated_at": "2017-07-11T21:13:13.215Z" } }, "effective_from": "2017-07-10T21:13:13.212Z", "effective_to": "2017-07-11T21:13:13.215Z", "frequency_goal": { "weeks": { "days": [0] } }, "frequency_goal_prorated": 0, "identifiers": [ { "label": "Super Health Actions", "system": "http://super.health.example.com", "value": "action-0123", "_id": "59653f699fc8be3938f04494" } ], "details": { "some": "mixed value" }, "metric_required": true, "metrics": [ { "metric_type": "weight", "unit": "lb", "goal": { "data": { "unit": "lb", "value": 210 } }, "_id": "59653f699fc8be3938f04493", "accepted_values": [], "validations": { "maximum": { "unit": "lb", "value": 999 }, "minimum": { "unit": "lb", "value": 0 } } } ], "title": "Measure Weight", "tracking": true, "windows": [ { "title": "Morning", "type": "morning", "_id": "59653f699fc8be3938f04492" } ], "type": "weight", "options": [] }, "links": { "self": "/action/59653f699fc8be3938f04491" }, "relationships": { "plan": { "links": { "related": "/action/59653f699fc8be3938f04491/plan" } }, "bundles": { "links": { "related": "/action/59653f699fc8be3938f04491/bundles" }, "data": [] } } }, "included": [], "meta": { "req_id": "63bf4340-f256-400e-b391-d801d2a251f6" } } # END /action definitions # BEGIN /bundle definitions BundleResource: type: object required: - type - id properties: type: type: string id: type: string attributes: type: object required: - type - title - effective_from properties: type: type: string title: type: string effective_from: type: string format: dateTime effective_to: type: string format: dateTime _thread: type: string relationships: type: object properties: plan: type: object properties: data: type: object properties: type: type: string id: type: string links: type: object actions: type: object properties: data: type: object properties: type: type: string id: type: string links: type: object UpdateBundleRequest: type: object required: - data properties: data: $ref: '#/definitions/BundleResource' UpdateBundleResponse: type: object required: - data properties: meta: $ref: '#/definitions/CreateOrUpdateMetaResponse' data: $ref: '#/definitions/BundleResource' CreateBundleRequest: type: object required: - data properties: data: $ref: '#/definitions/BundleResource' CreateBundleResponse: type: object required: - data properties: meta: $ref: '#/definitions/CreateOrUpdateMetaResponse' data: $ref: '#/definitions/BundleResource' FetchBundleResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' data: $ref: '#/definitions/BundleResource' example: { "data": { "type": "bundle", "id": "596535d9608f63d531b7e34a", "attributes": { "type": "weight", "title": "Weight", "_actions": [ "596535d9608f63d531b7e344" ], "effective_from": "2017-07-11T20:31:25.000Z", "effective_to": "2017-07-11T20:32:25.000Z", "_thread": "123" }, "links": { "self": "/bundle/596535d9608f63d531b7e34a" }, "relationships": { "plan": { "links": { "related": "/bundle/596535d9608f63d531b7e34a/plan" } }, "actions": { "links": { "related": "/bundle/596535d9608f63d531b7e34a/actions" }, "data": [ { "type": "action", "id": "596535d9608f63d531b7e344" } ] } } }, "included": [], "meta": { "req_id": "c0f8d53a-d763-4beb-b0b1-9ec6da146a14" } } # END /bundle definitions # BEGIN /calendar_event definitions CalendarEventResource: type: object properties: type: type: string enum: - calendar_event id: type: string attributes: type: object properties: completed_by: type: object description: 'The coach who marked the calendar event as completed. Only valid for `plan-check-in` event type.' completed_at: type: string format: ISODate example: '2017-11-03T06:17:34.652Z' description: 'The date and time when the calendar event is marked as completed. Only valid for `plan-check-in` event type.' type: type: string description: 'The type of calendar event. Immutable after event creation.' enum: - plan-check-in - reminder - telephone-call - office-visit - video-call time_zone: type: string description: 'The time zone in which the dates for the calendar event are specified' example: 'America/New_York' all_day: type: boolean description: 'True if the calendar event is an all day event, false otherwise. Must be set to true for `plan-check-in` event type. If it is true, then `start_at` and `end_at` must also be set to beginning of day, except `plan-check-in` event type does not need an `end_at` date. If it is false, then `start_at` and `end_at` must be on the same day.' start_at: type: string format: ISODate description: 'The date and time when the calendar event starts' example: '2017-11-03T04:00:00.000Z' end_at: type: string format: ISODate description: 'The date and time when the calendar event ends. Not valid for `plan-check-in` event type.' example: '2017-11-03T08:00:00.000Z' title: type: string description: 'The title of the calendar event. Must not be empty or null' location: type: string description: type: string attendees: type: array description: 'List of attendees for the calendar event' items: type: object properties: user: type: string response_status: type: string description: 'Status of responses from attendees' enum: - needsAction - declined - tentative - accepted links: type: object properties: self: type: string pattern: '/calendar_event/[0-9a-z]+' example: '/calendar_event/5a0c8e2aa9d454cc1509a142' relationships: type: object properties: owner: type: object required: - data properties: data: type: object properties: type: type: string id: type: string links: type: object properties: related: type: string pattern: '/pub/calendar_event/[0-9a-z]+' example: '/pub/calendar_event/5a0c8e2aa9d454cc1509a142/owner' description: The owner is the patient for whom the calendar event is created specificially for example: { "type": "calendar_event", "id": "5a0c8e2aa9d454cc1509a142", "attributes": { "completed_at": "2017-11-03T06:17:34.652Z", "completed_by": "5a0c8e27a9d454cc150997c9", "type": "plan-check-in", "time_zone": "America/New_York", "all_day": true, "start_at": "2017-11-03T04:00:00.000Z", "end_at": "2017-11-03T08:00:00.000Z", "title": "Plan Check-In", "attendees": [ { "_id": "5ac7e74679f6868274a42e28", "user": "5a0c8e27a9d454cc150997c9", "response_status": "needsAction" }, { "_id": "5ac7e74679f6868274a42e27", "user": "5a0c8e27a9d454cc150997f7", "response_status": "needsAction" } ], "created_at": "2017-10-20T10:59:40.000Z", "created_by": "5a0c8e27a9d454cc150997c9", "updated_at": "2017-10-20T10:59:40.000Z", "updated_by": "5a0c8e27a9d454cc150997c9" }, "relationships": { "owner": { "links": { "related": "/pub/calendar_event/5a0c8e2aa9d454cc1509a142/owner" }, "data": { "type": "patient", "id": "5a0c8e27a9d454cc150997f7" } } }, "links": { "self": "/pub/calendar_event/5a0c8e2aa9d454cc1509a142" }, } CreateCalendarEventRequest: type: object required: - data properties: data: type: object required: - type - attributes - relationships properties: type: $ref: "#/definitions/CalendarEventResource/properties/type" attributes: required: - type - start_at - title - attendees allOf: - $ref: "#/definitions/CalendarEventResource/properties/attributes" relationships: type: object properties: owner: type: object required: - data properties: data: $ref: "#/definitions/CalendarEventResource/properties/relationships/properties/owner/properties/data" example: { "data": { "type": "calendar_event", "attributes": { "type": "plan-check-in", "time_zone": "America/New_York", "all_day": true, "start_at": "2018-02-20T00:00:00Z", "title": "Plan Check-In", "attendees": [ { "user": "5a0c8e27a9d454cc150997c9" }, { "user": "5a0c8e27a9d454cc150997f7" } ], }, "relationships": { "owner": { "data": { "type": "patient", "id": "5a0c8e27a9d454cc150997f7" } } } } } CreateCalendarEventResponse: type: object properties: meta: $ref: '#/definitions/CreateOrUpdateMetaResponse' data: $ref: '#/definitions/CalendarEventResource' UpdateCalendarEventRequest: type: object properties: data: type: object required: - type - id properties: type: $ref: "#/definitions/CalendarEventResource/properties/type" id: $ref: "#/definitions/CalendarEventResource/properties/id" attributes: allOf: - $ref: "#/definitions/CalendarEventResource/properties/attributes" relationships: type: object properties: owner: type: object properties: data: $ref: "#/definitions/CalendarEventResource/properties/relationships/properties/owner/properties/data" example: { "data": { "type": "calendar_event", "id": "42ba7c2da9d45415234345b3", "attributes": { "completed_at": "2017-11-03T06:17:34.652Z", "completed_by": "5a0c8e27a9d454cc150997c9", "type": "telephone-call", "time_zone": "America/New_York", "all_day": false, "start_at": "2018-02-20T14:00:00Z", "end_at": "2018-02-20T18:00:00Z", "title": "Telephone Call", "attendees": [ { "user": "5a0c8e27a9d454cc150997c9" }, { "user": "5a0c8e27a9d454cc150997f7" } ], }, "relationships": { "owner": { "data": { "type": "patient", "id": "5a0c8e27a9d454cc150997f7" } } } } } UpdateCalendarEventResponse: type: object properties: meta: $ref: '#/definitions/CreateOrUpdateMetaResponse' data: $ref: '#/definitions/CalendarEventResource' FetchCalendarEventResponse: type: object properties: meta: $ref: '#/definitions/FetchMetaResponse' data: $ref: '#/definitions/CalendarEventResource' included: description: | Related resources which are included in the response based on the `include` param. Attributes of each resource will vary depending on the type. See [patient](#operation/fetchPatient) type: array items: $ref: '#/definitions/Resource' FetchCalendarEventsResponse: type: object properties: meta: $ref: '#/definitions/FetchMetaResponse' links: $ref: '#/definitions/CollectionResponseLinks' data: type: array items: $ref: '#/definitions/CalendarEventResource' included: description: | Related resources which are included in the response based on the `include` param. Attributes of each resource will vary depending on the type. See [patient](#operation/fetchPatient) type: array items: $ref: '#/definitions/Resource' # END /calendar_event definitions # BEGIN /calendar_event_response definitions CalendarEventResponseResource: type: object properties: type: type: string enum: - calendar_event_response id: type: string attributes: type: object properties: attendee: type: object description: 'The attendee in the attendees list of the calendar event.' response_status: type: string description: 'The response status for the attendee.' enum: - accepted - declined - tentative links: type: object properties: self: type: string pattern: '/calendar_event_response/[0-9a-z]+' example: '/calendar_event_response/5ad0f966ceb0909e4bfa84dd' relationships: type: object properties: user: type: object required: - data properties: data: type: object properties: type: type: string id: type: string links: type: object properties: related: type: string pattern: '/pub/calendar_event_response/[0-9a-z]+' example: '/pub/calendar_event_response/5ad0f966ceb0909e4bfa84dd/user' description: The user is the coach or patient for whom the calendar event response is created specificially for calendar_event: type: object required: - data properties: data: type: object properties: type: type: string id: type: string links: type: object properties: related: type: string pattern: '/pub/calendar_event_response/[0-9a-z]+' example: '/pub/calendar_event_response/5ad0f966ceb0909e4bfa84dd/calendar_event' description: The calendar_event is the calendar event for which the calendar event response is created specificially for example: { "type": "calendar_event_response", "id": "5ad0f966ceb0909e4bfa84dd", "attributes": { "attendee": "5ac7e74679f6868274a42e28", "response_status": "accepted" }, "relationships": { "user": { "links": { "related": "/pub/calendar_event_response/5ad0f966ceb0909e4bfa84dd/user" }, "data": { "type": "user", "id": "5a0c8e27a9d454cc150997f7" } }, "calendar_event": { "links": { "related": "/pub/calendar_event_response/5ad0f966ceb0909e4bfa84dd/calendar_event" }, "data": { "type": "calendar_event", "id": "5755db2a3db4179179999acf" } } }, "links": { "self": "/pub/calendar_event_response/5ad0f966ceb0909e4bfa84dd" }, } CreateCalendarEventResponseRequest: type: object required: - data properties: data: type: object required: - type - attributes - relationships properties: type: $ref: "#/definitions/CalendarEventResponseResource/properties/type" attributes: required: - attendee - response_status allOf: - $ref: "#/definitions/CalendarEventResponseResource/properties/attributes" relationships: type: object properties: user: type: object required: - data properties: data: $ref: "#/definitions/CalendarEventResponseResource/properties/relationships/properties/user/properties/data" calendar_event: type: object required: - data properties: data: $ref: "#/definitions/CalendarEventResponseResource/properties/relationships/properties/calendar_event/properties/data" example: { "data": { "type": "calendar_event_response", "attributes": { "attendee": "5ac7e74679f6868274a42e28", "response_status": "accepted" }, "relationships": { "user": { "data": { "type": "user", "id": "5a0c8e27a9d454cc150997f7" } }, "calendar_event": { "data": { "type": "calendar_event", "id": "5755db2a3db4179179999acf" } } } } } # END /calendar_event_response definitions # BEGIN /email_history definitions EmailHistoryResource: type: object required: - type properties: type: type: string id: type: string attributes: type: object properties: twine_email_id: description: 'Unique identifier for this email.' type: string email_address: description: 'Address email was sent to.' type: string email_type: description: 'Type of email.' type: string send_time: description: 'Time email was sent.' type: string format: dateTime status_times: description: 'Status of email. Multiple statuses may be defined. The current status is the one with the most recent date.' type: object properties: processed: description: 'Time email was processed.' type: string format: dateTime dropped: description: 'Time email was dropped.' type: string format: dateTime deferred: description: 'Time email was deferred.' type: string format: dateTime bounce: description: 'Time email was bounced.' type: string format: dateTime open: description: 'Time email was opened.' type: string format: dateTime spamreport: description: 'Time email was reported as spam.' type: string format: dateTime unsubscribe: description: 'Time email was unsubscribed from.' type: string format: dateTime click: description: 'Time email was clicked.' type: string format: dateTime delivered: description: 'Time email was delivered.' type: string format: dateTime relationships: type: object properties: sender: type: object properties: data: type: object properties: type: type: string id: type: string receiver: type: object properties: data: type: object properties: type: type: string id: type: string example: { "type": "email_history", "id": "595fddec28c5041b84467592", "attributes": { "created_at": "2017-07-07T19:15:56.229Z", "created_by": "595fd88ef4be5b1a797ff19b", "email_address": "tony@example.com", "email_type": "invite", "send_time": "2017-02-25T13:35:01.000Z", "status_times": { "delivered": "2017-02-25T13:35:03.000Z", "open": "2017-02-25T14:20:00.000Z", "processed": "2017-02-25T13:35:02.000Z" }, "twine_email_id": "576226e5-7e25-4469-b10d-2bc6a725bfbc", "updated_at": "2017-07-07T19:15:56.229Z", "updated_by": "595fd88ef4be5b1a797ff19b" }, "relationships": { "receiver": { "data": { "id": "595fddea28c5041b84466bbe", "type": "patient" }, "links": { "related": "/pub/email_history/595fddec28c5041b84467592/receiver" } }, "sender": { "links": { "related": "/pub/email_history/595fddec28c5041b84467592/sender" } } }, "links": { "self": "/pub/email_history/595fddec28c5041b84467592" }, } FetchEmailHistoryResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' data: $ref: '#/definitions/EmailHistoryResource' FetchEmailHistoriesResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' data: type: array items: $ref: '#/definitions/EmailHistoryResource' # END /email_history definitions # BEGIN /health_profile definitions HealthProfileResource: type: object required: - type properties: type: type: string id: type: string attributes: type: object properties: stats: type: array description: 'List of category, answered and total counts for questions in the health profile' items: type: object description: 'The category, answered and total counts for questions in the health profile' properties: category: type: string enum: - lifestyle_behaviors - mental_wellbeing - preventative_care - overall answered: type: number total: type: number links: type: object readOnly: true required: - self properties: self: type: string pattern: '/health_profile/[0-9a-z]+' example: '/health_profile/59d441ac21741161bbe266b5' relationships: type: object properties: patient: type: object readOnly: true properties: data: type: object properties: type: type: string id: type: string links: type: object readOnly: true properties: related: type: string pattern: '/pub/health_profile/[0-9a-z]+' example: '/pub/health_profile/59d441ac21741161bbe266b5/patient' questions: type: object readOnly: true properties: data: type: array items: type: object properties: type: type: string id: type: string links: type: object readOnly: true properties: related: type: string pattern: '/pub/health_profile/[0-9a-z]+' example: '/pub/health_profile/59d441ac21741161bbe266b5/questions' example: { "type": "health_profile", "id": "59d441ac21741161bbe266b5", "attributes": { "created_at": "2017-07-07T19:15:56.229Z", "stats": [ {"category": "lifestyle_behaviors", "answered": 5, "total": 11}, {"category": "mental_wellbeing", "answered": 3, "total": 5}, {"category": "preventative_care", "answered": 1, "total": 3}, {"category": "overall", "answered": 9, "total": 19} ], "updated_at": "2017-07-07T19:15:56.229Z", }, "relationships": { "patient": { "data": { "id": "595fddea28c5041b84466bbe", "type": "patient" }, "links": { "related": "/pub/health_profile/59d441ac21741161bbe266b5/patient" } }, "questions": { "data": [ { "id": "595fddea28c5041b84466bbe", "type": "health_profile_question" } ], "links": { "related": "/pub/health_profile/59d441ac21741161bbe266b5/questions" } } }, "links": { "self": "/pub/health_profile/59d441ac21741161bbe266b5" }, } FetchHealthProfileResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' data: $ref: '#/definitions/HealthProfileResource' included: description: | Related resources which are included in the response based on the `include` param. Attributes of each resource will vary depending on the type. See [patient](#operation/fetchPatient), [question](#operation/fetchHealthProfileQuestion) type: array items: $ref: '#/definitions/Resource' FetchHealthProfilesResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' links: $ref: '#/definitions/CollectionResponseLinks' data: type: array items: $ref: '#/definitions/HealthProfileResource' included: description: | Related resources which are included in the response based on the `include` param. Attributes of each resource will vary depending on the type. See [patient](#operation/fetchPatient), [question](#operation/fetchHealthProfileQuestion) type: array items: $ref: '#/definitions/Resource' HealthProfileQuestionResource: type: object required: - type - id properties: type: type: string id: type: string attributes: type: object description: | A health profile question does not have any attribute since it only relates an answer to the corresponding question definition. links: type: object readOnly: true required: - self properties: self: type: string pattern: '/pub/health_profile_question/[0-9a-z]+' example: '/pub/health_profile_question/59d435931d078505ba744e88' relationships: type: object properties: answer: type: object properties: data: type: object properties: type: type: string id: type: string links: type: object readOnly: true properties: related: type: string pattern: '/pub/health_profile_question/[0-9a-z]+/answer' example: '/pub/health_profile_question/59d435931d078505ba744e88/answer' profile: type: object properties: links: type: object readOnly: true properties: related: type: string pattern: '/pub/health_profile_question/[0-9a-z]+/profile' example: '/pub/health_profile_question/59d435931d078505ba744e88/profile' question_definition: type: object properties: data: type: object properties: type: type: string id: type: string links: readOnly: true properties: links: type: object readOnly: true properties: related: type: string pattern: '/pub/health_profile_question/[0-9a-z]+/question_definition' example: '/pub/health_profile_question/59d435931d078505ba744e88/question_definition' example: { "type": "health_profile_question", "id": "52b36e3c04ad8c2224f2aa67", "attribute": {}, "relationships": { "answer": { "data": { "id": "595fddea28c5041b84466bbe", "type": "health_profile_answer" }, "links": { "related": "/pub/health_profile_question/59d435931d078505ba744e88/answer" } }, "profile": { "links": { "related": "/pub/health_profile_question/59d435931d078505ba744e88/profile" } }, "question_definition": { "data": { "id": "4", "type": "health_question_definition" }, "links": { "related": "/pub/health_profile_question/59d435931d078505ba744e88/question_definition" } }, }, "links": { "self": "/pub/health_profile_question/59d435931d078505ba744e88" }, } FetchHealthProfileQuestionResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' data: $ref: '#/definitions/HealthProfileQuestionResource' included: description: | Related resources which are included in the response based on the `include` param. Attributes of each resource will vary depending on the type. See [question_definition](#operation/fetchHealthQuestionDefinition), [answer](#operation/fetchHealthProfileAnswer) type: array items: $ref: '#/definitions/Resource' FetchHealthProfileQuestionsResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' links: $ref: '#/definitions/CollectionResponseLinks' data: type: array items: $ref: '#/definitions/HealthProfileQuestionResource' included: description: | Related resources which are included in the response based on the `include` param. Attributes of each resource will vary depending on the type. See [question_definition](#operation/fetchHealthQuestionDefinition), [answer](#operation/fetchHealthProfileAnswer) type: array items: $ref: '#/definitions/Resource' HealthProfileAnswerResource: type: object required: - type - id properties: type: type: string id: type: string attributes: type: object properties: history: type: array description: 'List of details of previous answers for a health profile question' items: type: object description: 'The details of a previous answer for a health profile question' properties: answered_at: type: string format: dateTime description: 'The date when the health profile question is answered' value: type: string description: 'The value of the answer entered for the health profile question' _created_by: type: string description: 'The id of the patient or coach who answered the health profile question' latest: type: object description: 'The details of the latest answer for a health profile question' properties: answered_at: type: string format: dateTime description: 'The date when the health profile question is answered' value: type: string description: 'The value of the answer entered for the health profile question' _created_by: type: string description: 'The id of the patient or coach who answered the health profile question' question_id: type: string links: type: object readOnly: true required: - self properties: self: type: string pattern: '/health_profile_answer/[0-9a-z]+' example: '/health_profile_answer/59d441ac21741161bbe266b5' relationships: type: object properties: patient: type: object readOnly: true properties: data: type: object properties: type: type: string id: type: string links: type: object readOnly: true properties: related: type: string pattern: '/pub/health_profile_answer/[0-9a-z]+' example: '/pub/health_profile_answer/59d441ac21741161bbe266b5/patient' example: { "type": "health_profile_answer", "id": "59d441ac21741161bbe266b5", "attributes": { "created_at": "2017-07-07T19:15:56.229Z", "history": [ { "answered_at": "2017-10-03T12:45:16.720Z", "value": "2", "_created_by": "59d4d7dcd843ee01be71fcf8", "_id": "59d4d7dcd843ee01be71fcfb" } ], "latest": { "answered_at": "2017-10-04T12:45:16.720Z", "value": "1", "_created_by": "59d4d7dcd843ee01be71fcf8" }, "question_id": "4", "updated_at": "2017-07-07T19:15:56.229Z", }, "relationships": { "patient": { "data": { "id": "595fddea28c5041b84466bbe", "type": "patient" }, "links": { "related": "/pub/health_profile_answer/59d441ac21741161bbe266b5/patient" } } }, "links": { "self": "/pub/health_profile_answer/59d441ac21741161bbe266b5" }, } FetchHealthProfileAnswerResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' data: $ref: '#/definitions/HealthProfileAnswerResource' included: description: | Related resources which are included in the response based on the `include` param. Attributes of each resource will vary depending on the type. See [patient](#operation/fetchPatient) type: array items: $ref: '#/definitions/Resource' FetchHealthProfileAnswersResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' links: $ref: '#/definitions/CollectionResponseLinks' data: type: array items: $ref: '#/definitions/HealthProfileAnswerResource' included: description: | Related resources which are included in the response based on the `include` param. Attributes of each resource will vary depending on the type. See [patient](#operation/fetchPatient) type: array items: $ref: '#/definitions/Resource' HealthQuestionDefinitionResource: type: object required: - type - id properties: type: type: string id: type: string attributes: type: object properties: category: type: string enum: - lifestyle_behaviors - mental_wellbeing - preventative_care description: 'The category for the health profile definition' format: type: object description: 'The list of formats for the health profile definition' properties: data: type: array items: type: object description: 'The label, value and icon for the answer choices for the question' properties: label: type: string value: type: string icon: type: string type: type: string requirements: type: array description: 'The lsit of age and gender requirements for the question to be included' items: type: object description: 'The age and gender requirement for the question to be included' properties: property: type: string shouldBeEqual: type: boolean description: 'Specifies if the value in property should be equal to the one in value' shouldBeGreaterThan: type: number description: 'Specifies if the value in property should be greater than the one in value' shouldBeLessThan: type: number description: 'Specifies if the value in property should be less than the one in value' value: type: string description: 'The value to be compared with the one in property, based on shouldBeEqual, shouldBeGreaterThan, or shouldBeLessThan' text: type: string description: 'The question text which corresponds to the answer choices' links: type: object readOnly: true required: - self properties: self: type: string pattern: '/health_question_definition/[0-9]+' example: '/health_question_definition/4' relationships: type: object example: { "type": "health_question_definition", "id": "21", "attributes": { "category": "preventative_care", "format": { "data":[ {"label": "I Don't know", "value": "0"}, {"label": "I've never had a colonoscopy", "value": "1"}, ], "type": "last_occurrence" }, "requirements": [ {"property": "age", "shouldBeGreaterThan": 49, "shouldBeLessThan": 76} ], "text": "When was your last colonoscopy?" }, "links": { "self": "/pub/health_question_definition/21" }, } FetchHealthQuestionDefinitionResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' data: $ref: '#/definitions/HealthQuestionDefinitionResource' FetchHealthQuestionDefinitionsResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' links: $ref: '#/definitions/CollectionResponseLinks' data: type: array items: $ref: '#/definitions/HealthQuestionDefinitionResource' # END health_profile definitions # BEGIN patient_health_metric definitions PatientHealthMetricResource: type: object required: - type - id properties: type: type: string id: type: string attributes: type: object properties: type: type: string enum: - blood_pressure_systolic - blood_pressure_diastolic - hemoglobin_a1c - hdl_cholesterol - ldl_cholesterol - total_cholesterol - triglycerides - blood_urea_nitrogen - creatinine - hemoglobin - hematocrit - total_serum_iron - thyroid_stimulating_hormone - free_thyroxine - free_triiodothyronine - total_triiodothyronine - cd4_cell_count - hiv_viral_load - inr - free_testosterone - total_testosterone - c_reactive_protein - prostate_specific_antigen - cotinine - c_peptide - blood_pressure - blood_glucose - weight - heart_rate - body_fat_percentage - body_mass_index - body_temperature - forced_expiratory_volume1 - forced_vital_capacity - lean_body_mass - nausea_level - oxygen_saturation - pain_level - peak_expiratory_flow_rate - peripheral_perfusion_index - respiratory_rate - inhaler_usage code: type: object required: - system - value properties: system: type: string value: type: string value: description: Can be any value (number, boolean, string, object) depending on the metric type. Most values are of type number. systolic: type: number diastolic: type: number unit: type: string occurred_at: type: string format: dateTime relationships: type: object properties: patient: type: object properties: data: type: object properties: type: type: string id: type: string description: Required if the `meta.query` is not defined. example: '5817ead56f5316c0d05ba8bf' meta: type: object description: Allows the specification of a query for a patient rather than providing a patient id directly required: - query properties: query: type: object description: The query must return one and only one patient. required: - identifier properties: groups: type: array items: type: string organization: type: string identifier: type: object required: - system - value properties: system: type: string value: type: string links: type: object example: { "data": { "type": "patient_health_metric", "attributes": { "code": { "system": "LOINC", "value": "13457-7" }, "type": "ldl_cholesterol", "occurred_at": "2017-03-14T11:00:57.000Z", "value": 121, "unit": "mg/dl" }, "relationships": { "patient": { "data": { "type": "patient", "id": "" } } } } } PatientHealthMetricCreateResource: type: object allOf: - $ref: "#/definitions/PatientHealthMetricResource" - description: | Note that `data` can either be a single object or an array of objects matching the schema specified here (bulk create). CreatePatientHealthMetricRequest: type: object required: - data properties: meta: type: object properties: ignore_duplicates: type: boolean description: | If `true`, the patient health metric will be ignored if there is an existing patient health metric for the same patient, with the same `type` and same `occurred_at`. data: $ref: '#/definitions/PatientHealthMetricCreateResource' CreatePatientHealthMetricResponse: type: object required: - data properties: meta: $ref: '#/definitions/CreateOrUpdateMetaResponse' data: $ref: '#/definitions/PatientHealthMetricResource' FetchPatientHealthMetricResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' links: $ref: '#/definitions/CollectionResponseLinks' data: type: array items: $ref: '#/definitions/PatientHealthMetricResource' # END patient_health_metric definitions # BEGIN /patient definitions PhoneNumber: type: object required: - type - value - primary properties: type: type: string enum: - home - work - mobile - home-fax - work-fax - other example: mobile value: type: string example: '555-555-1234' primary: type: boolean example: true Address: type: object properties: city: type: string example: 'Cambridge' state: type: string example: 'MA' postal_code: type: string example: '02138' lines: type: array example: - '1234 Any St.' items: type: string use: type: string type: type: string text: type: string district: type: string country: type: string PatientIdentifier: type: object required: - system - value properties: label: type: string system: type: string value: type: string unique: description: If `true`, the combination of system and value must be global unique among all patients and coaches in Fitbit Plus. type: boolean default: true ArchiveHistory: type: object properties: archived: type: boolean example: true modified_at: type: string format: dateTime example: '2016-06-03T13:15:22.000Z' reason: type: string example: 'Opted out of coaching' notes: type: string example: 'Patient called requesting opt out of coaching' PatientResource: type: object required: - type - attributes properties: id: type: string example: '57b36ef304ad8c2224f2af3a' type: type: string enum: - patient example: patient attributes: type: object properties: first_name: type: string example: Fiona last_name: type: string example: Reeves email_address: type: string example: fiona@example.com phone_numbers: type: array items: $ref: '#/definitions/PhoneNumber' addresses: type: array items: $ref: '#/definitions/Address' identifiers: type: array items: $ref: '#/definitions/PatientIdentifier' birth_date: type: string format: date example: '1944-03-06' gender: type: string enum: - male - female - other example: female note: type: string example: Relies on daughter to get around description: Coach's note about the patient. Not visible to the patient. updated_at: type: string format: dateTime example: '2016-07-11T17:13:57.027Z' readOnly: true first_access_at: type: string format: dateTime example: '2016-06-03T13:15:22.000Z' readOnly: true invited_at: type: string format: dateTime example: '2016-06-01T16:20:16.000Z' readOnly: true enrolled_at: type: string format: dateTime example: '2016-05-26T15:25:54.000Z' readOnly: true last_access_at: type: string format: dateTime example: '2016-07-11T17:50:49.400Z' readOnly: true archived: type: boolean example: true readOnly: true archive_history: type: array items: $ref: '#/definitions/ArchiveHistory' statement: description: A patient's motivation statement. type: object readOnly: true properties: value: type: string example: 'Enjoying nature.' updated_at: type: string format: dateTime example: '2016-06-03T13:15:22.000Z' updated_by: type: string example: '5c509cc2f60e34018180b57c' links: type: object readOnly: true properties: self: type: string pattern: '/patient/[0-9a-z]+' example: '/patient/57b36ef304ad8c2224f2af3a' twine_web_app: type: string example: 'https://app.plus.fitbit.com/#/coach/patient/5367c6300b7bb6e94188c02c/overview' description: 'A link to the patient record in the Fitbit Plus web application.' relationships: type: object required: - groups properties: groups: required: - data properties: data: type: array items: type: object required: - type properties: type: type: string enum: - group example: group id: type: string example: '57b3708b04ad8c2224f2af3b' coaches: required: - data properties: data: type: array items: type: object required: - type - id properties: type: type: string enum: - coach example: coach id: type: string example: '57fee2a66b49113551658505' meta: type: object properties: primary: type: boolean links: readOnly: true properties: related: type: string pattern: '/patient/[0-9a-z]+/groups' example: '/patient/57b36ef304ad8c2224f2af3a/groups' PatientCreateResource: type: object allOf: - $ref: "#/definitions/PatientResource" - description: | Note that `data` can either be a single object or an array of objects matching the schema specified here (bulk create). - properties: relationships: type: object required: - groups properties: groups: type: object required: - data properties: data: type: array items: type: object required: - type properties: type: type: string enum: - group example: group id: type: string description: Required if the `meta.query` is not defined. example: '57b3708b04ad8c2224f2af3b' meta: type: object description: Allows the specification of a query for a group rather than providing a group id directly required: - query properties: query: type: object description: | 1. If the query does not return any groups, a group with the specified name will be created and related to the patient. 2. If the query returns one group, that group will be related to the patient. 3. If the query returns more than one group, the creation of the patient will fail. required: - organization - name properties: organization: type: string name: type: string coaches: type: object required: - data properties: data: type: array items: type: object required: - type - id properties: type: type: string enum: - coach example: coach id: type: string example: '57fee2a66b49113551658505' meta: type: object properties: primary: type: boolean links: readOnly: true properties: related: type: string pattern: '/patient/[0-9a-z]+/coaches' example: '/patient/57b36ef304ad8c2224f2af3a/coaches' FetchPatientsResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' links: $ref: '#/definitions/CollectionResponseLinks' data: type: array items: $ref: '#/definitions/PatientResource' example: { "meta": { "req_id": "155c690b-50b2-4ff2-8abe-b809a8a51e53", "count": 263 }, "links": { "self": "/pub/patient?filter[groups]=5755db2a3db4179179999acf&page[number]=1&page[size]=3", "next": "/pub/patient?filter[groups]=5755db2a3db4179179999acf&page[number]=2&page[size]=3", "last": "/pub/patient?filter[groups]=5755db2a3db4179179999acf&page[number]=88&page[size]=3" }, "data": [ { "type": "patient", "id": "58163112237d84a94035f78b", "attributes": { "first_name": "Lucy", "last_name": "Bernhard", "updated_at": "2016-03-16T13:32:57.000Z", "birth_date": "1938-10-04", "addresses": [], "phone_numbers": [ { "primary": true, "value": "880-136-7979 x6183" }, { "primary": false, "value": "919.814.3552 x40123" } ], "identifiers": [ { "label": "Fitbit Plus Sample Data Filler Patient", "system": "twine-filler-patient", "value": "filler-92" } ], "archived": false, "archive_history": [], "statement": { "value": "Enjoying nature.", "updated_at": "2016-03-16T13:32:57.000Z", "updated_by": "5c509cc2f60e34018180b57c" } }, "links": { "twine_web_app": "http://10.0.1.55:9000/#/coach/admin/coaches/58163112237d84a94035f78b/profile", "self": "/pub/patient/58163112237d84a94035f78b" }, "relationships": { "groups": { "data": [ { "type": "group", "id": "5755db2a3db4179179999acf" } ], "links": { "related": "/pub/patient/58163112237d84a94035f78b/groups" } }, "coaches": { "data": [ { "type": "coach", "id": "581630c3237d84a9403533c6", "meta": { "primary": true } } ], "links": { "related": "/pub/patient/58163112237d84a94035f78b/coaches" } } } }, { "type": "patient", "id": "58163103237d84a94035f0b3", "attributes": { "first_name": "Annette", "last_name": "Parisian", "updated_at": "2016-02-04T12:55:03.000Z", "email_address": "annette.parisian@example.com", "birth_date": "1983-03-16", "addresses": [], "phone_numbers": [ { "primary": true, "value": "044.758.5704 x1965" } ], "identifiers": [ { "label": "Fitbit Plus Sample Data Filler Patient", "system": "twine-filler-patient", "value": "filler-5" } ] }, "links": { "twine_web_app": "http://10.0.1.55:9000/#/coach/admin/coaches/58163103237d84a94035f0b3/profile", "self": "/pub/patient/58163103237d84a94035f0b3" }, "relationships": { "groups": { "data": [ { "type": "group", "id": "5755db2a3db4179179999acf" } ], "links": { "related": "/pub/patient/58163103237d84a94035f0b3/groups" } }, "coaches": { "data": [ { "type": "coach", "id": "581630c3237d84a9403533c6", "meta": { "primary": true } } ], "links": { "related": "/pub/patient/58163103237d84a94035f0b3/coaches" } } } }, { "type": "patient", "id": "58163103237d84a94035f043", "attributes": { "first_name": "Lexi", "last_name": "Thompson", "updated_at": "2016-01-23T16:12:07.000Z", "email_address": "lexi.thompson@example.com", "birth_date": "1932-04-06", "addresses": [], "phone_numbers": [ { "primary": true, "value": "1-977-830-6179 x26334" } ], "identifiers": [ { "label": "Fitbit Plus Sample Data Filler Patient", "system": "twine-filler-patient", "value": "filler-3" } ] }, "links": { "twine_web_app": "http://10.0.1.55:9000/#/coach/admin/coaches/58163103237d84a94035f043/profile", "self": "/pub/patient/58163103237d84a94035f043" }, "relationships": { "groups": { "data": [ { "type": "group", "id": "5755db2a3db4179179999acf" } ], "links": { "related": "/pub/patient/58163103237d84a94035f043/groups" } }, "coaches": { "data": [ { "type": "coach", "id": "581630c3237d84a9403533c6", "meta": { "primary": true } } ], "links": { "related": "/pub/patient/58163103237d84a94035f043/coaches" } } } } ] } FetchPatientResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' data: $ref: '#/definitions/PatientResource' example: { "meta": { "req_id": "23001d51-669b-4948-b9fa-11dbffdf8ced" }, "data": { "type": "patient", "id": "58163112237d84a94035f78b", "attributes": { "first_name": "Lucy", "last_name": "Bernhard", "updated_at": "2016-03-16T13:32:57.000Z", "birth_date": "1938-10-04", "addresses": [], "phone_numbers": [ { "primary": true, "value": "880-136-7979 x6183" }, { "primary": false, "value": "919.814.3552 x40123" } ], "identifiers": [ { "label": "Fitbit Plus Sample Data Filler Patient", "system": "twine-filler-patient", "value": "filler-92" } ], "archived": false, "archive_history": [], "statement": { "value": "Enjoying nature.", "updated_at": "2016-03-16T13:32:57.000Z", "updated_by": "5c509cc2f60e34018180b57c" } }, "links": { "twine_web_app": "http://10.0.1.55:9000/#/coach/admin/coaches/58163112237d84a94035f78b/profile", "self": "/pub/patient/58163112237d84a94035f78b" }, "relationships": { "groups": { "data": [ { "type": "group", "id": "5755db2a3db4179179999acf" } ], "links": { "related": "/pub/patient/58163112237d84a94035f78b/groups" } }, "coaches": { "data": [ { "type": "coach", "id": "581630c3237d84a9403533c6", "meta": { "primary": true } } ], "links": { "related": "/pub/patient/58163112237d84a94035f78b/coaches" } } } }, "included": [] } CreatePatientRequest: type: object required: - data properties: meta: type: object properties: ignore_duplicates: description: | If `true`, patients with any conflicting identifiers (same `system` and `value`) will be ignored. Useful for gracefully skipping duplicates after errors occur during bulk create. type: boolean default: false data: $ref: '#/definitions/PatientCreateResource' example: { "data": { "type": "patient", "attributes": { "first_name": "Jack", "last_name": "Frost" }, "relationships": { "groups": { "data": [{ "type": "group", "id": "5755db2a3db4179179999acf" }] } } } } CreatePatientResponse: type: object required: - data properties: meta: $ref: '#/definitions/CreateOrUpdateMetaResponse' data: $ref: '#/definitions/PatientResource' example: { "meta": { "req_id": "5b813ad3-cabc-418f-add4-1e53bc69f7cb" }, "data": { "type": "patient", "id": "5817ead56f5316c0d05ba8bf", "attributes": { "first_name": "Jack", "last_name": "Frost", "updated_at": "2016-11-01T01:07:33.121Z", "addresses": [], "phone_numbers": [], "identifiers":[], "archived": false, "archive_history": [] }, "links": { "twine_web_app": "http://10.0.1.55:9000/#/coach/patient/5817ead56f5316c0d05ba8bf", "self": "/pub/patient/5817ead56f5316c0d05ba8bf" }, "relationships": { "groups": { "data": [{ "type": "group", "id": "5755db2a3db4179179999acf" }], "links": { "related": "/pub/patient/5817ead56f5316c0d05ba8bf/groups" } }, "coaches": { "data": [], "links": { "related":"/pub/patient/5817ead56f5316c0d05ba8bf/coaches" } } } }, "included": [] } UpdatePatientRequest: type: object required: - data properties: data: $ref: '#/definitions/PatientResource' example: { "data": { "id": "5817ead56f5316c0d05ba8bf", "type": "patient", "attributes": { "first_name": "Jonathon" } } } UpdatePatientResponse: type: object required: - data properties: meta: $ref: '#/definitions/CreateOrUpdateMetaResponse' data: $ref: '#/definitions/PatientResource' example: { "meta": { "req_id": "5b813ad3-cabc-418f-add4-1e53bc69f7cb" }, "data": { "type": "patient", "id": "5817ead56f5316c0d05ba8bf", "attributes": { "first_name": "Jack", "last_name": "Frost", "updated_at": "2016-11-01T01:07:33.121Z", "addresses": [], "phone_numbers": [], "identifiers":[], "archived": false, "archive_history": [] }, "links": { "twine_web_app": "http://10.0.1.55:9000/#/coach/patient/5817ead56f5316c0d05ba8bf", "self": "/pub/patient/5817ead56f5316c0d05ba8bf" }, "relationships": { "groups": { "data": [{ "type": "group", "id": "5755db2a3db4179179999acf" }], "links": { "related": "/pub/patient/5817ead56f5316c0d05ba8bf/groups" } }, "coaches": { "data": [], "links": { "related":"/pub/patient/5817ead56f5316c0d05ba8bf/coaches" } } } }, "included": [] } UpsertPatientRequest: type: object required: - meta - data properties: meta: type: object required: - query properties: query: type: object required: - identifier - groups properties: identifier: description: Identifier to match patient type: object properties: system: type: string description: Name of system value: type: string description: Value in system groups: description: Group to create/update patient in. type: array items: type: string description: ID of group data: $ref: "#/definitions/PatientResource" example: { "meta": { "query": { "identifier": { "system": "OtherPlace", "value": "123456" }, "groups": ["5755db2a3db4179179999acf"] } }, "data": { "type": "patient", "attributes": { "first_name": "Jack", "last_name": "Frost" }, "relationships": { "groups": { "data": [{ "type": "group", "id": "5755db2a3db4179179999acf" }] } } } } # END /patient definitions # BEGIN /patient_plan_summary definitions PatientPlanSummaryResource: type: object required: - id - type properties: id: type: string example: '57b36e3c04ad8c2224f2af38' type: type: string enum: - patient_plan_summary example: patient_plan_summary attributes: type: object properties: adherence: readOnly: true type: object critical: type: object additionalProperties: true time_zone: type: string window_order: type: array items: type: object properties: type: type: string _actions: type: array items: type: string effective_from: readOnly: true type: string format: dateTime window_notification_times: readOnly: true type: object properties: morning: type: integer afternoon: type: integer evening: type: integer night: type: integer relationships: type: object required: - actions - bundles - patient properties: actions: type: object properties: data: type: array items: type: object required: - type - id properties: type: type: string id: type: string links: type: object properties: related: type: string bundles: type: object properties: data: type: array items: type: object required: - type - id properties: type: type: string id: type: string links: type: object properties: related: type: string patient: type: object properties: data: type: object properties: type: type: string id: type: string links: type: object properties: related: type: string current_results: type: object properties: data: type: array items: type: object required: - type - id properties: type: type: string id: type: string links: type: object properties: related: type: string links: type: object readOnly: true required: - self properties: self: type: string pattern: '/patient_plan_summary/[0-9a-z]+' example: '/patient_plan_summary/57b36e3c04ad8c2224f2af38' FetchPatientPlanSummaryResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' data: $ref: '#/definitions/PatientPlanSummaryResource' included: description: | Related resources which are included in the response based on the `include` param. Attributes of each resource will vary depending on the type. See [action](#operation/fetchAction), [bundle](#operation/fetchBundle) and [patient](#operation/fetchPatient) type: array items: $ref: '#/definitions/Resource' example: { "data": { "type": "patient_plan_summary", "id": "5964f831f65725bf25558b50", "attributes": { "adherence": { "due": 0, "complete": 0, "streak": { "count": 0 } }, "critical": { "blood_glucose": { "data": { "maximum": { "unit": "mg/dL", "value": 300 }, "minimum": { "unit": "mg/dL", "value": 70 } } }, "effective_from": "2017-07-01T04:00:00.000Z" }, "window_order": [], "effective_from": "2017-07-01T04:00:00.000Z", "window_notification_times": { "morning": 25200, "afternoon": 43200, "evening": 64800, "night": 75600 } }, "links": { "self": "/patient_plan_summary/5964f831f65725bf25558b50" }, "relationships": { "bundles": { "links": { "related": "/patient_plan_summary/5964f831f65725bf25558b50/bundles" }, "data": [] }, "actions": { "links": { "related": "/patient_plan_summary/5964f831f65725bf25558b50/actions" }, "data": [ { "id": "5964f831f65725bf25558b4b", "type": "action" } ] }, "patient": { "links": { "related": "/patient_plan_summary/5964f831f65725bf25558b50/patient" }, "data": { "type": "patient", "id": "5964f831f65725bf25558b4f" } }, "current_results": { "links": { "related": "/patient_plan_summary/5964f831f65725bf25558b50/current_results" }, "data": [] } } }, "included": [ { "type": "action", "id": "5964f831f65725bf25558b4b", "attributes": { "_thread": "blood_pressure", "adherence": { "due": 0, "complete": 0, "streak": { "count": 0 } }, "effective_from": "2017-07-01T04:00:00.000Z", "frequency_goal": { "weeks": { "days": [0, 1, 2, 3, 4, 5, 6] } }, "frequency_goal_prorated": 0, "identifiers": [], "metric_required": false, "metrics": [ { "metric_type": "blood_pressure", "unit": "mmHg", "goal": { "data": { "systolic": { "value": 150, "unit": "mmHg" }, "diastolic": { "value": 95, "unit": "mmHg" } } }, "_id": "5964f831f65725bf25558b51", "accepted_values": [] } ], "title": "Record Blood Pressure", "tracking": true, "windows": [], "type": "blood_pressure", "options": [] }, "links": { "self": "/action/5964f831f65725bf25558b4b" }, "relationships": { "plan": { "links": { "related": "/action/5964f831f65725bf25558b4b/plan" } }, "bundles": { "links": { "related": "/action/5964f831f65725bf25558b4b/bundles" }, "data": [] } } } ], "meta": { "req_id": "e0e78ef5-c0fd-415b-9b9f-a1b5c77c1198" } } FetchPatientPlanSummariesResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' data: type: array items: $ref: '#/definitions/PatientPlanSummaryResource' included: description: | Related resources which are included in the response based on the `include` param. Attributes of each resource will vary depending on the type. See [action](#operation/fetchAction), [bundle](#operation/fetchBundle) and [patient](#operation/fetchPatient) type: array items: $ref: '#/definitions/Resource' UpdatePatientPlanSummaryRequest: type: object required: - data properties: data: $ref: '#/definitions/PatientPlanSummaryResource' UpdatePatientPlanSummaryResponse: type: object required: - data properties: meta: $ref: '#/definitions/CreateOrUpdateMetaResponse' data: $ref: '#/definitions/PatientPlanSummaryResource' # END /patient_plan_summary definitions # BEGIN /result defintions PatientHealthResultResource: type: object required: - type - id properties: type: type: string id: type: string attributes: type: object properties: type: type: string description: Type of result. Usually the same as metric_type except for lifestyle actions metric_type: type: string enum: - blood_pressure_systolic - blood_pressure_diastolic - hemoglobin_a1c - hdl_cholesterol - ldl_cholesterol - total_cholesterol - triglycerides - blood_urea_nitrogen - creatinine - hemoglobin - hematocrit - total_serum_iron - thyroid_stimulating_hormone - free_thyroxine - free_triiodothyronine - total_triiodothyronine - cd4_cell_count - hiv_viral_load - inr - free_testosterone - total_testosterone - c_reactive_protein - prostate_specific_antigen - cotinine - c_peptide - blood_pressure - blood_glucose - weight - heart_rate - body_fat_percentage - body_mass_index - body_temperature - forced_expiratory_volume1 - forced_vital_capacity - lean_body_mass - nausea_level - oxygen_saturation - pain_level - peak_expiratory_flow_rate - peripheral_perfusion_index - respiratory_rate - inhaler_usage annotations: type: array items: type: object properties: text: type: string title: type: string skipped: type: boolean occurred_at: type: string format: dateTime example: '2018-09-18T12:24:37.000Z' occurred_at_time_zone: type: string example: 'America/New_York' window: type: string data: type: object properties: value: description: Can be any value (number, boolean, string, object) depending on the metric type. Most values are of type number _thread: type: string description: Links together results. This should be the same as the thread of _action, if it is defined channel: type: string external_id: type: string source: type: object properties: source_id: type: string name: type: string metadata: description: Can be any value aggregation: type: string relationships: type: object properties: patient: type: object properties: data: type: object properties: type: type: string id: type: string description: Required if the `meta.query` is not defined. example: '5c0fc0d02d02421ed70ca1d1' meta: type: object description: Allows the specification of a query for a patient rather than providing a patient id directly required: - query properties: query: type: object description: The query must return one and only one patient. required: - identifier properties: groups: type: array items: type: string organization: type: string identifier: type: object required: - system - value properties: system: type: string value: type: string links: type: object action: type: object properties: data: type: object properties: type: type: string id: type: string links: type: object metric: type: object properties: data: type: object properties: type: type: string id: type: string links: type: object example: { "data": { "type": "result", "id": "5c0fc0d42d02421ed70cae16", "attributes": { "type": "medication", "annotations": [], "occurred_at": "2018-09-18T12:24:37.000Z", "occurred_at_time_zone": "America/New_York", "window": "5c0fc0d42d02421ed70cae01", "data": { "value": 1 }, "_thread": "569c631f4b378f51306324f2d69fd29aa0c034ac", "source": {}, "created_at": "2018-09-18T12:24:37.000Z", "created_by": "5c0fc0d02d02421ed70ca1d1", "updated_at": "2018-09-18T12:24:37.000Z", "updated_by": "5c0fc0d02d02421ed70ca1d1" }, "relationships": { "action": { "data": { "type": "action", "id": "5ada648779672451a6c1b095" } }, "patient": { "data": { "type": "patient", "id": "5c0fc0d02d02421ed70ca1d1" } }, "metric": { "data": { "type": "patient_health_metric", "id": "5c0fc0d42d02421ed70cae16" } } } } } FetchPatientHealthResultResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' links: $ref: '#/definitions/CollectionResponseLinks' data: type: array items: $ref: '#/definitions/PatientHealthResultResource' # END /result definitions # BEGIN /reward_program_activation defintions RewardProgramActivationResource: type: object required: - type properties: type: type: string id: type: string attributes: type: object required: - activated_at properties: active: description: 'If true, the reward program is currently active.' type: boolean default: true activated_at: description: 'Date at which the reward program was activated for the patient. (Must be between the start_at and end_at dates for the reward program)' type: string format: dateTime deactivated_at: description: 'Date at which the reward program was deactivated. (Must be after the activated_at date)' type: string format: dateTime expires_at: description: 'Date at which the reward program activation expires. (Read-only property set by adding the days_active from the reward program to the activated_at date)' type: string format: dateTime readOnly: true fulfill_as_earned: description: 'If true, the rewards created for a patient for the program can be fulfulled as they are earned. If false, the rewards should only be fulfilled when the program is deactivated. (Read-only property denormalized from the reward program)' type: boolean readOnly: true allocated_count: description: 'Number of rewards allocated. (Read-only property)' type: number readOnly: true total_allocated_value: description: 'Total value of reward allocated. (Read-only property)' type: number readOnly: true earned_count: description: 'Number of reward earnings. (Read-only property)' type: number readOnly: true total_earned_value: description: 'Total value of reward earnings. (Read-only property)' type: number readOnly: true budget_unit: description: 'Unit of the reward program budget. (Read-only property)' type: string readOnly: true relationships: type: object required: - patient - reward_program properties: patient: type: object properties: data: type: object properties: type: type: string id: type: string reward_program: type: object properties: data: type: object properties: type: type: string id: type: string FetchRewardProgramActivationResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' data: $ref: '#/definitions/RewardProgramActivationResource' FetchRewardProgramActivationsResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' data: type: array items: $ref: '#/definitions/RewardProgramActivationResource' CreateRewardProgramActivationRequest: type: object required: - data properties: data: $ref: '#/definitions/RewardProgramActivationResource' CreateRewardProgramActivationResponse: type: object required: - data properties: meta: $ref: '#/definitions/CreateOrUpdateMetaResponse' data: $ref: '#/definitions/RewardProgramActivationResource' # END /reward_program_activation defintions # BEGIN /reward definitions RewardResource: type: object required: - type properties: type: type: string id: type: string attributes: type: object required: - description - allocated_value - allocated_at properties: _thread: description: 'Unique string identifying the health action with which the reward is associated.' type: string description: description: 'Description of the reward.' type: string allocated_value: description: 'Value of the reward program budget allocated for the reward. (Must not exceed the remaining budget for the reward program activation)' type: number allocated_unit: description: 'Unit of the reward program. (Read-only property)' type: string readOnly: true allocated_at: description: 'Date at which the reward was allocated. (Must be after the reward program is activated and before it is deactivated or expires)' type: string format: dateTime target_at: description: 'Date at which the patient aspires to achieve the reward. (Must be the same or after the allocated_at date)' type: string format: dateTime earned_value: description: 'Value of the reward that has been earned. (Read-only property)' type: number readOnly: true earned_at: description: 'Date at which the reward was earned. (Read-only property)' type: string format: dateTime readOnly: true fulfilled_value: description: 'Value of the earned reward that has been fulfilled. (Read-only property)' type: number readOnly: true fulfilled_at: description: 'Date at which the reward earning was fulfilled. (Read-only property)' type: string format: dateTime readOnly: true relationships: type: object required: - reward_program_activation properties: patient: type: object readOnly: true properties: data: type: object properties: type: type: string id: type: string reward_program_activation: type: object properties: data: type: object properties: type: type: string id: type: string FetchRewardResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' data: $ref: '#/definitions/RewardResource' FetchRewardsResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' data: type: array items: $ref: '#/definitions/RewardResource' CreateRewardRequest: type: object required: - data properties: data: $ref: '#/definitions/RewardResource' CreateRewardResponse: type: object required: - data properties: meta: $ref: '#/definitions/CreateOrUpdateMetaResponse' data: $ref: '#/definitions/RewardResource' # END /reward definitions # BEGIN /reward_earning definitions RewardEarningResource: type: object required: - type properties: type: type: string id: type: string attributes: type: object required: - earned_value - earned_at properties: earned_value: description: 'Value of the reward that has been earned. (Must not exceed the allocated value for the reward)' type: number earned_unit: description: 'Unit of the reward that has been earned. (Read-only property)' type: string readOnly: true earned_at: description: 'Date at which the reward was earned. (Must be after the reward was allocated and before the reward program activation was deactivated or expired)' type: string format: dateTime ready_for_fulfillment: description: 'If true, the reward earning is ready to be fulfilled, either because the reward program activation was fulfill_as_earned or because the reward program activation has been deactivated. (Read-only property)' type: boolean readOnly: true fulfilled_value: description: 'Value of the earned reward that has been fulfilled. (Read-only property)' type: number readOnly: true fulfilled_at: description: 'Date at which the reward earning was fulfilled. (Read-only property)' type: string format: dateTime readOnly: true relationships: type: object required: - reward properties: group: type: object readOnly: true properties: data: type: object properties: type: type: string id: type: string patient: type: object readOnly: true properties: data: type: object properties: type: type: string id: type: string reward_program_activation: type: object readOnly: true properties: data: type: object properties: type: type: string id: type: string reward: type: object properties: data: type: object properties: type: type: string id: type: string FetchRewardEarningResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' data: $ref: '#/definitions/RewardEarningResource' FetchRewardEarningsResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' data: type: array items: $ref: '#/definitions/RewardEarningResource' CreateRewardEarningRequest: type: object required: - data properties: data: $ref: '#/definitions/RewardEarningResource' CreateRewardEarningResponse: type: object required: - data properties: meta: $ref: '#/definitions/CreateOrUpdateMetaResponse' data: $ref: '#/definitions/RewardEarningResource' RewardEarningFulfillmentResource: type: object required: - type properties: type: type: string id: type: string attributes: type: object required: - fulfilled_value - fulfilled_at properties: fulfilled_value: description: 'Value of the earned reward that has been fulfilled. (Must be greater than or equal to 0)' type: number fulfilled_unit: description: 'Unit of the earned reward that has been fulfilled. (Read-only property)' type: string readOnly: true fulfilled_at: description: 'Date at which the reward earning was fulfilled. (Must be at the same time or after the reward was earned)' type: string format: dateTime relationships: type: object required: - reward_earning properties: patient: type: object readOnly: true properties: data: type: object properties: type: type: string id: type: string reward_earning: type: object properties: data: type: object properties: type: type: string id: type: string # END /reward_earning definitions # BEGIN /reward_earning_fulfillment definitions FetchRewardEarningFulfillmentResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' data: $ref: '#/definitions/RewardEarningFulfillmentResource' FetchRewardEarningFulfillmentsResponse: type: object required: - data properties: meta: $ref: '#/definitions/FetchMetaResponse' data: type: array items: $ref: '#/definitions/RewardEarningFulfillmentResource' CreateRewardEarningFulfillmentRequest: type: object required: - data properties: data: $ref: '#/definitions/RewardEarningFulfillmentResource' CreateRewardEarningFulfillmentResponse: type: object required: - data properties: meta: $ref: '#/definitions/CreateOrUpdateMetaResponse' data: $ref: '#/definitions/RewardEarningFulfillmentResource' # END reward_earning_fulfillment definitions