{
  "swagger": "2.0",
  "info": {
    "contact": {
      "email": "info@ehealth.fgov.be",
      "name": "eHealth Platform Belgium"
    },
    "title": "API eHealth Link",
    "version": "v1.1"
  },
  "host": "api.ehealth.fgov.be",
  "basePath": "/links/v1",
  "schemes": [
    "https"
  ],
  "paths": {
    "/careLinks": {
      "delete": {
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "description": "Id of the patient (SSIN)",
            "in": "query",
            "name": "patientSsin",
            "required": true,
            "type": "string"
          },
          {
            "description": "Id of the healthcare party",
            "in": "query",
            "name": "hcPartyId",
            "required": true,
            "type": "string"
          },
          {
            "description": "Type of the Id of the healthcare party (ssin, nihii, cbe, ehp)",
            "in": "query",
            "name": "hcPartyIdType",
            "required": true,
            "type": "string"
          },
          {
            "description": "Flags that this request is intended to delete care link which will be active in the future.",
            "in": "query",
            "name": "deleteFuture",
            "type": "boolean"
          },
          {
            "description": "Type of care link. The allowed values are: careinstitutionremotecontact, careinstitutiondaycare, careinstitutionstay or carerelation.",
            "in": "query",
            "name": "linkType",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "204": {
            "description": "Care link successfully revoked"
          },
          "400": {
            "description": "Validation error",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          },
          "404": {
            "description": "Resource not found",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          },
          "500": {
            "description": "Internal server error",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          }
        },
        "security": [
          {
            "OAuth2": [
              "manage-carelink-orgnocot",
              "manage-carelink-orgcot"
            ]
          },
          {
            "OAuth2-m2m": [
              "manage-carelink-orgnocot",
              "manage-carelink-orgcot"
            ]
          }
        ],
        "tags": [
          "care link"
        ],
        "description": "Revokes a care link",
        "operationId": "deleteCareLink",
        "x-oauth2-required-scopes": "any"
      },
      "get": {
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "description": "Id of the patient (INSS)",
            "in": "query",
            "name": "patientSsin",
            "type": "string"
          },
          {
            "description": "Id of the healthcare party",
            "in": "query",
            "name": "hcPartyId",
            "type": "string"
          },
          {
            "description": "Type of the Id of the healthcare party (ssin, nihii, cbe, ehp)",
            "in": "query",
            "name": "hcPartyIdType",
            "type": "string"
          },
          {
            "description": "To obtain inactive care links whose validity period is in the future, set this parameter to true. The includeFuture element is by default set to false to get only the active care links.",
            "in": "query",
            "name": "includeFuture",
            "type": "boolean"
          },
          {
            "collectionFormat": "multi",
            "description": "Type of care link. The allowed values are: careinstitutionremotecontact, careinstitutiondaycare, careinstitutionstay or carerelation.",
            "in": "query",
            "items": {
              "type": "string"
            },
            "name": "linkType",
            "type": "array"
          }
        ],
        "responses": {
          "200": {
            "description": "Care link(s) found",
            "schema": {
              "items": {
                "$ref": "#/definitions/link"
              },
              "type": "array"
            }
          },
          "204": {
            "description": "No care link found for the specified arguments"
          },
          "400": {
            "description": "Validation error",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          },
          "404": {
            "description": "Resource not found",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          },
          "500": {
            "description": "Internal server error",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          }
        },
        "security": [
          {
            "OAuth2": [
              "consult-carelink-orgnocot",
              "consult-carelink-orgcot",
              "consult-carelink-superuser"
            ]
          },
          {
            "OAuth2-m2m": [
              "consult-carelink-orgnocot",
              "consult-carelink-orgcot",
              "consult-carelink-superuser"
            ]
          }
        ],
        "tags": [
          "care link"
        ],
        "description": "Gets the list of care links matching the provided arguments",
        "operationId": "getCareLink",
        "x-oauth2-required-scopes": "any"
      },
      "post": {
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "description": "Care link data",
            "in": "body",
            "name": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/link"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Care link successfuly extended",
            "schema": {
              "example": {
                "result": "Care link successfuly extended"
              },
              "type": "object"
            }
          },
          "201": {
            "description": "Care link successfuly created",
            "schema": {
              "example": {
                "result": "Care link successfuly created"
              },
              "type": "object"
            }
          },
          "400": {
            "description": "Validation error",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          },
          "409": {
            "description": "Care link already exists",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          },
          "500": {
            "description": "Internal server error",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          }
        },
        "security": [
          {
            "OAuth2": [
              "manage-carelink-orgnocot",
              "manage-carelink-orgcot"
            ]
          },
          {
            "OAuth2-m2m": [
              "manage-carelink-orgnocot",
              "manage-carelink-orgcot"
            ]
          }
        ],
        "tags": [
          "care link"
        ],
        "description": "Creates a care link. The proof element is mandatory for professionals and the proof type allowed values are: eidreading, eidencoding_nocard, eidencoding_housecall, eidencoding_techproblem, contract, phone_call and isireading.",
        "operationId": "createCareLink",
        "x-codegen-request-body-name": "carelink",
        "x-oauth2-required-scopes": "any"
      }
    },
    "/careLinks/existences": {
      "get": {
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "description": "Id of the patient (INSS)",
            "in": "query",
            "name": "patientSsin",
            "required": true,
            "type": "string"
          },
          {
            "description": "Id of the healthcare party",
            "in": "query",
            "name": "hcPartyId",
            "required": true,
            "type": "string"
          },
          {
            "description": "Type of the Id of the healthcare party (ssin, nihii, cbe, ehp)",
            "in": "query",
            "name": "hcPartyIdType",
            "required": true,
            "type": "string"
          },
          {
            "collectionFormat": "multi",
            "description": "Type of care link. The allowed values are: careinstitutionremotecontact, careinstitutiondaycare, careinstitutionstay or carerelation.",
            "in": "query",
            "items": {
              "type": "string"
            },
            "name": "linkType",
            "type": "array"
          }
        ],
        "responses": {
          "200": {
            "description": "There is at least one care link matching the provided arguments.",
            "schema": {
              "example": {
                "result": "Matching Carelink(s) found."
              },
              "type": "object"
            }
          },
          "204": {
            "description": "No care link matching the provided arguments"
          },
          "400": {
            "description": "Validation error on the request",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          },
          "404": {
            "description": "Resource not found",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          },
          "500": {
            "description": "Internal server error",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          }
        },
        "security": [
          {
            "OAuth2": [
              "consult-carelink-orgnocot",
              "consult-carelink-orgcot",
              "consult-carelink-superuser",
              "verify-carelink"
            ]
          },
          {
            "OAuth2-m2m": [
              "consult-carelink-orgnocot",
              "consult-carelink-orgcot",
              "consult-carelink-superuser",
              "verify-carelink"
            ]
          }
        ],
        "tags": [
          "care link"
        ],
        "description": "Checks the existence of a care link",
        "operationId": "hasCareLink",
        "x-oauth2-required-scopes": "any"
      }
    },
    "/careLinks/health": {
      "get": {
        "produces": [
          "application/json"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Service is UP",
            "schema": {
              "$ref": "#/definitions/HealthStatus"
            }
          },
          "403": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          },
          "503": {
            "description": "The service is DOWN or OUT_OF_SERVICE",
            "examples": {
              "application/json": {
                "details": {
                  "datastore": {
                    "status": "OUT_OF_SERVICE"
                  }
                },
                "status": "DOWN"
              }
            },
            "schema": {
              "$ref": "#/definitions/HealthStatus"
            }
          }
        },
        "security": [
          {
            "OAuth2-m2m": [
              "monitoring"
            ]
          }
        ],
        "tags": [
          "Monitoring Link"
        ],
        "description": "Get the monitoring status of the service Care Link",
        "operationId": "getMonitoringInfoCareLinks"
      }
    },
    "/careLinks/histories": {
      "get": {
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "description": "Id of the patient (INSS)",
            "in": "query",
            "name": "patientSsin",
            "type": "string"
          },
          {
            "description": "Id of the healthcare party",
            "in": "query",
            "name": "hcPartyId",
            "type": "string"
          },
          {
            "description": "Type of the Id of the healthcare party (ssin, nihii, cbe, ehp)",
            "in": "query",
            "name": "hcPartyIdType",
            "type": "string"
          },
          {
            "collectionFormat": "multi",
            "description": "Type of care link. The allowed values are: careinstitutionremotecontact, careinstitutiondaycare, careinstitutionstay or carerelation.",
            "in": "query",
            "items": {
              "type": "string"
            },
            "name": "linkType",
            "type": "array"
          }
        ],
        "responses": {
          "200": {
            "description": "Care link(s) found",
            "schema": {
              "items": {
                "$ref": "#/definitions/link"
              },
              "type": "array"
            }
          },
          "204": {
            "description": "No care link matching the provided arguments"
          },
          "400": {
            "description": "Validation error",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          },
          "404": {
            "description": "Resource not found",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          },
          "500": {
            "description": "Internal server error",
            "schema": {
              "items": {
                "$ref": "#/definitions/error"
              },
              "type": "array"
            }
          }
        },
        "security": [
          {
            "OAuth2": [
              "consult-carelink-orgnocot",
              "consult-carelink-orgcot",
              "consult-carelink-superuser"
            ]
          },
          {
            "OAuth2-m2m": [
              "consult-carelink-orgnocot",
              "consult-carelink-orgcot",
              "consult-carelink-superuser"
            ]
          }
        ],
        "tags": [
          "care link"
        ],
        "description": "Gets inactive care links in the past matching the provided arguments",
        "operationId": "getCareLinkHistory",
        "x-oauth2-required-scopes": "any"
      }
    }
  },
  "definitions": {
    "ComponentStatus": {
      "example": {
        "name": "name",
        "status": "status"
      },
      "properties": {
        "name": {
          "type": "string"
        },
        "status": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "HealthLevel": {
      "type": "string"
    },
    "HealthStatus": {
      "example": {
        "details": [
          {
            "name": "name",
            "status": "status"
          },
          {
            "name": "name",
            "status": "status"
          }
        ],
        "status": "status"
      },
      "properties": {
        "details": {
          "items": {
            "$ref": "#/definitions/ComponentStatus"
          },
          "type": "array"
        },
        "status": {
          "type": "string"
        }
      },
      "required": [
        "status"
      ],
      "type": "object"
    },
    "error": {
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object"
    },
    "hcParty": {
      "example": {
        "firstName": "firstName",
        "identifiers": [
          {
            "type": "type",
            "value": "value"
          },
          {
            "type": "type",
            "value": "value"
          }
        ],
        "name": "name",
        "qualificationCode": "qualificationCode"
      },
      "properties": {
        "firstName": {
          "type": "string"
        },
        "identifiers": {
          "items": {
            "$ref": "#/definitions/identifier"
          },
          "minItems": 1,
          "type": "array"
        },
        "name": {
          "type": "string"
        },
        "qualificationCode": {
          "type": "string"
        }
      },
      "required": [
        "identifiers"
      ],
      "type": "object"
    },
    "identifier": {
      "example": {
        "type": "type",
        "value": "value"
      },
      "properties": {
        "type": {
          "type": "string"
        },
        "value": {
          "type": "string"
        }
      },
      "required": [
        "type",
        "value"
      ],
      "type": "object"
    },
    "link": {
      "example": {
        "endDate": "2000-01-23",
        "hcParty": {
          "firstName": "firstName",
          "identifiers": [
            {
              "type": "type",
              "value": "value"
            },
            {
              "type": "type",
              "value": "value"
            }
          ],
          "name": "name",
          "qualificationCode": "qualificationCode"
        },
        "patient": {
          "firstName": "firstName",
          "identifiers": [
            {
              "type": "type",
              "value": "value"
            },
            {
              "type": "type",
              "value": "value"
            }
          ],
          "name": "name"
        },
        "proof": {
          "type": "type"
        },
        "startDate": "2000-01-23",
        "type": "type"
      },
      "properties": {
        "endDate": {
          "format": "date",
          "type": "string"
        },
        "hcParty": {
          "$ref": "#/definitions/hcParty"
        },
        "patient": {
          "$ref": "#/definitions/patient"
        },
        "proof": {
          "$ref": "#/definitions/proof"
        },
        "startDate": {
          "format": "date",
          "type": "string"
        },
        "type": {
          "type": "string"
        }
      },
      "required": [
        "hcParty",
        "patient",
        "type"
      ],
      "type": "object"
    },
    "patient": {
      "example": {
        "firstName": "firstName",
        "identifiers": [
          {
            "type": "type",
            "value": "value"
          },
          {
            "type": "type",
            "value": "value"
          }
        ],
        "name": "name"
      },
      "properties": {
        "firstName": {
          "type": "string"
        },
        "identifiers": {
          "items": {
            "$ref": "#/definitions/identifier"
          },
          "minItems": 1,
          "type": "array"
        },
        "name": {
          "type": "string"
        }
      },
      "required": [
        "identifiers"
      ],
      "type": "object"
    },
    "proof": {
      "example": {
        "type": "type"
      },
      "properties": {
        "type": {
          "type": "string"
        }
      },
      "required": [
        "type"
      ],
      "type": "object"
    }
  },
  "securityDefinitions": {
    "OAuth2": {
      "authorizationUrl": "https://api.ehealth.fgov.be/auth/realms/YourRealm/protocol/openid-connect/auth",
      "flow": "accessCode",
      "scopes": {
        "consult-carelink-orgcot": "Allows GET operation on Care Link service with restrictions for a COT organization",
        "consult-carelink-orgnocot": "Allows GET operation on Care Link service with restrictions for a non-COT organization",
        "consult-carelink-superuser": "Allows GET operation on Care Link service without restriction",
        "manage-carelink-orgcot": "Allows POST and DELETE operations on Care Link service for a COT organization",
        "manage-carelink-orgnocot": "Allows POST and DELETE operations on Care Link service for a non-COT organization",
        "verify-carelink": "Allows GET operation to check the existence of a carelink without restrition"
      },
      "tokenUrl": "https://api.ehealth.fgov.be/auth/realms/YourRealm/protocol/openid-connect/token",
      "type": "oauth2"
    },
    "OAuth2-m2m": {
      "flow": "application",
      "scopes": {
        "consult-carelink-orgcot": "Allows GET operation on Care Link service with restrictions for a COT organization",
        "consult-carelink-orgnocot": "Allows GET operation on Care Link service with restrictions for a non-COT organization",
        "consult-carelink-superuser": "Allows GET operation on Care Link service without restriction",
        "manage-carelink-orgcot": "Allows POST and DELETE operations on Care Link service for a COT organization",
        "manage-carelink-orgnocot": "Allows POST and DELETE operations on Care Link service for a non-COT organization",
        "monitoring": "Allow monitoring, note that this is an internal scope only, it's not usable by the external world",
        "verify-carelink": "Allows GET operation to check the existence of a carelink without restrition"
      },
      "tokenUrl": "https://api.ehealth.fgov.be/auth/realms/YourRealm/protocol/openid-connect/token",
      "type": "oauth2"
    }
  },
  "x-components": {}
}
