openapi: 3.1.0
info:
  title: PetExpert Policy API
  version: v2
  summary: Look up breeds, vets, products and prices, create policies and check policy status.
  description: |
    Every method is a `POST` with a JSON body and the `Ocp-Apim-Subscription-Key` header.

    In each request schema, fields marked **required** must be sent. For `AddNewPolicy`,
    `productcode` and `price` are required only when `policy.type` is `st` (standard); they are
    not used for express (`ex`). See [Getting started — Required fields](getting-started.html#required-fields).

    [Getting started](getting-started.html) · [Policy workflow (standard and express)](policy-workflow.html) ·
    [Code lists](reference.html) · [FAQ](faq.html)
  contact:
    name: PetExpert integration support
    email: <SUPPORT_EMAIL>
  license:
    name: Proprietary - for PetExpert integration partners
    url: https://www.petexpert.cz
servers:
  - url: https://api.petexpert.eu/cz-policy-test/v2
    description: Czech Republic — TEST (cz-policy-test/v2)
  - url: https://api.petexpert.eu/cz-policy-prod/v2
    description: Czech Republic — PRODUCTION (cz-policy-prod/v2)
  - url: https://api.petexpert.eu/sk-policy-test/v2
    description: Slovakia — TEST (sk-policy-test/v2)
  - url: https://api.petexpert.eu/sk-policy-prod/v2
    description: Slovakia — PRODUCTION (sk-policy-prod/v2)
  - url: https://api.petexpert.eu/pl-policy-test/v2
    description: Poland — TEST (pl-policy-test/v2)
  - url: https://api.petexpert.eu/pl-policy-prod/v2
    description: Poland — PRODUCTION (pl-policy-prod/v2)
  - url: https://api.petexpert.eu/be-policy-test/v2
    description: Belgium — TEST (be-policy-test/v2)
  - url: https://api.petexpert.eu/be-policy-prod/v2
    description: Belgium — PRODUCTION (be-policy-prod/v2)
security:
  - SubscriptionKey: []
  - SubscriptionKeyQuery: []
tags:
  - name: Connection
    description: Check connectivity and the subscription key.
  - name: Reference data
    description: Breeds and contracted vets.
  - name: Products and pricing
    description: Products, prices and renewal prices.
  - name: Policies
    description: Create policies and check their status.
paths:
  /TestConnection:
    post:
      operationId: policy_TestConnection
      summary: Test the connection
      description: Checks that the gateway, subscription key and backend are reachable. No request body is needed.
      tags: [Connection]
      responses:
        '200':
          description: Backend reachable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TestConnectionResponse'
              example:
                resultCode: 100
                resultText: OK
                env: cz-base-test
                script: policy_v1
                trace: 3f2b9c1e8a7d4b6f9e0a1c2d3e4f5a6b
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/ServerError'
  /GetBreeds:
    post:
      operationId: policy_GetBreeds
      summary: List breeds
      description: |
        Returns all active breeds that can be insured, for dogs and cats together.

        * `id` is the breed index to send as `breed` / `breedid` in other calls.
        * `animal` is a localized label (`Dog` / `Cat` in English; `Pes` / `Kočka` in Czech). Filter on it to show only dog or cat breeds.
        * `agelimit` is the maximum entry age in years for the breed.
        * `specie` and `locale` are accepted but currently ignored.

        **Response shape:** the list is returned as a JSON object whose keys are `"0"`, `"1"`,
        `"2"`, ... plus a `trace` key. Iterate the numeric keys.
      tags: [Reference data]
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetBreedsRequest'
            example:
              affilName: ExamplePartner
              appid: examplepartner-web
              appVersion: 1.0.0
              lang: en
      responses:
        '200':
          description: Breed list, or an error object.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetBreedsResponse'
              examples:
                success:
                  summary: Breed list
                  value:
                    '0':
                      name: Labrador retriever
                      id: 112
                      animal: Dog
                      agelimit: 8
                    '1':
                      name: Maine Coon
                      id: 512
                      animal: Cat
                      agelimit: 10
                    trace: 3f2b9c1e8a7d4b6f9e0a1c2d3e4f5a6b
                error:
                  summary: No breeds found
                  value:
                    result: 0
                    resultText: No breeds found.
                    trace: 3f2b9c1e8a7d4b6f9e0a1c2d3e4f5a6b
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/ServerError'
  /GetVets:
    post:
      operationId: policy_GetVets
      summary: List contracted vets
      description: |
        Returns the active vet clinics contracted with PetExpert. Use `id` as `policy.providerid`
        in `AddNewPolicy` to record which clinic sold the policy.

        **Response shape:** a JSON object with numeric keys `"0"`, `"1"`, ... plus `trace`.
      tags: [Reference data]
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AppInfo'
            example:
              affilName: ExamplePartner
              appid: examplepartner-web
              appVersion: 1.0.0
              lang: en
      responses:
        '200':
          description: Vet list, or an error object.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetVetsResponse'
              examples:
                success:
                  summary: Vet list
                  value:
                    '0':
                      id: b3f48306-691c-ed11-b83d-000d3a64b8e6
                      name: Veterinarni klinika Example
                      city: Praha
                    '1':
                      id: 1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d
                      name: Vet Centrum Sample
                      city: Brno
                    trace: 3f2b9c1e8a7d4b6f9e0a1c2d3e4f5a6b
                error:
                  summary: No vets found
                  value:
                    result: 0
                    resultText: No vets found.
                    trace: 3f2b9c1e8a7d4b6f9e0a1c2d3e4f5a6b
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/ServerError'
  /GetProducts:
    post:
      operationId: policy_GetProducts
      summary: Get products and prices for an animal
      description: |
        Returns the insurance products available for an animal with their prices and covered
        risks (limits).

        * `animaltype`: `d` (dog) or `c` (cat).
        * `breedid` (or `breedId`): breed index from `GetBreeds`, a breed GUID or the exact breed name.
        * `age`: age in whole years.
        * `fullset`: `false` (default) returns one variant per product with the default excess (10 % / minimum 1,000). `true` returns every excess combination (10/20/30/40 % x 1,000/2,000/3,000/4,000).
        * `price` is the **monthly** premium and `priceAnnual` = 12 x `price`, in the market currency.
        * `excess` is the co-payment percentage as a string (for example `10%`); `excessmin` is the minimum co-payment per incident.

        Errors are returned as an object with `result: false`, `errorcode` and `errortext`:
        `1` = breed not found or inactive, `2` = age exceeds the breed's age limit.

        **Response shape:** the product list may be returned as a JSON array or as an object
        with numeric keys plus `trace`.
      tags: [Products and pricing]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetProductsRequest'
            examples:
              dog:
                summary: Dog, default excess
                value:
                  channel: web
                  animaltype: d
                  breedid: 112
                  age: 3
                  fullset: false
              catFull:
                summary: Cat, all excess variants
                value:
                  channel: web
                  animaltype: c
                  breedid: 512
                  age: 1
                  fullset: true
      responses:
        '200':
          description: Product list, or an error object.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetProductsResponse'
              examples:
                success:
                  summary: Products (CZ, CZK)
                  value:
                    '0':
                      name: Start (pes)
                      excess: 10%
                      excessmin: 1000
                      code: P201807I
                      risk:
                        - name: Veterinary costs
                          limit: 35000
                        - name: Liability
                          limit: 2000000
                      price: 396
                      priceAnnual: 4752
                    '1':
                      name: Premium (pes)
                      excess: 10%
                      excessmin: 1000
                      code: P201801C
                      risk:
                        - name: Veterinary costs
                          limit: 80000
                        - name: Liability
                          limit: 2000000
                        - name: Search costs
                          limit: 5000
                        - name: Death
                          limit: 15000
                      price: 666
                      priceAnnual: 7992
                    trace: 3f2b9c1e8a7d4b6f9e0a1c2d3e4f5a6b
                breedNotFound:
                  summary: Error 1 - breed not found
                  value:
                    result: false
                    errorcode: 1
                    errortext: Breed ID was not correctly identified
                    trace: 3f2b9c1e8a7d4b6f9e0a1c2d3e4f5a6b
                ageExceeded:
                  summary: Error 2 - age limit exceeded
                  value:
                    result: false
                    errorcode: 2
                    errortext: Age limit of animal exceeded
                    trace: 3f2b9c1e8a7d4b6f9e0a1c2d3e4f5a6b
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/ServerError'
  /GetNewPriceIndex:
    post:
      operationId: policy_GetNewPriceIndex
      summary: Get the price index for a breed and age
      description: |
        Returns the multiplier applied to the base premium for a breed and age (1.00 = base
        price, rounded to 2 decimals).

        * `breed`: breed index, GUID or exact name.
        * `age`: a 1- or 2-character value is read as age in years; anything longer is read as a date of birth (`d.m.yyyy` or `yyyy-MM-dd`).
        * `index` is `999` when the age exceeds the breed's age limit. The animal cannot be insured.
      tags: [Products and pricing]
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetNewPriceIndexRequest'
            examples:
              byAge:
                summary: By age
                value:
                  affilName: ExamplePartner
                  appid: examplepartner-web
                  appVersion: 1.0.0
                  breed: 112
                  age: 3
              byDob:
                summary: By date of birth
                value:
                  affilName: ExamplePartner
                  appid: examplepartner-web
                  appVersion: 1.0.0
                  breed: 112
                  age: '2022-05-04'
      responses:
        '200':
          description: Price index.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetNewPriceIndexResponse'
              examples:
                success:
                  summary: Index
                  value:
                    result: OK
                    index: 1.18
                    trace: 3f2b9c1e8a7d4b6f9e0a1c2d3e4f5a6b
                ageLimit:
                  summary: Age over the breed limit
                  value:
                    result: OK
                    index: 999
                    trace: 3f2b9c1e8a7d4b6f9e0a1c2d3e4f5a6b
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/ServerError'
  /GetNewPriceMatrix:
    post:
      operationId: policy_GetNewPriceMatrix
      summary: Get the full price matrix (CZ)
      description: |
        Returns annual premiums for all products and excess combinations for a breed and age.
        Currently available for the Czech market only.

        Keys of `prices` have the form `{A}-{P}-{E}-{M}`:
        * `A` - `D` (dog) or `C` (cat)
        * `P` - product index: `0` Start, `1` Basic, `2` Premium, `3` Exclusive
        * `E` - excess percentage: `10`, `20`, `30`, `40`
        * `M` - minimum excess: `1000`, `2000`, `3000`, `4000`

        Values are annual premiums as strings.
      tags: [Products and pricing]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetNewPriceMatrixRequest'
            example:
              affilName: ExamplePartner
              appid: examplepartner-web
              appVersion: 1.0.0
              lang: cz
              breed: 112
              age: 3
      responses:
        '200':
          description: Price matrix or error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetNewPriceMatrixResponse'
              examples:
                success:
                  summary: Matrix (shortened)
                  value:
                    result: OK
                    prices:
                      D-0-10-1000: '4752'
                      D-0-10-2000: '4380'
                      D-1-10-1000: '6432'
                      D-2-10-1000: '7992'
                      D-3-40-4000: '6150'
                    trace: 3f2b9c1e8a7d4b6f9e0a1c2d3e4f5a6b
                missing:
                  summary: Breed or age missing
                  value:
                    result: NOK
                    resultText: Breed or age missing
                    trace: 3f2b9c1e8a7d4b6f9e0a1c2d3e4f5a6b
                breed:
                  summary: Unknown breed
                  value:
                    result: NOK
                    resultText: Could not retrieve the breed data for breed
                    trace: 3f2b9c1e8a7d4b6f9e0a1c2d3e4f5a6b
                age:
                  summary: Age over limit
                  value:
                    result: NOK
                    resultText: Age of animal exceeds the permissible range
                    trace: 3f2b9c1e8a7d4b6f9e0a1c2d3e4f5a6b
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/ServerError'
  /GetRenewalPrice:
    post:
      operationId: policy_GetRenewalPrice
      summary: Get the renewal price of a policy
      description: |
        Returns the current and the new annual premium for the next policy year.
        `newPremium` = `currentPremium` x `renewalPriceIndex`, rounded up to a multiple of 12 so it
        divides into whole monthly payments. `explain: true` adds a `details` object with the
        calculation inputs.
      tags: [Products and pricing]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetRenewalPriceRequest'
            example:
              affilName: ExamplePartner
              appid: examplepartner-web
              appVersion: 1.0.0
              lang: en
              policyNumber: '1234250115'
              explain: false
      responses:
        '200':
          description: Renewal price or failure.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetRenewalPriceResponse'
              examples:
                success:
                  summary: Renewal price
                  value:
                    resultText: OK
                    policyNumber: '1234250115'
                    currentPremium: 7992
                    newPremium: 8796
                    renewalPriceIndex: 1.1
                    trace: 3f2b9c1e8a7d4b6f9e0a1c2d3e4f5a6b
                failure:
                  summary: Policy not found or index unavailable
                  value:
                    resultText: NOK
                    trace: 3f2b9c1e8a7d4b6f9e0a1c2d3e4f5a6b
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/ServerError'
  /AddNewPolicy:
    post:
      operationId: policy_AddNewPolicy
      summary: Create a policy
      description: |
        Creates the customer (or reuses an existing active customer with the same e-mail), the
        policy and the insured animal, and returns the policy number with payment and document
        links.

        **Set `policy.type` for the kind of policy you are creating.** If it is omitted the
        policy is created as a standard policy (`st`).

        | `policy.type` | Use for | Required policy fields | After creation |
        |---|---|---|---|
        | `st` (default) | Standard policy sold to a customer | `productcode`, `price` | Send the customer to `paylink`. `GetPolicyStatus` returns `0` until paid, then `1`. |
        | `ex` | **Express policy** issued by a vet clinic | none (product and cover are set by PetExpert) | The customer activates the policy. `GetPolicyStatus` returns `99` until activated, then `1`. |

        **Express policies:** always send `policy.type: "ex"`, otherwise a standard paid
        policy is created instead. Send the clinic's `userName` and `password` so the policy
        is linked to the issuing clinic. `productcode` and `price` are not needed. Older
        integration documents call this request `AddEdoPolicy`; on Policy API v2 it is
        `AddNewPolicy` with `policy.type: "ex"`. See the [Policy workflow](policy-workflow.html#express) guide.

        * `policy.price` (standard policies) is the annual premium (whole number) agreed with the customer, normally `priceAnnual` from `GetProducts`.
        * When valid clinic `userName` and `password` are sent, the policy is linked to that clinic (overrides `policy.providerid`).
        * The policy number is generated by PetExpert (10 digits).
        * The call is synchronous and usually completes within 15 seconds. Set your client timeout to 60 seconds.
        * There is no duplicate check. Do not resubmit after a timeout before checking with PetExpert.

        Failures: `result: NOK` with `resulttext` when the policy or animal cannot be created;
        `resultCode: 510` when the customer cannot be created.
      tags: [Policies]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddNewPolicyRequest'
            examples:
              standard:
                summary: Standard policy, dog (CZ)
                value:
                  affilName: ExamplePartner
                  appid: examplepartner-web
                  appVersion: 1.0.0
                  lang: cz
                  policy:
                    type: st
                    productcode: P201801C
                    price: 7992
                    excess: 10
                    excessmin: 1000
                    referralcode: EXAMPLE10
                    providerid: b3f48306-691c-ed11-b83d-000d3a64b8e6
                  animal:
                    name: Rex
                    type: d
                    sex: 856900002
                    chipnr: '203098100123456'
                    dob: 4.5.2021
                    breed: 112
                  customer:
                    fname: Jan
                    lname: Novak
                    email: jan.novak@example.com
                    phone: '+420600000001'
                    address: Hlavni 12
                    city: Praha
                    zip: '11000'
                    dob: 17.9.1985
                    language: cz
              express:
                summary: Express policy issued by a vet clinic (type ex)
                value:
                  affilName: ExampleVetSoftware
                  appid: examplevet
                  appVersion: 4.2.0
                  lang: en
                  userName: <CLINIC_LOGIN>
                  password: <CLINIC_PASSWORD>
                  policy:
                    type: ex
                  animal:
                    name: Rex
                    type: d
                    sex: Pes
                    chipnr: '967000009876543'
                    dob: 14.3.2023
                  customer:
                    fname: John
                    lname: Tester
                    email: john.tester@example.com
                    phone: '+32470000001'
                    address: Sample Street 123
                    city: Brussels
                    zip: '1000'
                    dob: 2.8.1988
              clinicSale:
                summary: Sold by a vet clinic (clinic credentials)
                value:
                  affilName: ExampleVetSoftware
                  appid: examplevet
                  appVersion: 4.2.0
                  lang: sk
                  userName: <CLINIC_LOGIN>
                  password: <CLINIC_PASSWORD>
                  policy:
                    type: st
                    productcode: P201801F
                    price: 4632
                  animal:
                    name: Micka
                    type: c
                    sex: Mačka
                    chipnr: '703098100654321'
                    dob: '2024-02-07'
                    breed: Europska kratkosrsta
                  customer:
                    fname: Eva
                    lname: Kovacova
                    email: eva.kovacova@example.com
                    phone: '+421900000002'
                    address: Hlavna 5
                    city: Bratislava
                    zip: '81101'
      responses:
        '200':
          description: Creation result.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddNewPolicyResponse'
              examples:
                success:
                  summary: Policy created
                  value:
                    result: OK
                    resulttext: Standard insurance 4821251021 created successfully.
                    pno: '4821251021'
                    paylink: https://test.petexpert.cz/platba?polid=<ENCODED_ID>
                    applink: https://test.petexpert.cz/app.php?id=<ENCODED_ID>
                    apppdf: https://test.petexpert.cz/pdf.php?url=<ENCODED_URL>
                    formurl: https://test.petexpert.cz/klient/prihlaseni
                    price: 7992
                    pid: 6f1c2a3b-4d5e-4f60-8a7b-9c0d1e2f3a4b
                    aid: 2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e
                    cid: 9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d
                    trace: 3f2b9c1e8a7d4b6f9e0a1c2d3e4f5a6b
                expressCreated:
                  summary: Express policy created
                  value:
                    result: OK
                    resulttext: Standard insurance 3417251021 created successfully.
                    pno: '3417251021'
                    paylink: https://test.petexpert.be/platba?polid=<ENCODED_ID>
                    applink: https://test.petexpert.be/app.php?id=<ENCODED_ID>
                    apppdf: https://test.petexpert.be/pdf.php?url=<ENCODED_URL>
                    formurl: https://test.petexpert.be/klient/prihlaseni
                    price: null
                    pid: 7a2b3c4d-5e6f-4a70-8b9c-0d1e2f3a4b5c
                    aid: 8b3c4d5e-6f7a-4b81-9cad-1e2f3a4b5c6d
                    cid: 9c4d5e6f-7a8b-4c92-adbe-2f3a4b5c6d7e
                    trace: 3f2b9c1e8a7d4b6f9e0a1c2d3e4f5a6b
                policyFailed:
                  summary: Policy could not be created
                  value:
                    result: NOK
                    resulttext: Unable to creat insurance policy.
                    trace: 3f2b9c1e8a7d4b6f9e0a1c2d3e4f5a6b
                animalFailed:
                  summary: Animal could not be created
                  value:
                    result: NOK
                    resulttext: Unable to create animal.
                    trace: 3f2b9c1e8a7d4b6f9e0a1c2d3e4f5a6b
                customerFailed:
                  summary: Customer could not be created
                  value:
                    resultCode: 510
                    resultText: Object could not be created in the system.
                    trace: 3f2b9c1e8a7d4b6f9e0a1c2d3e4f5a6b
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/ServerError'
  /GetPolicyStatus:
    post:
      operationId: policy_GetPolicyStatus
      summary: Get policy status
      description: |
        Returns the status of a policy by policy number. `balance` (remaining vet limit) and
        `activated` are filled only for active policies.

        | `status` | Meaning |
        |---|---|
        | `0` | Waiting for payment |
        | `1` | Active |
        | `9` | Not found |
        | `20` | Not activated - offer cancelled |
        | `21` | Terminated on customer request |
        | `22` | Terminated by insurer |
        | `23` | Not renewed |
        | `99` | Other state, including an express policy that the customer has not activated yet |

        `substatus` is a localized sentence describing the status.
      tags: [Policies]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetPolicyStatusRequest'
            example:
              affilName: ExamplePartner
              appid: examplepartner-web
              appVersion: 1.0.0
              lang: en
              policy: '1234250115'
      responses:
        '200':
          description: Policy status.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetPolicyStatusResponse'
              examples:
                active:
                  summary: Active
                  value:
                    policy: '1234250115'
                    status: 1
                    substatus: Insurance nr.  1234250115 is active.
                    activated: '2025-01-15'
                    balance: 72500
                    trace: 3f2b9c1e8a7d4b6f9e0a1c2d3e4f5a6b
                waiting:
                  summary: Waiting for payment
                  value:
                    policy: '4821251021'
                    status: 0
                    substatus: Insurance nr.  4821251021 waiting for payment.
                    activated: null
                    balance: null
                    trace: 3f2b9c1e8a7d4b6f9e0a1c2d3e4f5a6b
                notFound:
                  summary: Not found
                  value:
                    policy: '0000000000'
                    status: 9
                    substatus: Insurance nr.  0000000000 was not found.
                    activated: null
                    balance: null
                    trace: 3f2b9c1e8a7d4b6f9e0a1c2d3e4f5a6b
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/ServerError'
components:
  securitySchemes:
    SubscriptionKey:
      type: apiKey
      in: header
      name: Ocp-Apim-Subscription-Key
      description: Subscription key for the Policy API, issued by PetExpert per partner and environment. Test key `<TEST_SUBSCRIPTION_KEY>`.
    SubscriptionKeyQuery:
      type: apiKey
      in: query
      name: subscription-key
      description: |
        The same subscription key passed as a query parameter instead of the header. Prefer the
        header: query strings tend to end up in logs.
  responses:
    Unauthorized:
      description: Missing or invalid subscription key (returned by the API gateway).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/GatewayError'
          example:
            statusCode: 401
            message: Access denied due to missing subscription key. Make sure to include subscription key when making requests to an API.
    ServerError:
      description: Unexpected server or gateway error. Retry later.
  schemas:
    Lang:
      type: string
      enum: [cz, sk, pl, en, jp]
      description: Language of texts in the response. Defaults to the market language.
    Trace:
      type: string
      pattern: '^[0-9a-f]{32}$'
      example: 3f2b9c1e8a7d4b6f9e0a1c2d3e4f5a6b
    GatewayError:
      type: object
      properties:
        statusCode:
          type: integer
        message:
          type: string
    AppInfo:
      type: object
      required: [appid, appVersion, lang]
      properties:
        affilName:
          type: string
          description: Partner name agreed with PetExpert.
          example: ExamplePartner
        appid:
          type: string
          minLength: 1
          description: "**Required.** Application ID agreed with PetExpert."
          example: examplepartner-web
        appVersion:
          type: string
          minLength: 1
          description: "**Required.** Version of the calling software."
          example: 1.0.0
        lang:
          $ref: '#/components/schemas/Lang'
    BreedRef:
      type: [integer, string]
      description: 'Breed: the `id` (index) from `GetBreeds` (recommended), the breed GUID, or the exact breed name.'
      example: 112
    TestConnectionResponse:
      type: object
      properties:
        resultCode:
          type: integer
          const: 100
        resultText:
          type: string
        env:
          type: string
        script:
          type: string
        trace:
          $ref: '#/components/schemas/Trace'
    GetBreedsRequest:
      allOf:
        - $ref: '#/components/schemas/AppInfo'
        - type: object
          properties:
            specie:
              type: string
              description: Accepted but ignored.
            locale:
              type: string
              description: Accepted but ignored.
    Breed:
      type: object
      properties:
        name:
          type: [string, 'null']
        id:
          type: [integer, 'null']
          description: Breed index used in other calls.
        animal:
          type: string
          description: Localized animal type (`Dog` / `Cat`).
        agelimit:
          type: [number, 'null']
          description: Maximum entry age in years.
    LookupError:
      type: object
      required: [result, resultText]
      properties:
        result:
          type: integer
          const: 0
        resultText:
          type: string
        trace:
          $ref: '#/components/schemas/Trace'
    GetBreedsResponse:
      anyOf:
        - type: object
          description: Breeds keyed by "0", "1", ... plus `trace`.
          properties:
            trace:
              $ref: '#/components/schemas/Trace'
          patternProperties:
            '^[0-9]+$':
              $ref: '#/components/schemas/Breed'
        - $ref: '#/components/schemas/LookupError'
    Vet:
      type: object
      properties:
        id:
          type: [string, 'null']
          description: Vet account GUID; use as `policy.providerid`.
        name:
          type: [string, 'null']
        city:
          type: [string, 'null']
    GetVetsResponse:
      anyOf:
        - type: object
          description: Vets keyed by "0", "1", ... plus `trace`.
          properties:
            trace:
              $ref: '#/components/schemas/Trace'
          patternProperties:
            '^[0-9]+$':
              $ref: '#/components/schemas/Vet'
        - $ref: '#/components/schemas/LookupError'
    GetProductsRequest:
      type: object
      required: [animaltype, breedid, age]
      properties:
        channel:
          type: string
          description: Sales channel agreed with PetExpert (informational).
        animaltype:
          type: string
          enum: [d, c]
          description: '`d` = dog, `c` = cat.'
        breedid:
          $ref: '#/components/schemas/BreedRef'
        breedId:
          $ref: '#/components/schemas/BreedRef'
        age:
          type: integer
          minimum: 0
          description: Age in whole years.
        fullset:
          type: boolean
          default: false
          description: '`true` returns all excess combinations.'
        apikey:
          type: string
          deprecated: true
          description: Legacy field, not needed. Authentication uses the subscription key header.
    Product:
      type: object
      properties:
        name:
          type: string
        code:
          type: string
          description: Product code; send as `policy.productcode` in `AddNewPolicy`.
        excess:
          type: string
          description: Co-payment percentage, for example `10%`.
        excessmin:
          type: number
          description: Minimum co-payment per incident.
        price:
          type: [number, 'null']
          description: Monthly premium.
        priceAnnual:
          type: number
          description: Annual premium (12 x monthly).
        risk:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              limit:
                type: number
                description: Annual limit for the risk.
    ProductError:
      type: object
      properties:
        result:
          type: boolean
          const: false
        errorcode:
          type: integer
          enum: [1, 2]
          description: '`1` breed not found or inactive, `2` age limit exceeded.'
        errortext:
          type: string
        trace:
          $ref: '#/components/schemas/Trace'
    GetProductsResponse:
      anyOf:
        - type: array
          items:
            $ref: '#/components/schemas/Product'
        - type: object
          description: Products keyed by "0", "1", ... plus `trace`.
          properties:
            trace:
              $ref: '#/components/schemas/Trace'
          patternProperties:
            '^[0-9]+$':
              $ref: '#/components/schemas/Product'
        - $ref: '#/components/schemas/ProductError'
    GetNewPriceIndexRequest:
      allOf:
        - $ref: '#/components/schemas/AppInfo'
        - type: object
          required: [breed, age]
          properties:
            breed:
              $ref: '#/components/schemas/BreedRef'
            age:
              type: [integer, string]
              description: Age in years (1-2 characters) or date of birth.
    GetNewPriceIndexResponse:
      type: object
      properties:
        result:
          type: string
          const: OK
        index:
          type: number
          description: Price multiplier, or `999` when the age exceeds the breed limit.
        trace:
          $ref: '#/components/schemas/Trace'
    GetNewPriceMatrixRequest:
      allOf:
        - $ref: '#/components/schemas/AppInfo'
        - type: object
          required: [breed, age]
          properties:
            breed:
              $ref: '#/components/schemas/BreedRef'
            age:
              type: integer
              minimum: 1
              description: Age in years; must be within the breed's age limit.
    GetNewPriceMatrixResponse:
      anyOf:
        - type: object
          properties:
            result:
              type: string
              const: OK
            prices:
              type: object
              additionalProperties:
                type: string
            trace:
              $ref: '#/components/schemas/Trace'
        - type: object
          properties:
            result:
              type: string
              const: NOK
            resultText:
              type: string
            trace:
              $ref: '#/components/schemas/Trace'
    GetRenewalPriceRequest:
      allOf:
        - $ref: '#/components/schemas/AppInfo'
        - type: object
          required: [policyNumber]
          properties:
            policyNumber:
              type: string
              pattern: '^[0-9]{10}$'
            explain:
              type: boolean
              default: false
    GetRenewalPriceResponse:
      anyOf:
        - type: object
          properties:
            resultText:
              type: string
              const: OK
            policyNumber:
              type: string
            currentPremium:
              type: [number, 'null']
              description: Current annual premium.
            newPremium:
              type: number
              description: Annual premium for the next year.
            renewalPriceIndex:
              type: number
            details:
              type: object
              description: Present when `explain` is true.
            trace:
              $ref: '#/components/schemas/Trace'
        - type: object
          properties:
            resultText:
              type: string
              const: NOK
            trace:
              $ref: '#/components/schemas/Trace'
    AddNewPolicyRequest:
      allOf:
        - $ref: '#/components/schemas/AppInfo'
        - type: object
          required: [policy, animal, customer]
          properties:
            userName:
              type: string
              description: Optional clinic login. When valid, the policy is linked to the clinic.
            password:
              type: string
              format: password
              writeOnly: true
              description: Optional clinic password.
            policy:
              type: object
              properties:
                type:
                  type: string
                  enum: [st, vt, ex, ex2, bc, tr]
                  default: st
                  description: |
                    Policy type. **Defaults to `st` when omitted.** `st` standard (waits for
                    payment; requires `productcode` and `price`), `ex` **express** (issued by a
                    vet clinic and activated by the customer; no `productcode` or `price`
                    needed), `vt` standby, `ex2` express follow-up, `bc` breeder, `tr` travel.
                    Partners normally use `st` or `ex`.
                productcode:
                  type: string
                  description: |
                    Product `code` from `GetProducts`. **Required for standard (`st`)** policies;
                    not used for express (`ex`).
                  example: P201801C
                price:
                  type: integer
                  description: |
                    Annual premium in the market currency. **Required for standard (`st`)**
                    policies; not used for express (`ex`).
                  example: 7992
                excess:
                  type: [number, string]
                  default: 10
                  description: Co-payment percentage.
                excessmin:
                  type: [number, string]
                  default: 1000
                  description: Minimum co-payment.
                providerid:
                  type: string
                  format: uuid
                  description: Selling vet's `id` from `GetVets`. Ignored if not a valid vet.
                referralcode:
                  type: string
                  description: Partner or promo code. Converted to upper case.
                extcode:
                  type: string
                  description: Your external reference.
                sourcesystem:
                  type: integer
                  description: Source system code agreed with PetExpert.
            animal:
              type: object
              required: [name, type, chipnr, dob]
              properties:
                name:
                  type: string
                type:
                  type: [string, integer]
                  description: '`d` / `856900000` dog, `c` / `856900001` cat. Czech/Slovak labels `Pes`, `Kočka`, `Mačka` are also accepted.'
                sex:
                  type: [string, integer, 'null']
                  description: |
                    `856900000` female dog (`Fena` / `Suka`), `856900001` female cat (`Kočka` /
                    `Mačka`), `856900002` male dog (`Pes`), `856900003` male cat (`Kocour` / `Kocúr`).
                chipnr:
                  type: string
                  description: Microchip number (alias `chipnumber`).
                dob:
                  type: string
                  description: Date of birth, `d.m.yyyy` or `yyyy-MM-dd`.
                breed:
                  $ref: '#/components/schemas/BreedRef'
                breedid:
                  type: string
                  format: uuid
                  description: Breed GUID. Takes precedence over `breed`.
            customer:
              type: object
              required: [email, fname, lname, phone]
              properties:
                fname:
                  type: string
                lname:
                  type: string
                email:
                  type: string
                  format: email
                  description: An existing active customer with this e-mail is reused.
                phone:
                  type: string
                  description: Phone number, preferably in international format.
                address:
                  type: string
                city:
                  type: string
                zip:
                  type: string
                dob:
                  type: string
                  description: Date of birth, `d.m.yyyy` or `yyyy-MM-dd`.
                personalid:
                  type: string
                  description: National personal ID, where applicable.
                language:
                  type: string
                  description: Preferred communication language.
    AddNewPolicyResponse:
      anyOf:
        - type: object
          properties:
            result:
              type: string
              const: OK
            resulttext:
              type: string
            pno:
              type: string
              description: New policy number (10 digits).
            paylink:
              type: string
              description: Payment page for the customer.
            applink:
              type: string
              description: Online policy document.
            apppdf:
              type: string
              description: Policy document as PDF.
            formurl:
              type: string
              description: Customer portal login.
            price:
              type: [number, string, 'null']
            pid:
              type: string
              description: Policy GUID.
            aid:
              type: string
              description: Animal GUID.
            cid:
              type: string
              description: Customer GUID.
            trace:
              $ref: '#/components/schemas/Trace'
        - type: object
          properties:
            result:
              type: string
              const: NOK
            resulttext:
              type: string
            trace:
              $ref: '#/components/schemas/Trace'
        - type: object
          properties:
            resultCode:
              type: integer
              const: 510
            resultText:
              type: string
            trace:
              $ref: '#/components/schemas/Trace'
    GetPolicyStatusRequest:
      allOf:
        - $ref: '#/components/schemas/AppInfo'
        - type: object
          required: [policy]
          properties:
            policy:
              type: string
              pattern: '^[0-9]{10}$'
              description: Policy number.
    GetPolicyStatusResponse:
      type: object
      properties:
        policy:
          type: string
        status:
          type: integer
          enum: [0, 1, 9, 20, 21, 22, 23, 99]
        substatus:
          type: string
        activated:
          type: [string, 'null']
          format: date
        balance:
          type: [number, 'null']
          description: Remaining vet limit (active policies only).
        trace:
          $ref: '#/components/schemas/Trace'
