{
  "components": {
    "examples": {
      "standard-error-400": {
        "description": "The request body or parameters are invalid.",
        "summary": "Bad Request",
        "value": {
          "errors": [],
          "localizedMessage": "Invalid request",
          "message": "Invalid request",
          "status": "BAD_REQUEST",
          "statusCode": 400
        }
      },
      "standard-error-401": {
        "description": "The credentials are missing or invalid, the calling IP is not on the client's allowlist, or mTLS is enforced and no valid client certificate was sent. An expired session token gets 401 Token expired.",
        "summary": "Unauthorized",
        "value": {
          "errors": [],
          "localizedMessage": "Authentication failed",
          "message": "Authentication failed",
          "status": "UNAUTHORIZED",
          "statusCode": 401
        }
      },
      "standard-error-403": {
        "description": "The client is not allowed to use this endpoint or resource.",
        "summary": "Forbidden",
        "value": {
          "errors": [],
          "localizedMessage": "Not allowed",
          "message": "Not allowed",
          "status": "FORBIDDEN",
          "statusCode": 403
        }
      },
      "standard-error-404": {
        "description": "The requested resource does not exist or has expired.",
        "summary": "Not Found",
        "value": {
          "errors": [],
          "localizedMessage": "Not found",
          "message": "Not found",
          "status": "NOT_FOUND",
          "statusCode": 404
        }
      },
      "standard-error-429": {
        "description": "The client has sent too many requests in a given time window. Retry after a delay using exponential backoff.",
        "summary": "Rate limit exceeded",
        "value": {
          "errors": [],
          "localizedMessage": "Too many requests. Please retry with backoff.",
          "message": "Too many requests. Please retry with backoff.",
          "status": "TOO_MANY_REQUESTS",
          "statusCode": 429
        }
      }
    },
    "schemas": {
      "Agent": {
        "properties": {
          "email": {
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          }
        }
      },
      "CancellationDeliveryStatusResponse": {
        "discriminator": {
          "propertyName": "api"
        },
        "properties": {
          "deliveryStatus": {
            "description": "Indicates current delivery state at Scrive",
            "enum": [
              "UNKNOWN",
              "FAILED",
              "DELIVERED",
              "DEFERRED"
            ],
            "example": "DELIVERED",
            "type": "string"
          }
        }
      },
      "CancellationRequest": {
        "discriminator": {
          "propertyName": "api"
        },
        "properties": {
          "externalId": {
            "description": "The Insurely id of the insurance to cancel.",
            "example": "0462c48b-ecd3-48fb-8438-6c0c6f840021",
            "minLength": 1,
            "type": "string"
          },
          "newInsuranceNumber": {
            "description": "Optionally store insurance number of new insurance if known.",
            "example": "ABC12345",
            "type": "string"
          },
          "terminationDate": {
            "description": "Optionally override the insurance termination date.",
            "example": "2022-12-03",
            "format": "date",
            "type": "string"
          }
        },
        "required": [
          "externalId"
        ]
      },
      "CancellationResponse": {
        "discriminator": {
          "propertyName": "api"
        },
        "properties": {
          "collectionId": {
            "description": "The id of the collection request from which the insurance info was fetched.",
            "example": "f586d209-6d15-490a-b3bc-91c9ca308cac",
            "type": "string"
          },
          "documentId": {
            "description": "The id of the cancellation document (power of attorney) used for signing.",
            "example": "062817ba-2084-40e9-b20f-a5833b5cc464",
            "type": "string"
          },
          "externalId": {
            "description": "The internally assigned insurance id.",
            "example": "c9283b9d-949b-4142-aa4a-72aff26c21b8",
            "type": "string"
          }
        }
      },
      "CancellationStatusResponse": {
        "discriminator": {
          "propertyName": "api"
        },
        "properties": {
          "agent": {
            "$ref": "#/components/schemas/Agent"
          },
          "createdAt": {
            "description": "UTC timestamp of when the cancellation was created.",
            "example": "2007-12-03T10:15:30",
            "format": "date-time",
            "type": "string"
          },
          "documentType": {
            "enum": [
              "SCRIVE",
              "MANUAL"
            ],
            "type": "string"
          },
          "documentUrl": {
            "description": "URL to Scrive for signing document, only present for API delivery method.",
            "example": "https://api-testbed.scrive.com/s/8222115557666666666/4435666/bbfb56f666668c15",
            "type": "string"
          },
          "email": {
            "description": "The email address of the insurance holder. Only present if delivery method is email.",
            "example": "insurance.holder-smith@wellinsured.com",
            "type": "string"
          },
          "id": {
            "description": "The cancellation ID.",
            "example": "8037744b-ef4e-48b9-8a95-957ef94c4e34",
            "type": "string"
          },
          "insurance": {
            "$ref": "#/components/schemas/Insurance",
            "deprecated": true,
            "description": "The cancelled insurance"
          },
          "insurances": {
            "description": "The cancelled insurances",
            "items": {
              "$ref": "#/components/schemas/Insurance"
            },
            "type": "array"
          },
          "isSignedAndSealed": {
            "description": "Whether or not the insurance holder has signed the power of attorney.",
            "example": true,
            "type": "boolean"
          },
          "newInsuranceNumber": {
            "deprecated": true,
            "description": "Insurance number of new insurance after this one is cancelled",
            "example": "ABC12345",
            "type": "string"
          },
          "phoneNumber": {
            "description": "The phone number of the insurance holder. Only present if delivery method is SMS.",
            "example": "+46701234567",
            "type": "string"
          },
          "status": {
            "description": "The status of the signing document.",
            "enum": [
              "PREPARATION",
              "CREATED",
              "PENDING",
              "CLOSED",
              "CANCELED",
              "TIMED_OUT",
              "REJECTED",
              "DOCUMENT_ERROR"
            ],
            "example": "CLOSED",
            "type": "string"
          },
          "terminationDate": {
            "deprecated": true,
            "description": "Date of insurance termination/expiry",
            "example": "2025-01-30",
            "format": "date",
            "type": "string"
          },
          "updatedAt": {
            "description": "UTC timestamp of when the cancellation was last updated.",
            "example": "2007-12-04T15:15:30",
            "format": "date-time",
            "type": "string"
          }
        }
      },
      "CancellationsRequest": {
        "discriminator": {
          "propertyName": "api"
        },
        "properties": {
          "authenticationMethod": {
            "description": "The authentication method used by the insurance holder to sign the power of attorney. Also used for viewing document if not specified separately. Required for Scrive cancellations",
            "enum": [
              "BANK_ID",
              "STANDARD"
            ],
            "example": "BANK_ID",
            "type": "string"
          },
          "authorEmail": {
            "$ref": "#/components/schemas/Email",
            "description": "The email address of the cancellation author."
          },
          "collectionId": {
            "description": "The id of the collection in which the insurances were fetched.",
            "example": "08a7c9b2-77a0-462f-907d-461a94158872",
            "minLength": 1,
            "type": "string"
          },
          "deliveryMethod": {
            "description": "The method used to deliver the power of attorney to the insurance holder. Required for Scrive cancellations",
            "enum": [
              "EMAIL",
              "SMS",
              "API"
            ],
            "example": "SMS",
            "type": "string"
          },
          "documentType": {
            "description": "The type of cancellation that should be used. E.g. SCRIVE or MANUAL.",
            "enum": [
              "SCRIVE",
              "MANUAL"
            ],
            "example": "SCRIVE",
            "type": "string"
          },
          "email": {
            "$ref": "#/components/schemas/Email",
            "description": "The email address of the insurance holder. Only required if deliveryMethod is email."
          },
          "insuranceHolderName": {
            "description": "Optionally supply the insurance holder full name to use for the cancellation.",
            "example": "Astrid Svensson",
            "type": "string"
          },
          "insurances": {
            "description": "The insurances to create cancellations for.",
            "items": {
              "$ref": "#/components/schemas/CancellationRequest"
            },
            "maxItems": 50,
            "minItems": 1,
            "type": "array"
          },
          "personalNumber": {
            "description": "Optionally assign personal number unless present on collected insurance.",
            "example": "198312151234",
            "type": "string"
          },
          "phoneNumber": {
            "$ref": "#/components/schemas/PhoneNumber",
            "description": "The phone number of the insurance holder. Only required if deliveryMethod is SMS."
          },
          "rejectedRedirectUrl": {
            "description": "Scrive redirects customer here if customer rejects document.",
            "example": "https://www.your-site.com/customer-rejected-document",
            "type": "string"
          },
          "signSuccessRedirectUrl": {
            "description": "Scrive redirects customer here after signing document.",
            "example": "https://www.your-site.com/customer-signed-document",
            "type": "string"
          },
          "tags": {
            "description": "Tags added to the Scrive document",
            "items": {
              "$ref": "#/components/schemas/Tag"
            },
            "type": "array"
          },
          "viewAuthenticationMethod": {
            "description": "The authentication method used by the insurance holder to view the power of attorney. Default value is same as authenticationMethod.",
            "enum": [
              "BANK_ID",
              "STANDARD"
            ],
            "example": "BANK_ID",
            "type": "string"
          }
        },
        "required": [
          "authenticationMethod",
          "authorEmail",
          "collectionId",
          "deliveryMethod",
          "insurances"
        ]
      },
      "CancellationsResponse": {
        "discriminator": {
          "propertyName": "api"
        },
        "properties": {
          "cancelledInsurances": {
            "description": "A list of the insurance information for the processed cancellations.",
            "items": {
              "$ref": "#/components/schemas/CancellationResponse"
            },
            "type": "array"
          }
        }
      },
      "CancellationsStatusResponse": {
        "discriminator": {
          "propertyName": "api"
        },
        "properties": {
          "cancellations": {
            "description": "A list of the cancellation statuses.",
            "example": "cancellations",
            "items": {
              "$ref": "#/components/schemas/CancellationStatusResponse"
            },
            "type": "array"
          },
          "pagingMetadata": {
            "$ref": "#/components/schemas/PagingMetadata",
            "description": "Metadata describing the paging information.",
            "example": "pagingMetadata"
          },
          "sortingMetadata": {
            "$ref": "#/components/schemas/SortingMetadataCancellationsSortOrder",
            "description": "Metadata describing the request sort order.",
            "example": "sortingMetadata"
          }
        }
      },
      "Email": {
        "discriminator": {
          "propertyName": "api"
        },
        "properties": {
          "value": {
            "description": "The full email address",
            "example": "insurance.admin@insurely.com",
            "type": "string"
          }
        }
      },
      "ErrorResponse": {
        "description": "Standard error response returned by the API when a request fails.",
        "properties": {
          "errors": {
            "description": "Field-level validation errors, empty when not applicable.",
            "items": {
              "$ref": "#/components/schemas/InsurelyInputError"
            },
            "type": "array"
          },
          "localizedMessage": {
            "description": "Localized version of the error message, if available.",
            "example": "Invalid request",
            "type": "string"
          },
          "message": {
            "description": "Human-readable error message.",
            "example": "Invalid request",
            "type": "string"
          },
          "status": {
            "description": "HTTP status name.",
            "example": "BAD_REQUEST",
            "type": "string"
          },
          "statusCode": {
            "description": "HTTP status code.",
            "example": 400,
            "format": "int32",
            "type": "integer"
          }
        }
      },
      "Insurance": {
        "properties": {
          "collectionId": {
            "description": "The collection ID.",
            "example": "af62de15-e241-4644-b8f6-01141e8c7509",
            "type": "string"
          },
          "externalId": {
            "description": "The insurance ID within the collection.",
            "example": "30e7901f-7243-4be5-b353-21e6be322a32",
            "type": "string"
          },
          "insuranceCompany": {
            "description": "Company the insurance was collected from",
            "example": "se-demo",
            "type": "string"
          },
          "newInsuranceNumber": {
            "description": "Insurance number of new insurance after this one is cancelled",
            "example": "ABC12345",
            "type": "string"
          },
          "terminationDate": {
            "description": "Date of insurance termination/expiry",
            "example": "2025-01-30",
            "format": "date",
            "type": "string"
          }
        }
      },
      "InsurelyInputError": {
        "description": "Field-level validation errors, empty when not applicable."
      },
      "PagingMetadata": {
        "discriminator": {
          "propertyName": "api"
        },
        "properties": {
          "next": {
            "description": "Link to the next page.",
            "type": "string"
          },
          "pageSize": {
            "description": "The current page size.",
            "example": 50,
            "format": "int32",
            "type": "integer"
          },
          "previous": {
            "description": "Link to the previous page.",
            "type": "string"
          }
        }
      },
      "PhoneNumber": {
        "discriminator": {
          "propertyName": "api"
        },
        "properties": {
          "countryCode": {
            "description": "The country code.",
            "enum": [
              "FR",
              "UK",
              "DK",
              "SE",
              "NO"
            ],
            "example": "SE",
            "type": "string"
          },
          "number": {
            "description": "The number, excluding the country code part and leading 0.",
            "example": 701234567,
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "countryCode",
          "number"
        ]
      },
      "SortingMetadataCancellationsSortOrder": {
        "discriminator": {
          "propertyName": "api"
        },
        "properties": {
          "availableSorts": {
            "description": "The available sorts.",
            "items": {
              "enum": [
                "CREATED_AT_ASC",
                "CREATED_AT_DESC",
                "UPDATED_AT_ASC",
                "UPDATED_AT_DESC"
              ],
              "type": "string"
            },
            "type": "array",
            "uniqueItems": true
          },
          "currentSort": {
            "description": "The sort used by the request.",
            "enum": [
              "CREATED_AT_ASC",
              "CREATED_AT_DESC",
              "UPDATED_AT_ASC",
              "UPDATED_AT_DESC"
            ],
            "type": "string"
          }
        }
      },
      "Tag": {
        "properties": {
          "name": {
            "description": "Name of tag in Scrive.",
            "example": "source",
            "minLength": 1,
            "type": "string"
          },
          "value": {
            "description": "Value of tag in Scrive.",
            "example": "Insurely",
            "minLength": 1,
            "type": "string"
          }
        },
        "required": [
          "name",
          "value"
        ]
      },
      "UpdateCancellationDocumentStatusRequest": {
        "properties": {
          "status": {
            "enum": [
              "PENDING",
              "CLOSED",
              "REJECTED",
              "CANCELED"
            ],
            "type": "string"
          }
        },
        "required": [
          "status"
        ]
      }
    },
    "securitySchemes": {
      "authorization-token": {
        "description": "Your API key. Requests are only accepted from IP addresses on the client's allowlist, and with a registered client certificate when mTLS is enforced for the client.",
        "in": "header",
        "name": "authorization-token",
        "type": "apiKey"
      },
      "client-id": {
        "description": "Your client ID, as used by the Prebuilt UI. Server-to-server integrations authenticate with authorization-token instead.",
        "in": "header",
        "name": "client-id",
        "type": "apiKey"
      },
      "jwt-token": {
        "bearerFormat": "JWT",
        "description": "A user session token, sent as `Authorization: Bearer <token>`.",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "contact": {
      "email": "tech@insurely.com",
      "name": "Insurely",
      "url": "https://insurely.com"
    },
    "description": "",
    "termsOfService": "https://www.insurely.com/sv/privacy-policy",
    "title": "Insurely API",
    "version": "2021-01-01"
  },
  "openapi": "3.1.0",
  "paths": {
    "/cancellations": {
      "get": {
        "description": "Returns the statuses of multiple initiated insurance cancellations. This endpoint is paginated and returns a list of statuses based on the selected sort order(default CREATED_AT_DESC), of which the possible values are: CREATED_AT_ASC, CREATED_AT_DESC, UPDATED_AT_ASC, UPDATED_AT_DESC. The default page size is 50 and it can be overriddenusing the 'pageSize' query parameter, up to a max value of 200. The response contains links to both the previous and next pages.",
        "operationId": "getCancellations",
        "parameters": [
          {
            "in": "query",
            "name": "statusIn",
            "required": false,
            "schema": {
              "default": [],
              "items": {
                "enum": [
                  "PREPARATION",
                  "CREATED",
                  "PENDING",
                  "CLOSED",
                  "CANCELED",
                  "TIMED_OUT",
                  "REJECTED",
                  "DOCUMENT_ERROR"
                ],
                "type": "string"
              },
              "type": "array"
            }
          },
          {
            "in": "query",
            "name": "collectionIds",
            "required": false,
            "schema": {
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          },
          {
            "in": "query",
            "name": "createdAfter",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "createdBefore",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updatedAfter",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "updatedBefore",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "isSigned",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "pageSize",
            "required": false,
            "schema": {
              "default": 50,
              "format": "int32",
              "maximum": 200,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "sortBy",
            "required": false,
            "schema": {
              "default": "CREATED_AT_DESC",
              "enum": [
                "CREATED_AT_ASC",
                "CREATED_AT_DESC",
                "UPDATED_AT_ASC",
                "UPDATED_AT_DESC"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancellationsStatusResponse"
                }
              }
            },
            "description": "Statuses successfully fetched."
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/standard-error-401"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Authentication failed: the credentials are missing or invalid, the calling IP is not on the client's allowlist, or mTLS is enforced and no valid client certificate was sent. An expired session token gets 401 Token expired."
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/standard-error-403"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "The client is not allowed to use this endpoint or resource."
          }
        },
        "summary": "Get the statuses of multiple cancellations",
        "tags": [
          "Insurance Cancellation"
        ]
      },
      "post": {
        "description": "Initiate insurance cancellations for a specific collection. Calling this will create\na cancellation power of attorney, which is sent to the insurance holder for signing.\n",
        "operationId": "createCancellations",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancellationsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancellationsResponse"
                }
              }
            },
            "description": "Cancellations of insurances successfully initiated."
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/standard-error-400"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Invalid request body."
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/standard-error-401"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Authentication failed: the credentials are missing or invalid, the calling IP is not on the client's allowlist, or mTLS is enforced and no valid client certificate was sent. An expired session token gets 401 Token expired."
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/standard-error-403"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "The client is not allowed to use this endpoint or resource."
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/standard-error-404"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Collection (requested in CancellationRequest) not found"
          }
        },
        "summary": "Initiate insurance cancellations",
        "tags": [
          "Insurance Cancellation"
        ]
      }
    },
    "/cancellations/config/pdf-template": {
      "get": {
        "description": "Returns the cancellation PDF template.",
        "operationId": "downloadCancellationScrivePdfTemplate",
        "responses": {
          "200": {
            "content": {
              "application/pdf": {}
            },
            "description": "PDF template in response"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/standard-error-400"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Invalid request body."
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/standard-error-401"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Authentication failed: the credentials are missing or invalid, the calling IP is not on the client's allowlist, or mTLS is enforced and no valid client certificate was sent. An expired session token gets 401 Token expired."
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/standard-error-403"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "The client is not allowed to use this endpoint or resource."
          }
        },
        "summary": "Download cancellation PDF template used by Scrive",
        "tags": [
          "Insurance Cancellation Config"
        ]
      },
      "post": {
        "description": "Updates the cancellation PDF template.",
        "operationId": "uploadCancellationScrivePdfTemplate",
        "requestBody": {
          "content": {
            "application/pdf": {
              "schema": {
                "format": "byte",
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "PDF successfully uploaded"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/standard-error-400"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Invalid request body."
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/standard-error-401"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Authentication failed: the credentials are missing or invalid, the calling IP is not on the client's allowlist, or mTLS is enforced and no valid client certificate was sent. An expired session token gets 401 Token expired."
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/standard-error-403"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "The client is not allowed to use this endpoint or resource."
          }
        },
        "summary": "Upload cancellation PDF template used by Scrive",
        "tags": [
          "Insurance Cancellation Config"
        ]
      }
    },
    "/cancellations/config/scrive/credentials/verify": {
      "get": {
        "description": "Contact Scrive and check that current credentials are valid",
        "operationId": "verifyScriveCredentials",
        "responses": {
          "200": {
            "description": "Credentials are OK"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/standard-error-400"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Invalid request body."
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/standard-error-401"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Authentication failed: the credentials are missing or invalid, the calling IP is not on the client's allowlist, or mTLS is enforced and no valid client certificate was sent. An expired session token gets 401 Token expired."
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/standard-error-403"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "The client is not allowed to use this endpoint or resource."
          }
        },
        "summary": "Contact Scrive and check that current credentials are valid",
        "tags": [
          "Insurance Cancellation Config"
        ]
      }
    },
    "/cancellations/{documentId}": {
      "get": {
        "description": "Returns the status of an initiated insurance cancellation.",
        "operationId": "getCancellationStatus",
        "parameters": [
          {
            "in": "path",
            "name": "documentId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancellationStatusResponse"
                }
              }
            },
            "description": "Status successfully fetched."
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/standard-error-401"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Authentication failed: the credentials are missing or invalid, the calling IP is not on the client's allowlist, or mTLS is enforced and no valid client certificate was sent. An expired session token gets 401 Token expired."
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/standard-error-403"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "The client is not allowed to use this endpoint or resource."
          }
        },
        "summary": "Get the status of a cancellation",
        "tags": [
          "Insurance Cancellation"
        ]
      }
    },
    "/cancellations/{documentId}/cancel": {
      "post": {
        "description": "Cancel insurance power of attorney.\n",
        "operationId": "cancelCancellation",
        "parameters": [
          {
            "in": "path",
            "name": "documentId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cancellations of power of attorney successfull."
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/standard-error-400"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Invalid request body."
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/standard-error-401"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Authentication failed: the credentials are missing or invalid, the calling IP is not on the client's allowlist, or mTLS is enforced and no valid client certificate was sent. An expired session token gets 401 Token expired."
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/standard-error-403"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "The client is not allowed to use this endpoint or resource."
          }
        },
        "summary": "Cancel pending insurance power of attorney.",
        "tags": [
          "Insurance Cancellation"
        ]
      }
    },
    "/cancellations/{documentId}/delivery-status": {
      "get": {
        "description": "Returns derived delivery status according to Scrive",
        "operationId": "getDeliveryStatus",
        "parameters": [
          {
            "in": "path",
            "name": "documentId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancellationDeliveryStatusResponse"
                }
              }
            },
            "description": "Status successfully fetched."
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/standard-error-401"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Authentication failed: the credentials are missing or invalid, the calling IP is not on the client's allowlist, or mTLS is enforced and no valid client certificate was sent. An expired session token gets 401 Token expired."
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/standard-error-403"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "The client is not allowed to use this endpoint or resource."
          }
        },
        "summary": "Poll Scrive for the current delivery status of the document. Only use for PENDING documents.",
        "tags": [
          "Insurance Cancellation"
        ]
      }
    },
    "/cancellations/{documentId}/pdf": {
      "get": {
        "description": "Returns PDF document",
        "operationId": "getCancellationPdf",
        "parameters": [
          {
            "in": "path",
            "name": "documentId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "format": "byte",
                  "type": "string"
                }
              }
            },
            "description": "Status successfully fetched."
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/standard-error-401"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Authentication failed: the credentials are missing or invalid, the calling IP is not on the client's allowlist, or mTLS is enforced and no valid client certificate was sent. An expired session token gets 401 Token expired."
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/standard-error-403"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "The client is not allowed to use this endpoint or resource."
          }
        },
        "summary": "Get the cancellation power of attorney as PDF",
        "tags": [
          "Insurance Cancellation"
        ]
      }
    },
    "/cancellations/{documentId}/status": {
      "post": {
        "description": "Update the status of the cancellation, to indicate whether the cancellation\nis PENDING, CLOSED, REJECTED or CANCELLED\n",
        "operationId": "updateCancellationStatus",
        "parameters": [
          {
            "in": "path",
            "name": "documentId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCancellationDocumentStatusRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Cancellation status successfully updated."
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/standard-error-400"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Invalid request body."
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/standard-error-401"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Authentication failed: the credentials are missing or invalid, the calling IP is not on the client's allowlist, or mTLS is enforced and no valid client certificate was sent. An expired session token gets 401 Token expired."
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/standard-error-403"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "The client is not allowed to use this endpoint or resource."
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/standard-error-404"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Cancellation document not found"
          }
        },
        "summary": "Update the status of a cancellation without Scrive integration",
        "tags": [
          "Insurance Cancellation"
        ]
      }
    }
  },
  "servers": [
    {
      "description": "Production",
      "url": "https://api.insurely.com"
    },
    {
      "description": "Test",
      "url": "https://api.test.insurely.com"
    }
  ],
  "tags": [
    {
      "description": "Create and get insurance cancellations",
      "name": "Insurance Cancellation"
    },
    {
      "description": "Get and update the cancellations config. The config contains default parametersused when cancelling insurances, such as the default delivery and authentication methods.",
      "name": "Insurance Cancellation Config"
    }
  ]
}