{
  "openapi": "3.1.0",
  "info": {
    "title": "Practor integration API",
    "version": "1.4.0",
    "description": "REST endpoints that take and answer JSON. Create an integration client and a key in Organization settings, Integrations. Each client can do only what its permissions allow, and every request is in the practice audit log.\n\n**Resources.** Every resource names its kind in `object` and its id in `id`, and points at others by id (`patientId`). Values from a fixed list are lowercase, such as `partially_paid`. Times are ISO 8601 in UTC, dates are `YYYY-MM-DD`, and money is a whole number in the currency's minor unit (cents) beside a `currency` code. A resource read with GET can be sent back with PUT as it is.\n\n**Authentication.** Send the key as `Authorization: Bearer prk_live_...`. The key identifies the practice.\n\n**Creates.** Every POST needs an `Idempotency-Key` header, so a retry cannot create a record twice.\n\n**Errors.** Every refusal is an RFC 9457 Problem Details object, sent as `application/problem+json`. Branch on its `code`; `errors` lists every field that is missing or wrong, all at once.\n\n**Paging.** A list answers `{ object: 'list', data, hasMore, nextCursor }`. While `hasMore` is true, send `nextCursor` back as `cursor`, with the same filters, for the next page. `limit` sets the page size, up to 100.\n\n**Limits.** Each client can send 600 requests a minute, and each practice can bill 30 encounters a minute across all its clients. Over either, the answer is a 429; the `X-RateLimit-*` headers on every answer say where you are."
  },
  "servers": [
    {
      "url": "https://dashboard.practor.app"
    }
  ],
  "externalDocs": {
    "description": "Guides and reference",
    "url": "https://developers.practor.app"
  },
  "tags": [
    {
      "name": "Practitioners",
      "description": "The practitioners of the practice, to name who saw a patient."
    },
    {
      "name": "Patients",
      "description": "Register patients and keep their details matched with your system."
    },
    {
      "name": "Coverage",
      "description": "A patient's medical insurance or private-pay arrangement."
    },
    {
      "name": "Insurance plans",
      "description": "The medical insurance plans Practor can claim against."
    },
    {
      "name": "Encounters",
      "description": "Finished visits, with their diagnoses and procedures, ready to bill."
    },
    {
      "name": "Invoices",
      "description": "Invoices, the lines on them and the payments made against them."
    },
    {
      "name": "Claims",
      "description": "Send an invoice's claim to the insurer, and resubmit, reverse or cancel it."
    },
    {
      "name": "Code systems",
      "description": "The codes a practice bills and records with: published systems, and the practice's own, such as its tariff."
    },
    {
      "name": "Webhooks",
      "description": "Events Practor sends to the endpoints a practice registers for your client."
    }
  ],
  "security": [
    {
      "integrationKey": []
    }
  ],
  "paths": {
    "/api/v1/practitioners": {
      "get": {
        "operationId": "practitionerSearch",
        "summary": "List the practitioners of the practice, to name who saw a patient",
        "tags": [
          "Practitioners"
        ],
        "x-practor-permission": "PATIENTS:READ",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl 'https://dashboard.practor.app/api/v1/practitioners' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\""
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/practitioners\", {\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n  },\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.get(\n    \"https://dashboard.practor.app/api/v1/practitioners\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n    },\n)\nresource = response.json()"
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "A page of the practitioners that match, in `data`. While `hasMore` is true, send `nextCursor` back as `cursor` for the next page.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PractitionerList"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/patients": {
      "get": {
        "operationId": "patientSearch",
        "summary": "Find a patient by an identifier, such as the practice's own patient number",
        "description": "Matches `externalSystem` and `externalId` exactly. Use it to find the patient you registered with your own patient number.",
        "tags": [
          "Patients"
        ],
        "x-practor-permission": "PATIENTS:READ",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl 'https://dashboard.practor.app/api/v1/patients?externalSystem=urn%3Ayour-clinic%3Apatient' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\""
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/patients?externalSystem=urn%3Ayour-clinic%3Apatient\", {\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n  },\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.get(\n    \"https://dashboard.practor.app/api/v1/patients?externalSystem=urn%3Ayour-clinic%3Apatient\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n    },\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "externalSystem",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The system of the external id, as you sent it.",
              "examples": [
                "urn:your-clinic:patient"
              ]
            },
            "required": true,
            "description": "The system of the external id, as you sent it."
          },
          {
            "in": "query",
            "name": "externalId",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Your patient number.",
              "examples": [
                "12345"
              ]
            },
            "required": true,
            "description": "Your patient number."
          }
        ],
        "responses": {
          "200": {
            "description": "A page of the patients that match, in `data`. While `hasMore` is true, send `nextCursor` back as `cursor` for the next page.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatientList"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "patientCreate",
        "summary": "Register a patient, with the practice's own patient number",
        "description": "A second patient with the same `externalId` is refused with a 409 that names the first. Registering a patient sends them nothing.",
        "tags": [
          "Patients"
        ],
        "x-practor-permission": "PATIENTS:CREATE",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST 'https://dashboard.practor.app/api/v1/patients' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"givenNames\": [\n    \"Thandi\"\n  ],\n  \"lastName\": \"Mokoena\",\n  \"gender\": \"female\",\n  \"birthDate\": \"1985-06-12\",\n  \"externalId\": {\n    \"system\": \"urn:your-clinic:patient\",\n    \"value\": \"12345\"\n  },\n  \"contactPoints\": [\n    {\n      \"system\": \"email\",\n      \"value\": \"thandi@example.com\"\n    }\n  ]\n}'"
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/patients\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n    \"Idempotency-Key\": crypto.randomUUID(),\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({\n    \"givenNames\": [\n      \"Thandi\"\n    ],\n    \"lastName\": \"Mokoena\",\n    \"gender\": \"female\",\n    \"birthDate\": \"1985-06-12\",\n    \"externalId\": {\n      \"system\": \"urn:your-clinic:patient\",\n      \"value\": \"12345\"\n    },\n    \"contactPoints\": [\n      {\n        \"system\": \"email\",\n        \"value\": \"thandi@example.com\"\n      }\n    ]\n  }),\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.post(\n    \"https://dashboard.practor.app/api/v1/patients\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n        \"Idempotency-Key\": str(uuid.uuid4()),\n        \"Content-Type\": \"application/json\",\n    },\n    data=\"\"\"{\n  \"givenNames\": [\n    \"Thandi\"\n  ],\n  \"lastName\": \"Mokoena\",\n  \"gender\": \"female\",\n  \"birthDate\": \"1985-06-12\",\n  \"externalId\": {\n    \"system\": \"urn:your-clinic:patient\",\n    \"value\": \"12345\"\n  },\n  \"contactPoints\": [\n    {\n      \"system\": \"email\",\n      \"value\": \"thandi@example.com\"\n    }\n  ]\n}\"\"\",\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255,
              "description": "A value you make up, new for each record you create, such as a UUID. If a create times out and you send it again with the same key and body, Practor doesn't create a second record: it answers with the one the first request made, and adds the header `Idempotent-Replayed: true` so you can tell the answer is a repeat. Keys are remembered for 24 hours.",
              "examples": [
                "2f1c7a52-8f0e-4c1b-9d7e-0b6a3f4e8c21"
              ]
            },
            "required": true,
            "description": "A value you make up, new for each record you create, such as a UUID. If a create times out and you send it again with the same key and body, Practor doesn't create a second record: it answers with the one the first request made, and adds the header `Idempotent-Replayed: true` so you can tell the answer is a repeat. Keys are remembered for 24 hours."
          },
          {
            "in": "header",
            "name": "X-Practor-Performer",
            "schema": {
              "description": "The id of the practitioner doing this, recorded in the audit trail.",
              "examples": [
                "p4n8b6r2t9y3u7i1o5a0s8dm"
              ],
              "type": "string"
            },
            "description": "The id of the practitioner doing this, recorded in the audit trail."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatientRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created. The body is what was created; its address is in the `Location` header. A patient of the practice.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              },
              "Location": {
                "required": true,
                "description": "Where to read what was created.",
                "schema": {
                  "type": "string",
                  "description": "Where to read what was created."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Patient"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The record conflicts with one that exists (`detail` names it), or a request with the same Idempotency-Key is still running. Wait a moment and retry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 256 KB.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "415": {
            "description": "The body wasn't sent as `application/json`. Set the Content-Type header.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The body is valid JSON but breaks a rule, or the Idempotency-Key was used with a different body. `errors` lists every field that is missing or wrong, all at once.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/patients/{patientId}": {
      "get": {
        "operationId": "patientRead",
        "summary": "Read a patient",
        "tags": [
          "Patients"
        ],
        "x-practor-permission": "PATIENTS:READ",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl 'https://dashboard.practor.app/api/v1/patients/k3v9x2m8q1w7e4r6t0y5u2ia' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\""
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/patients/k3v9x2m8q1w7e4r6t0y5u2ia\", {\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n  },\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.get(\n    \"https://dashboard.practor.app/api/v1/patients/k3v9x2m8q1w7e4r6t0y5u2ia\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n    },\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "patientId",
            "schema": {
              "type": "string",
              "description": "The patient's id.",
              "examples": [
                "k3v9x2m8q1w7e4r6t0y5u2ia"
              ]
            },
            "required": true,
            "description": "The patient's id."
          }
        ],
        "responses": {
          "200": {
            "description": "A patient of the practice.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Patient"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The record doesn't exist in this practice. A record in another practice answers the same way.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "patientUpdate",
        "summary": "Replace a patient's demographics",
        "description": "Send the whole patient: what a GET answered with can be sent back as it is. Names, phone numbers, email addresses and addresses are replaced with what you send.",
        "tags": [
          "Patients"
        ],
        "x-practor-permission": "PATIENTS:UPDATE",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X PUT 'https://dashboard.practor.app/api/v1/patients/k3v9x2m8q1w7e4r6t0y5u2ia' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"givenNames\": [\n    \"Thandi\"\n  ],\n  \"lastName\": \"Mokoena\",\n  \"gender\": \"female\",\n  \"birthDate\": \"1985-06-12\",\n  \"externalId\": {\n    \"system\": \"urn:your-clinic:patient\",\n    \"value\": \"12345\"\n  },\n  \"contactPoints\": [\n    {\n      \"system\": \"email\",\n      \"value\": \"thandi@example.com\"\n    }\n  ]\n}'"
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/patients/k3v9x2m8q1w7e4r6t0y5u2ia\", {\n  method: \"PUT\",\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({\n    \"givenNames\": [\n      \"Thandi\"\n    ],\n    \"lastName\": \"Mokoena\",\n    \"gender\": \"female\",\n    \"birthDate\": \"1985-06-12\",\n    \"externalId\": {\n      \"system\": \"urn:your-clinic:patient\",\n      \"value\": \"12345\"\n    },\n    \"contactPoints\": [\n      {\n        \"system\": \"email\",\n        \"value\": \"thandi@example.com\"\n      }\n    ]\n  }),\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.put(\n    \"https://dashboard.practor.app/api/v1/patients/k3v9x2m8q1w7e4r6t0y5u2ia\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n        \"Content-Type\": \"application/json\",\n    },\n    data=\"\"\"{\n  \"givenNames\": [\n    \"Thandi\"\n  ],\n  \"lastName\": \"Mokoena\",\n  \"gender\": \"female\",\n  \"birthDate\": \"1985-06-12\",\n  \"externalId\": {\n    \"system\": \"urn:your-clinic:patient\",\n    \"value\": \"12345\"\n  },\n  \"contactPoints\": [\n    {\n      \"system\": \"email\",\n      \"value\": \"thandi@example.com\"\n    }\n  ]\n}\"\"\",\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "patientId",
            "schema": {
              "type": "string",
              "description": "The patient's id.",
              "examples": [
                "k3v9x2m8q1w7e4r6t0y5u2ia"
              ]
            },
            "required": true,
            "description": "The patient's id."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatientRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Replaced. The body is the record as it is now. A patient of the practice.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Patient"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The record doesn't exist in this practice. A record in another practice answers the same way.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The record conflicts with one that exists (`detail` names it), or a request with the same Idempotency-Key is still running. Wait a moment and retry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 256 KB.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "415": {
            "description": "The body wasn't sent as `application/json`. Set the Content-Type header.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The body is valid JSON but breaks a rule, or the Idempotency-Key was used with a different body. `errors` lists every field that is missing or wrong, all at once.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/coverages": {
      "get": {
        "operationId": "coverageSearch",
        "summary": "List a patient's medical insurance and private-pay arrangements",
        "tags": [
          "Coverage"
        ],
        "x-practor-permission": "PATIENT_COVERAGE:READ",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl 'https://dashboard.practor.app/api/v1/coverages?patientId=k3v9x2m8q1w7e4r6t0y5u2ia' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\""
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/coverages?patientId=k3v9x2m8q1w7e4r6t0y5u2ia\", {\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n  },\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.get(\n    \"https://dashboard.practor.app/api/v1/coverages?patientId=k3v9x2m8q1w7e4r6t0y5u2ia\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n    },\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "patientId",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The patient's id.",
              "examples": [
                "k3v9x2m8q1w7e4r6t0y5u2ia"
              ]
            },
            "required": true,
            "description": "The patient's id."
          }
        ],
        "responses": {
          "200": {
            "description": "A page of the coverages that match, in `data`. While `hasMore` is true, send `nextCursor` back as `cursor` for the next page.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CoverageList"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "`patientId` names no patient of this practice. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "coverageCreate",
        "summary": "Record medical insurance or private pay for a patient",
        "description": "Medical insurance needs `memberNumber` and the plan, by `planId` or by `planOptionCode`. Practor sets the insurer from the plan. Several insurers can share an option code, so send `insurerId` with `planOptionCode`.",
        "tags": [
          "Coverage"
        ],
        "x-practor-permission": "PATIENT_COVERAGE:CREATE",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST 'https://dashboard.practor.app/api/v1/coverages' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"patientId\": \"k3v9x2m8q1w7e4r6t0y5u2ia\",\n  \"type\": \"insurance\",\n  \"memberNumber\": \"900123456\",\n  \"dependentCode\": \"01\",\n  \"relationship\": \"self\",\n  \"planId\": \"n6m1b5v8c2x4z7a9s3d0f5gh\"\n}'"
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/coverages\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n    \"Idempotency-Key\": crypto.randomUUID(),\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({\n    \"patientId\": \"k3v9x2m8q1w7e4r6t0y5u2ia\",\n    \"type\": \"insurance\",\n    \"memberNumber\": \"900123456\",\n    \"dependentCode\": \"01\",\n    \"relationship\": \"self\",\n    \"planId\": \"n6m1b5v8c2x4z7a9s3d0f5gh\"\n  }),\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.post(\n    \"https://dashboard.practor.app/api/v1/coverages\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n        \"Idempotency-Key\": str(uuid.uuid4()),\n        \"Content-Type\": \"application/json\",\n    },\n    data=\"\"\"{\n  \"patientId\": \"k3v9x2m8q1w7e4r6t0y5u2ia\",\n  \"type\": \"insurance\",\n  \"memberNumber\": \"900123456\",\n  \"dependentCode\": \"01\",\n  \"relationship\": \"self\",\n  \"planId\": \"n6m1b5v8c2x4z7a9s3d0f5gh\"\n}\"\"\",\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255,
              "description": "A value you make up, new for each record you create, such as a UUID. If a create times out and you send it again with the same key and body, Practor doesn't create a second record: it answers with the one the first request made, and adds the header `Idempotent-Replayed: true` so you can tell the answer is a repeat. Keys are remembered for 24 hours.",
              "examples": [
                "2f1c7a52-8f0e-4c1b-9d7e-0b6a3f4e8c21"
              ]
            },
            "required": true,
            "description": "A value you make up, new for each record you create, such as a UUID. If a create times out and you send it again with the same key and body, Practor doesn't create a second record: it answers with the one the first request made, and adds the header `Idempotent-Replayed: true` so you can tell the answer is a repeat. Keys are remembered for 24 hours."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CoverageRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created. The body is what was created; its address is in the `Location` header. A patient's medical insurance, or their private-pay arrangement.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              },
              "Location": {
                "required": true,
                "description": "Where to read what was created.",
                "schema": {
                  "type": "string",
                  "description": "Where to read what was created."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Coverage"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The record conflicts with one that exists (`detail` names it), or a request with the same Idempotency-Key is still running. Wait a moment and retry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 256 KB.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "415": {
            "description": "The body wasn't sent as `application/json`. Set the Content-Type header.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The body is valid JSON but breaks a rule, or the Idempotency-Key was used with a different body. `errors` lists every field that is missing or wrong, all at once.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/coverages/{coverageId}": {
      "get": {
        "operationId": "coverageRead",
        "summary": "Read a coverage",
        "tags": [
          "Coverage"
        ],
        "x-practor-permission": "PATIENT_COVERAGE:READ",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl 'https://dashboard.practor.app/api/v1/coverages/c9d1f4g7h2j5k8l0z3x6v1bn' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\""
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/coverages/c9d1f4g7h2j5k8l0z3x6v1bn\", {\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n  },\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.get(\n    \"https://dashboard.practor.app/api/v1/coverages/c9d1f4g7h2j5k8l0z3x6v1bn\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n    },\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "coverageId",
            "schema": {
              "type": "string",
              "description": "The coverage's id.",
              "examples": [
                "c9d1f4g7h2j5k8l0z3x6v1bn"
              ]
            },
            "required": true,
            "description": "The coverage's id."
          }
        ],
        "responses": {
          "200": {
            "description": "A patient's medical insurance, or their private-pay arrangement.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Coverage"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The record doesn't exist in this practice. A record in another practice answers the same way.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "coverageUpdate",
        "summary": "Replace a coverage, such as a new member number",
        "description": "Send the whole coverage: what a GET answered with can be sent back as it is. A coverage stays with the patient it was created for.",
        "tags": [
          "Coverage"
        ],
        "x-practor-permission": "PATIENT_COVERAGE:UPDATE",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X PUT 'https://dashboard.practor.app/api/v1/coverages/c9d1f4g7h2j5k8l0z3x6v1bn' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"patientId\": \"k3v9x2m8q1w7e4r6t0y5u2ia\",\n  \"type\": \"insurance\",\n  \"memberNumber\": \"900123456\",\n  \"dependentCode\": \"01\",\n  \"relationship\": \"self\",\n  \"planId\": \"n6m1b5v8c2x4z7a9s3d0f5gh\"\n}'"
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/coverages/c9d1f4g7h2j5k8l0z3x6v1bn\", {\n  method: \"PUT\",\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({\n    \"patientId\": \"k3v9x2m8q1w7e4r6t0y5u2ia\",\n    \"type\": \"insurance\",\n    \"memberNumber\": \"900123456\",\n    \"dependentCode\": \"01\",\n    \"relationship\": \"self\",\n    \"planId\": \"n6m1b5v8c2x4z7a9s3d0f5gh\"\n  }),\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.put(\n    \"https://dashboard.practor.app/api/v1/coverages/c9d1f4g7h2j5k8l0z3x6v1bn\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n        \"Content-Type\": \"application/json\",\n    },\n    data=\"\"\"{\n  \"patientId\": \"k3v9x2m8q1w7e4r6t0y5u2ia\",\n  \"type\": \"insurance\",\n  \"memberNumber\": \"900123456\",\n  \"dependentCode\": \"01\",\n  \"relationship\": \"self\",\n  \"planId\": \"n6m1b5v8c2x4z7a9s3d0f5gh\"\n}\"\"\",\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "coverageId",
            "schema": {
              "type": "string",
              "description": "The coverage's id.",
              "examples": [
                "c9d1f4g7h2j5k8l0z3x6v1bn"
              ]
            },
            "required": true,
            "description": "The coverage's id."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CoverageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Replaced. The body is the record as it is now. A patient's medical insurance, or their private-pay arrangement.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Coverage"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The record doesn't exist in this practice. A record in another practice answers the same way.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The record conflicts with one that exists (`detail` names it), or a request with the same Idempotency-Key is still running. Wait a moment and retry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 256 KB.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "415": {
            "description": "The body wasn't sent as `application/json`. Set the Content-Type header.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The body is valid JSON but breaks a rule, or the Idempotency-Key was used with a different body. `errors` lists every field that is missing or wrong, all at once.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/coverages/{coverageId}/verification": {
      "post": {
        "operationId": "coverageVerify",
        "summary": "Check medical insurance with the insurer",
        "description": "Asks the insurer whether the membership is valid. The coverage answers `verificationStatus: pending` at once. The insurer's answer is usually saved to it within a minute and sent as the `coverage.verified` webhook: `eligible` or `not_eligible`. If the insurer doesn't answer, the check is tried again, and after the last try the coverage reads `error` with the reason in `verificationMessage`; run the check again. While a check is pending, another for the same coverage answers 409, for up to ten minutes. A practice can run 30 checks a minute. A check is charged to the practice, so the practice needs a card on file in Practor. With no card, an overdue invoice or this month's spend cap reached, the answer is a 422 whose `detail` names the fix, and the insurer is not asked.",
        "tags": [
          "Coverage"
        ],
        "x-practor-permission": "PATIENT_COVERAGE:EXECUTE",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST 'https://dashboard.practor.app/api/v1/coverages/c9d1f4g7h2j5k8l0z3x6v1bn/verification' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\""
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/coverages/c9d1f4g7h2j5k8l0z3x6v1bn/verification\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n  },\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.post(\n    \"https://dashboard.practor.app/api/v1/coverages/c9d1f4g7h2j5k8l0z3x6v1bn/verification\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n    },\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "coverageId",
            "schema": {
              "type": "string",
              "description": "The coverage's id.",
              "examples": [
                "c9d1f4g7h2j5k8l0z3x6v1bn"
              ]
            },
            "required": true,
            "description": "The coverage's id."
          },
          {
            "in": "header",
            "name": "X-Practor-Performer",
            "schema": {
              "description": "The id of the practitioner doing this, recorded in the audit trail.",
              "examples": [
                "p4n8b6r2t9y3u7i1o5a0s8dm"
              ],
              "type": "string"
            },
            "description": "The id of the practitioner doing this, recorded in the audit trail."
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted. The work carries on after this answer; read the record again, or listen for its webhook, for the outcome. A patient's medical insurance, or their private-pay arrangement.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Coverage"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The record doesn't exist in this practice. A record in another practice answers the same way.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The record conflicts with one that exists (`detail` names it), or a request with the same Idempotency-Key is still running. Wait a moment and retry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 256 KB.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "415": {
            "description": "The body wasn't sent as `application/json`. Set the Content-Type header.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The body is valid JSON but breaks a rule, or the Idempotency-Key was used with a different body. `errors` lists every field that is missing or wrong, all at once.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/insurance-plans": {
      "get": {
        "operationId": "insurancePlanSearch",
        "summary": "Find the medical insurance plans Practor can claim against",
        "description": "Search by part of the name or by the option code. Put the plan you find on a coverage as `planId`.",
        "tags": [
          "Insurance plans"
        ],
        "x-practor-permission": "PATIENT_COVERAGE:READ",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl 'https://dashboard.practor.app/api/v1/insurance-plans?name=Classic' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\""
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/insurance-plans?name=Classic\", {\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n  },\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.get(\n    \"https://dashboard.practor.app/api/v1/insurance-plans?name=Classic\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n    },\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "name",
            "schema": {
              "description": "Part of the plan name, at least two characters.",
              "examples": [
                "Classic"
              ],
              "type": "string"
            },
            "description": "Part of the plan name, at least two characters."
          },
          {
            "in": "query",
            "name": "optionCode",
            "schema": {
              "description": "The plan option's code, as the scheme publishes it.",
              "type": "string"
            },
            "description": "The plan option's code, as the scheme publishes it."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "description": "How many to answer with, from 1 to 100. The default is 50.",
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "description": "How many to answer with, from 1 to 100. The default is 50."
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "description": "The `nextCursor` of the page before, for the page after it.",
              "type": "string"
            },
            "description": "The `nextCursor` of the page before, for the page after it."
          }
        ],
        "responses": {
          "200": {
            "description": "A page of the insurance plans that match, in `data`. While `hasMore` is true, send `nextCursor` back as `cursor` for the next page.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InsurancePlanList"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/encounters": {
      "get": {
        "operationId": "encounterSearch",
        "summary": "List a patient's encounters",
        "description": "Newest first, 50 at a time unless you set `limit`. While `hasMore` is true, send `nextCursor` back as `cursor` for the rest.",
        "tags": [
          "Encounters"
        ],
        "x-practor-permission": "ENCOUNTERS:READ",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl 'https://dashboard.practor.app/api/v1/encounters?patientId=k3v9x2m8q1w7e4r6t0y5u2ia' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\""
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/encounters?patientId=k3v9x2m8q1w7e4r6t0y5u2ia\", {\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n  },\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.get(\n    \"https://dashboard.practor.app/api/v1/encounters?patientId=k3v9x2m8q1w7e4r6t0y5u2ia\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n    },\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "patientId",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The patient's id.",
              "examples": [
                "k3v9x2m8q1w7e4r6t0y5u2ia"
              ]
            },
            "required": true,
            "description": "The patient's id."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "description": "How many to answer with, from 1 to 100. The default is 50.",
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "description": "How many to answer with, from 1 to 100. The default is 50."
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "description": "The `nextCursor` of the page before, for the page after it.",
              "type": "string"
            },
            "description": "The `nextCursor` of the page before, for the page after it."
          }
        ],
        "responses": {
          "200": {
            "description": "A page of the encounters that match, in `data`. While `hasMore` is true, send `nextCursor` back as `cursor` for the next page.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EncounterList"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "`patientId` names no patient of this practice. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "encounterCreate",
        "summary": "Record a finished visit with its diagnoses and procedures",
        "description": "Every code must be known to Practor, or the whole visit is refused with each unknown code listed and nothing saved. A visit cannot end in the future or start more than 120 days ago.",
        "tags": [
          "Encounters"
        ],
        "x-practor-permission": "ENCOUNTERS:CREATE",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST 'https://dashboard.practor.app/api/v1/encounters' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"patientId\": \"k3v9x2m8q1w7e4r6t0y5u2ia\",\n  \"practitionerId\": \"p4n8b6r2t9y3u7i1o5a0s8dm\",\n  \"start\": \"2026-10-01T09:00:00+02:00\",\n  \"end\": \"2026-10-01T09:45:00+02:00\",\n  \"diagnoses\": [\n    {\n      \"code\": \"J06.9\"\n    }\n  ],\n  \"procedures\": [\n    {\n      \"code\": \"0190\",\n      \"diagnosisCodes\": [\n        \"J06.9\"\n      ]\n    }\n  ]\n}'"
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/encounters\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n    \"Idempotency-Key\": crypto.randomUUID(),\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({\n    \"patientId\": \"k3v9x2m8q1w7e4r6t0y5u2ia\",\n    \"practitionerId\": \"p4n8b6r2t9y3u7i1o5a0s8dm\",\n    \"start\": \"2026-10-01T09:00:00+02:00\",\n    \"end\": \"2026-10-01T09:45:00+02:00\",\n    \"diagnoses\": [\n      {\n        \"code\": \"J06.9\"\n      }\n    ],\n    \"procedures\": [\n      {\n        \"code\": \"0190\",\n        \"diagnosisCodes\": [\n          \"J06.9\"\n        ]\n      }\n    ]\n  }),\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.post(\n    \"https://dashboard.practor.app/api/v1/encounters\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n        \"Idempotency-Key\": str(uuid.uuid4()),\n        \"Content-Type\": \"application/json\",\n    },\n    data=\"\"\"{\n  \"patientId\": \"k3v9x2m8q1w7e4r6t0y5u2ia\",\n  \"practitionerId\": \"p4n8b6r2t9y3u7i1o5a0s8dm\",\n  \"start\": \"2026-10-01T09:00:00+02:00\",\n  \"end\": \"2026-10-01T09:45:00+02:00\",\n  \"diagnoses\": [\n    {\n      \"code\": \"J06.9\"\n    }\n  ],\n  \"procedures\": [\n    {\n      \"code\": \"0190\",\n      \"diagnosisCodes\": [\n        \"J06.9\"\n      ]\n    }\n  ]\n}\"\"\",\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255,
              "description": "A value you make up, new for each record you create, such as a UUID. If a create times out and you send it again with the same key and body, Practor doesn't create a second record: it answers with the one the first request made, and adds the header `Idempotent-Replayed: true` so you can tell the answer is a repeat. Keys are remembered for 24 hours.",
              "examples": [
                "2f1c7a52-8f0e-4c1b-9d7e-0b6a3f4e8c21"
              ]
            },
            "required": true,
            "description": "A value you make up, new for each record you create, such as a UUID. If a create times out and you send it again with the same key and body, Practor doesn't create a second record: it answers with the one the first request made, and adds the header `Idempotent-Replayed: true` so you can tell the answer is a repeat. Keys are remembered for 24 hours."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EncounterRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created. The body is what was created; its address is in the `Location` header. A visit, with its diagnoses and procedures.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              },
              "Location": {
                "required": true,
                "description": "Where to read what was created.",
                "schema": {
                  "type": "string",
                  "description": "Where to read what was created."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Encounter"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The record conflicts with one that exists (`detail` names it), or a request with the same Idempotency-Key is still running. Wait a moment and retry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 256 KB.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "415": {
            "description": "The body wasn't sent as `application/json`. Set the Content-Type header.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The body is valid JSON but breaks a rule, or the Idempotency-Key was used with a different body. `errors` lists every field that is missing or wrong, all at once.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/encounters/{encounterId}": {
      "get": {
        "operationId": "encounterRead",
        "summary": "Read an encounter",
        "tags": [
          "Encounters"
        ],
        "x-practor-permission": "ENCOUNTERS:READ",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl 'https://dashboard.practor.app/api/v1/encounters/e7j3p5s9d1f4g6h8k2l0m3nb' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\""
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/encounters/e7j3p5s9d1f4g6h8k2l0m3nb\", {\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n  },\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.get(\n    \"https://dashboard.practor.app/api/v1/encounters/e7j3p5s9d1f4g6h8k2l0m3nb\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n    },\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "encounterId",
            "schema": {
              "type": "string",
              "description": "The encounter's id.",
              "examples": [
                "e7j3p5s9d1f4g6h8k2l0m3nb"
              ]
            },
            "required": true,
            "description": "The encounter's id."
          }
        ],
        "responses": {
          "200": {
            "description": "A visit, with its diagnoses and procedures.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Encounter"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The record doesn't exist in this practice. A record in another practice answers the same way.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/encounters/{encounterId}/bill": {
      "post": {
        "operationId": "encounterBill",
        "summary": "Invoice an encounter, optionally issue it and claim from the insurer",
        "description": "Drafts an invoice from the visit. Ask for it to be issued, and for the claim to be sent to the insurer, in the body. The invoice is created either way; a claim that could not be sent says why, so it can be fixed and sent from the dashboard.",
        "tags": [
          "Encounters"
        ],
        "x-practor-permission": "INVOICES:CREATE",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST 'https://dashboard.practor.app/api/v1/encounters/e7j3p5s9d1f4g6h8k2l0m3nb/bill' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"issue\": true,\n  \"submitClaim\": true,\n  \"coverageId\": \"c9d1f4g7h2j5k8l0z3x6v1bn\"\n}'"
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/encounters/e7j3p5s9d1f4g6h8k2l0m3nb/bill\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n    \"Idempotency-Key\": crypto.randomUUID(),\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({\n    \"issue\": true,\n    \"submitClaim\": true,\n    \"coverageId\": \"c9d1f4g7h2j5k8l0z3x6v1bn\"\n  }),\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.post(\n    \"https://dashboard.practor.app/api/v1/encounters/e7j3p5s9d1f4g6h8k2l0m3nb/bill\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n        \"Idempotency-Key\": str(uuid.uuid4()),\n        \"Content-Type\": \"application/json\",\n    },\n    data=\"\"\"{\n  \"issue\": true,\n  \"submitClaim\": true,\n  \"coverageId\": \"c9d1f4g7h2j5k8l0z3x6v1bn\"\n}\"\"\",\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "encounterId",
            "schema": {
              "type": "string",
              "description": "The encounter's id.",
              "examples": [
                "e7j3p5s9d1f4g6h8k2l0m3nb"
              ]
            },
            "required": true,
            "description": "The encounter's id."
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255,
              "description": "A value you make up, new for each record you create, such as a UUID. If a create times out and you send it again with the same key and body, Practor doesn't create a second record: it answers with the one the first request made, and adds the header `Idempotent-Replayed: true` so you can tell the answer is a repeat. Keys are remembered for 24 hours.",
              "examples": [
                "2f1c7a52-8f0e-4c1b-9d7e-0b6a3f4e8c21"
              ]
            },
            "required": true,
            "description": "A value you make up, new for each record you create, such as a UUID. If a create times out and you send it again with the same key and body, Practor doesn't create a second record: it answers with the one the first request made, and adds the header `Idempotent-Replayed: true` so you can tell the answer is a repeat. Keys are remembered for 24 hours."
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BillRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created. The body is what was created; its address is in the `Location` header. The invoice, and what happened to the issue and the claim you asked for. The invoice exists either way.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              },
              "Location": {
                "required": true,
                "description": "Where to read what was created.",
                "schema": {
                  "type": "string",
                  "description": "Where to read what was created."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillResult"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The record doesn't exist in this practice. A record in another practice answers the same way.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The record conflicts with one that exists (`detail` names it), or a request with the same Idempotency-Key is still running. Wait a moment and retry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 256 KB.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "415": {
            "description": "The body wasn't sent as `application/json`. Set the Content-Type header.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The body is valid JSON but breaks a rule, or the Idempotency-Key was used with a different body. `errors` lists every field that is missing or wrong, all at once.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/invoices": {
      "get": {
        "operationId": "invoiceSearch",
        "summary": "Find invoices by encounter or patient, or list the ones that changed",
        "description": "By `encounterId` or `patientId`, or with `updatedSince` for every invoice that changed since, oldest change first. While `hasMore` is true, send `nextCursor` back as `cursor`.",
        "tags": [
          "Invoices"
        ],
        "x-practor-permission": "INVOICES:READ",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl 'https://dashboard.practor.app/api/v1/invoices?encounterId=e7j3p5s9d1f4g6h8k2l0m3nb' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\""
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/invoices?encounterId=e7j3p5s9d1f4g6h8k2l0m3nb\", {\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n  },\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.get(\n    \"https://dashboard.practor.app/api/v1/invoices?encounterId=e7j3p5s9d1f4g6h8k2l0m3nb\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n    },\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "encounterId",
            "schema": {
              "description": "The visit billed.",
              "examples": [
                "e7j3p5s9d1f4g6h8k2l0m3nb"
              ],
              "type": "string"
            },
            "description": "The visit billed."
          },
          {
            "in": "query",
            "name": "patientId",
            "schema": {
              "description": "The patient's id.",
              "type": "string"
            },
            "description": "The patient's id."
          },
          {
            "in": "query",
            "name": "updatedSince",
            "schema": {
              "description": "Every invoice that changed after this moment, oldest change first. Keep the last `updatedAt` you saw and ask from there. A change appears once it is 5 seconds old, so a write still being saved can't be skipped.",
              "examples": [
                "2026-10-01T00:00:00Z"
              ],
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            },
            "description": "Every invoice that changed after this moment, oldest change first. Keep the last `updatedAt` you saw and ask from there. A change appears once it is 5 seconds old, so a write still being saved can't be skipped."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "description": "How many to answer with, from 1 to 100. The default is 50.",
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "description": "How many to answer with, from 1 to 100. The default is 50."
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "description": "The `nextCursor` of the page before, for the page after it.",
              "type": "string"
            },
            "description": "The `nextCursor` of the page before, for the page after it."
          }
        ],
        "responses": {
          "200": {
            "description": "A page of the invoices that match, in `data`. While `hasMore` is true, send `nextCursor` back as `cursor` for the next page.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceList"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "`patientId` names no patient of this practice. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/invoices/{invoiceId}": {
      "get": {
        "operationId": "invoiceRead",
        "summary": "Read an invoice",
        "tags": [
          "Invoices"
        ],
        "x-practor-permission": "INVOICES:READ",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl 'https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\""
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd\", {\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n  },\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.get(\n    \"https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n    },\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "invoiceId",
            "schema": {
              "type": "string",
              "description": "The invoice's id.",
              "examples": [
                "i2q6w8e0r4t7y1u3o5p9a6sd"
              ]
            },
            "required": true,
            "description": "The invoice's id."
          }
        ],
        "responses": {
          "200": {
            "description": "An invoice, with its lines and what has been paid.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Invoice"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The record doesn't exist in this practice. A record in another practice answers the same way.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/invoices/{invoiceId}/claim": {
      "get": {
        "operationId": "invoiceClaim",
        "summary": "Read the claim's outcome, line by line",
        "tags": [
          "Claims"
        ],
        "x-practor-permission": "CLAIMS:READ",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl 'https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/claim' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\""
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/claim\", {\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n  },\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.get(\n    \"https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/claim\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n    },\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "invoiceId",
            "schema": {
              "type": "string",
              "description": "The invoice's id.",
              "examples": [
                "i2q6w8e0r4t7y1u3o5p9a6sd"
              ]
            },
            "required": true,
            "description": "The invoice's id."
          }
        ],
        "responses": {
          "200": {
            "description": "Where an invoice's claim stands with the insurer, line by line.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Claim"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The record doesn't exist in this practice. A record in another practice answers the same way.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "claimSubmit",
        "summary": "Submit the claim for an issued invoice",
        "description": "Sends the issued invoice's claim to the insurer. The answer comes back in seconds and is read with `GET /invoices/{invoiceId}/claim` or the `claim.status_changed` webhook. Send a rejected or reversed claim again with `resubmit`. A claim is charged to the practice, so the practice needs a card on file in Practor. With no card, an overdue invoice or this month's spend cap reached, the answer is a 422 whose `detail` names the fix, and the claim is not sent.",
        "tags": [
          "Claims"
        ],
        "x-practor-permission": "CLAIMS:EXECUTE",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST 'https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/claim' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"coverageId\": \"c9d1f4g7h2j5k8l0z3x6v1bn\",\n  \"placeOfServiceCode\": \"11\"\n}'"
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/claim\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({\n    \"coverageId\": \"c9d1f4g7h2j5k8l0z3x6v1bn\",\n    \"placeOfServiceCode\": \"11\"\n  }),\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.post(\n    \"https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/claim\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n        \"Content-Type\": \"application/json\",\n    },\n    data=\"\"\"{\n  \"coverageId\": \"c9d1f4g7h2j5k8l0z3x6v1bn\",\n  \"placeOfServiceCode\": \"11\"\n}\"\"\",\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "invoiceId",
            "schema": {
              "type": "string",
              "description": "The invoice's id.",
              "examples": [
                "i2q6w8e0r4t7y1u3o5p9a6sd"
              ]
            },
            "required": true,
            "description": "The invoice's id."
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ClaimRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted. The work carries on after this answer; read the record again, or listen for its webhook, for the outcome. Where an invoice's claim stands with the insurer, line by line.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Claim"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The record doesn't exist in this practice. A record in another practice answers the same way.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The record conflicts with one that exists (`detail` names it), or a request with the same Idempotency-Key is still running. Wait a moment and retry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 256 KB.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "415": {
            "description": "The body wasn't sent as `application/json`. Set the Content-Type header.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The body is valid JSON but breaks a rule, or the Idempotency-Key was used with a different body. `errors` lists every field that is missing or wrong, all at once.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/invoices/{invoiceId}/line-items": {
      "post": {
        "operationId": "invoiceLineItemCreate",
        "summary": "Add a line to a draft invoice",
        "description": "The invoice must be a draft, or amending after `POST /invoices/{invoiceId}/amend`. Answers with the whole invoice, its totals worked out again.",
        "tags": [
          "Invoices"
        ],
        "x-practor-permission": "INVOICES:UPDATE",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST 'https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/line-items' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"code\": \"0190\",\n  \"serviceDate\": \"2026-10-01\",\n  \"quantity\": 1,\n  \"unitPrice\": 40000,\n  \"pricingSource\": \"medical_aid\",\n  \"diagnoses\": [\n    {\n      \"system\": \"http://hl7.org/fhir/sid/icd-10-za\",\n      \"code\": \"J06.9\",\n      \"primary\": true\n    }\n  ]\n}'"
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/line-items\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n    \"Idempotency-Key\": crypto.randomUUID(),\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({\n    \"code\": \"0190\",\n    \"serviceDate\": \"2026-10-01\",\n    \"quantity\": 1,\n    \"unitPrice\": 40000,\n    \"pricingSource\": \"medical_aid\",\n    \"diagnoses\": [\n      {\n        \"system\": \"http://hl7.org/fhir/sid/icd-10-za\",\n        \"code\": \"J06.9\",\n        \"primary\": true\n      }\n    ]\n  }),\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.post(\n    \"https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/line-items\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n        \"Idempotency-Key\": str(uuid.uuid4()),\n        \"Content-Type\": \"application/json\",\n    },\n    data=\"\"\"{\n  \"code\": \"0190\",\n  \"serviceDate\": \"2026-10-01\",\n  \"quantity\": 1,\n  \"unitPrice\": 40000,\n  \"pricingSource\": \"medical_aid\",\n  \"diagnoses\": [\n    {\n      \"system\": \"http://hl7.org/fhir/sid/icd-10-za\",\n      \"code\": \"J06.9\",\n      \"primary\": true\n    }\n  ]\n}\"\"\",\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "invoiceId",
            "schema": {
              "type": "string",
              "description": "The invoice's id.",
              "examples": [
                "i2q6w8e0r4t7y1u3o5p9a6sd"
              ]
            },
            "required": true,
            "description": "The invoice's id."
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255,
              "description": "A value you make up, new for each record you create, such as a UUID. If a create times out and you send it again with the same key and body, Practor doesn't create a second record: it answers with the one the first request made, and adds the header `Idempotent-Replayed: true` so you can tell the answer is a repeat. Keys are remembered for 24 hours.",
              "examples": [
                "2f1c7a52-8f0e-4c1b-9d7e-0b6a3f4e8c21"
              ]
            },
            "required": true,
            "description": "A value you make up, new for each record you create, such as a UUID. If a create times out and you send it again with the same key and body, Practor doesn't create a second record: it answers with the one the first request made, and adds the header `Idempotent-Replayed: true` so you can tell the answer is a repeat. Keys are remembered for 24 hours."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LineItemRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created. The body is what was created; its address is in the `Location` header. An invoice, with its lines and what has been paid.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              },
              "Location": {
                "required": true,
                "description": "Where to read what was created.",
                "schema": {
                  "type": "string",
                  "description": "Where to read what was created."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Invoice"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The record doesn't exist in this practice. A record in another practice answers the same way.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The record conflicts with one that exists (`detail` names it), or a request with the same Idempotency-Key is still running. Wait a moment and retry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 256 KB.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "415": {
            "description": "The body wasn't sent as `application/json`. Set the Content-Type header.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The body is valid JSON but breaks a rule, or the Idempotency-Key was used with a different body. `errors` lists every field that is missing or wrong, all at once.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/invoices/{invoiceId}/line-items/{lineItemId}": {
      "put": {
        "operationId": "invoiceLineItemUpdate",
        "summary": "Replace a line on a draft invoice, such as its price",
        "description": "Send the whole line: what the invoice's `lineItems` answered with can be sent back as it is. Change `unitPrice` to the rate you settled on, and send its `pricingSource`. Modifiers are priced by the tariff's rules, as in the dashboard.",
        "tags": [
          "Invoices"
        ],
        "x-practor-permission": "INVOICES:UPDATE",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X PUT 'https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/line-items/l8k5j2h9g6f3d0s7a4q1w8ez' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"code\": \"0190\",\n  \"serviceDate\": \"2026-10-01\",\n  \"quantity\": 1,\n  \"unitPrice\": 40000,\n  \"pricingSource\": \"medical_aid\",\n  \"diagnoses\": [\n    {\n      \"system\": \"http://hl7.org/fhir/sid/icd-10-za\",\n      \"code\": \"J06.9\",\n      \"primary\": true\n    }\n  ]\n}'"
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/line-items/l8k5j2h9g6f3d0s7a4q1w8ez\", {\n  method: \"PUT\",\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({\n    \"code\": \"0190\",\n    \"serviceDate\": \"2026-10-01\",\n    \"quantity\": 1,\n    \"unitPrice\": 40000,\n    \"pricingSource\": \"medical_aid\",\n    \"diagnoses\": [\n      {\n        \"system\": \"http://hl7.org/fhir/sid/icd-10-za\",\n        \"code\": \"J06.9\",\n        \"primary\": true\n      }\n    ]\n  }),\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.put(\n    \"https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/line-items/l8k5j2h9g6f3d0s7a4q1w8ez\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n        \"Content-Type\": \"application/json\",\n    },\n    data=\"\"\"{\n  \"code\": \"0190\",\n  \"serviceDate\": \"2026-10-01\",\n  \"quantity\": 1,\n  \"unitPrice\": 40000,\n  \"pricingSource\": \"medical_aid\",\n  \"diagnoses\": [\n    {\n      \"system\": \"http://hl7.org/fhir/sid/icd-10-za\",\n      \"code\": \"J06.9\",\n      \"primary\": true\n    }\n  ]\n}\"\"\",\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "invoiceId",
            "schema": {
              "type": "string",
              "description": "The invoice's id.",
              "examples": [
                "i2q6w8e0r4t7y1u3o5p9a6sd"
              ]
            },
            "required": true,
            "description": "The invoice's id."
          },
          {
            "in": "path",
            "name": "lineItemId",
            "schema": {
              "type": "string",
              "description": "The invoice line's id.",
              "examples": [
                "l8k5j2h9g6f3d0s7a4q1w8ez"
              ]
            },
            "required": true,
            "description": "The invoice line's id."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LineItemRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Replaced. The body is the record as it is now. An invoice, with its lines and what has been paid.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Invoice"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The record doesn't exist in this practice. A record in another practice answers the same way.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The record conflicts with one that exists (`detail` names it), or a request with the same Idempotency-Key is still running. Wait a moment and retry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 256 KB.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "415": {
            "description": "The body wasn't sent as `application/json`. Set the Content-Type header.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The body is valid JSON but breaks a rule, or the Idempotency-Key was used with a different body. `errors` lists every field that is missing or wrong, all at once.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "invoiceLineItemDelete",
        "summary": "Remove a line from a draft invoice",
        "tags": [
          "Invoices"
        ],
        "x-practor-permission": "INVOICES:UPDATE",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X DELETE 'https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/line-items/l8k5j2h9g6f3d0s7a4q1w8ez' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\""
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/line-items/l8k5j2h9g6f3d0s7a4q1w8ez\", {\n  method: \"DELETE\",\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n  },\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.delete(\n    \"https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/line-items/l8k5j2h9g6f3d0s7a4q1w8ez\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n    },\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "invoiceId",
            "schema": {
              "type": "string",
              "description": "The invoice's id.",
              "examples": [
                "i2q6w8e0r4t7y1u3o5p9a6sd"
              ]
            },
            "required": true,
            "description": "The invoice's id."
          },
          {
            "in": "path",
            "name": "lineItemId",
            "schema": {
              "type": "string",
              "description": "The invoice line's id.",
              "examples": [
                "l8k5j2h9g6f3d0s7a4q1w8ez"
              ]
            },
            "required": true,
            "description": "The invoice line's id."
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted. An invoice, with its lines and what has been paid.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Invoice"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The record doesn't exist in this practice. A record in another practice answers the same way.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The record conflicts with one that exists (`detail` names it), or a request with the same Idempotency-Key is still running. Wait a moment and retry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 256 KB.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "415": {
            "description": "The body wasn't sent as `application/json`. Set the Content-Type header.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The body is valid JSON but breaks a rule, or the Idempotency-Key was used with a different body. `errors` lists every field that is missing or wrong, all at once.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/invoices/{invoiceId}/line-items/{lineItemId}/rates": {
      "get": {
        "operationId": "invoiceLineItemRates",
        "summary": "List the prices Practor knows for a line",
        "description": "From the most particular to the most general: the practitioner's or practice's own price, the patient's medical insurance plan or scheme, a professional body's tariff, and the default price on a practice's own code. Each says the `pricingSource` to send with it.",
        "tags": [
          "Invoices"
        ],
        "x-practor-permission": "INVOICES:READ",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl 'https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/line-items/l8k5j2h9g6f3d0s7a4q1w8ez/rates' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\""
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/line-items/l8k5j2h9g6f3d0s7a4q1w8ez/rates\", {\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n  },\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.get(\n    \"https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/line-items/l8k5j2h9g6f3d0s7a4q1w8ez/rates\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n    },\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "invoiceId",
            "schema": {
              "type": "string",
              "description": "The invoice's id.",
              "examples": [
                "i2q6w8e0r4t7y1u3o5p9a6sd"
              ]
            },
            "required": true,
            "description": "The invoice's id."
          },
          {
            "in": "path",
            "name": "lineItemId",
            "schema": {
              "type": "string",
              "description": "The invoice line's id.",
              "examples": [
                "l8k5j2h9g6f3d0s7a4q1w8ez"
              ]
            },
            "required": true,
            "description": "The invoice line's id."
          }
        ],
        "responses": {
          "200": {
            "description": "A page of the rates that match, in `data`. While `hasMore` is true, send `nextCursor` back as `cursor` for the next page.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RateList"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The record doesn't exist in this practice. A record in another practice answers the same way.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/invoices/{invoiceId}/issue": {
      "post": {
        "operationId": "invoiceIssue",
        "summary": "Issue a draft invoice",
        "description": "Checks the codes may be billed together, works out the totals, and tells the patient the invoice is ready. A draft or amending invoice can be issued; anything else is refused with 422.",
        "tags": [
          "Invoices"
        ],
        "x-practor-permission": "INVOICES:UPDATE",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST 'https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/issue' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\""
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/issue\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n  },\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.post(\n    \"https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/issue\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n    },\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "invoiceId",
            "schema": {
              "type": "string",
              "description": "The invoice's id.",
              "examples": [
                "i2q6w8e0r4t7y1u3o5p9a6sd"
              ]
            },
            "required": true,
            "description": "The invoice's id."
          }
        ],
        "responses": {
          "200": {
            "description": "Done. An invoice, with its lines and what has been paid.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Invoice"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The record doesn't exist in this practice. A record in another practice answers the same way.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The record conflicts with one that exists (`detail` names it), or a request with the same Idempotency-Key is still running. Wait a moment and retry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 256 KB.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "415": {
            "description": "The body wasn't sent as `application/json`. Set the Content-Type header.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The body is valid JSON but breaks a rule, or the Idempotency-Key was used with a different body. `errors` lists every field that is missing or wrong, all at once.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/invoices/{invoiceId}/amend": {
      "post": {
        "operationId": "invoiceAmend",
        "summary": "Reopen an issued invoice to change it",
        "description": "Puts an issued invoice back into amending so its lines can change, then issue it again. Allowed within 3 days of issue, before any payment, and while no claim is accepted or on its way: reverse an accepted claim first.",
        "tags": [
          "Invoices"
        ],
        "x-practor-permission": "INVOICES:UPDATE",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST 'https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/amend' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\""
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/amend\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n  },\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.post(\n    \"https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/amend\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n    },\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "invoiceId",
            "schema": {
              "type": "string",
              "description": "The invoice's id.",
              "examples": [
                "i2q6w8e0r4t7y1u3o5p9a6sd"
              ]
            },
            "required": true,
            "description": "The invoice's id."
          }
        ],
        "responses": {
          "200": {
            "description": "Done. An invoice, with its lines and what has been paid.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Invoice"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The record doesn't exist in this practice. A record in another practice answers the same way.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The record conflicts with one that exists (`detail` names it), or a request with the same Idempotency-Key is still running. Wait a moment and retry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 256 KB.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "415": {
            "description": "The body wasn't sent as `application/json`. Set the Content-Type header.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The body is valid JSON but breaks a rule, or the Idempotency-Key was used with a different body. `errors` lists every field that is missing or wrong, all at once.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/invoices/{invoiceId}/claim/readiness": {
      "get": {
        "operationId": "claimReadiness",
        "summary": "Check whether a claim would be sent",
        "description": "Every check the claim is held to before it is sent, with the ones that fail. A submit or resubmit runs the same checks and refuses with them in `errors`.",
        "tags": [
          "Claims"
        ],
        "x-practor-permission": "CLAIMS:READ",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl 'https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/claim/readiness' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\""
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/claim/readiness\", {\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n  },\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.get(\n    \"https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/claim/readiness\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n    },\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "invoiceId",
            "schema": {
              "type": "string",
              "description": "The invoice's id.",
              "examples": [
                "i2q6w8e0r4t7y1u3o5p9a6sd"
              ]
            },
            "required": true,
            "description": "The invoice's id."
          }
        ],
        "responses": {
          "200": {
            "description": "Every check a claim has to pass before it is sent, and whether it passes now.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClaimReadiness"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The record doesn't exist in this practice. A record in another practice answers the same way.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/invoices/{invoiceId}/claim/resubmit": {
      "post": {
        "operationId": "claimResubmit",
        "summary": "Resubmit a rejected or reversed claim",
        "description": "Sends a rejected or reversed claim again, as a correction of the first, from the invoice's lines as they are now. A partially accepted claim is reversed first, so its accepted lines are not billed twice.",
        "tags": [
          "Claims"
        ],
        "x-practor-permission": "CLAIMS:EXECUTE",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST 'https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/claim/resubmit' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"coverageId\": \"c9d1f4g7h2j5k8l0z3x6v1bn\",\n  \"placeOfServiceCode\": \"11\"\n}'"
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/claim/resubmit\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({\n    \"coverageId\": \"c9d1f4g7h2j5k8l0z3x6v1bn\",\n    \"placeOfServiceCode\": \"11\"\n  }),\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.post(\n    \"https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/claim/resubmit\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n        \"Content-Type\": \"application/json\",\n    },\n    data=\"\"\"{\n  \"coverageId\": \"c9d1f4g7h2j5k8l0z3x6v1bn\",\n  \"placeOfServiceCode\": \"11\"\n}\"\"\",\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "invoiceId",
            "schema": {
              "type": "string",
              "description": "The invoice's id.",
              "examples": [
                "i2q6w8e0r4t7y1u3o5p9a6sd"
              ]
            },
            "required": true,
            "description": "The invoice's id."
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ClaimRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted. The work carries on after this answer; read the record again, or listen for its webhook, for the outcome. Where an invoice's claim stands with the insurer, line by line.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Claim"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The record doesn't exist in this practice. A record in another practice answers the same way.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The record conflicts with one that exists (`detail` names it), or a request with the same Idempotency-Key is still running. Wait a moment and retry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 256 KB.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "415": {
            "description": "The body wasn't sent as `application/json`. Set the Content-Type header.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The body is valid JSON but breaks a rule, or the Idempotency-Key was used with a different body. `errors` lists every field that is missing or wrong, all at once.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/invoices/{invoiceId}/claim/reverse": {
      "post": {
        "operationId": "claimReverse",
        "summary": "Reverse an accepted claim",
        "description": "Asks the insurer to cancel an accepted or partially accepted claim, or tries again after a reversal failed. Reversed, the invoice can be amended and the claim resubmitted.",
        "tags": [
          "Claims"
        ],
        "x-practor-permission": "CLAIMS:EXECUTE",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST 'https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/claim/reverse' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\""
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/claim/reverse\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n  },\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.post(\n    \"https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/claim/reverse\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n    },\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "invoiceId",
            "schema": {
              "type": "string",
              "description": "The invoice's id.",
              "examples": [
                "i2q6w8e0r4t7y1u3o5p9a6sd"
              ]
            },
            "required": true,
            "description": "The invoice's id."
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted. The work carries on after this answer; read the record again, or listen for its webhook, for the outcome. Where an invoice's claim stands with the insurer, line by line.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Claim"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The record doesn't exist in this practice. A record in another practice answers the same way.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The record conflicts with one that exists (`detail` names it), or a request with the same Idempotency-Key is still running. Wait a moment and retry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 256 KB.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "415": {
            "description": "The body wasn't sent as `application/json`. Set the Content-Type header.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The body is valid JSON but breaks a rule, or the Idempotency-Key was used with a different body. `errors` lists every field that is missing or wrong, all at once.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/invoices/{invoiceId}/claim/cancel": {
      "post": {
        "operationId": "claimCancel",
        "summary": "Cancel a claim request that is stuck",
        "description": "Stops a submission or reversal that is still on its way, and puts the claim back to what the insurer last answered. It doesn't contact the insurer: use it for a request that never came back.",
        "tags": [
          "Claims"
        ],
        "x-practor-permission": "CLAIMS:EXECUTE",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST 'https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/claim/cancel' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\""
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/claim/cancel\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n  },\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.post(\n    \"https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/claim/cancel\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n    },\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "invoiceId",
            "schema": {
              "type": "string",
              "description": "The invoice's id.",
              "examples": [
                "i2q6w8e0r4t7y1u3o5p9a6sd"
              ]
            },
            "required": true,
            "description": "The invoice's id."
          }
        ],
        "responses": {
          "200": {
            "description": "Done. Where an invoice's claim stands with the insurer, line by line.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Claim"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The record doesn't exist in this practice. A record in another practice answers the same way.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The record conflicts with one that exists (`detail` names it), or a request with the same Idempotency-Key is still running. Wait a moment and retry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 256 KB.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "415": {
            "description": "The body wasn't sent as `application/json`. Set the Content-Type header.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The body is valid JSON but breaks a rule, or the Idempotency-Key was used with a different body. `errors` lists every field that is missing or wrong, all at once.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/invoices/{invoiceId}/payments": {
      "get": {
        "operationId": "invoicePayments",
        "summary": "List the payments made against an invoice",
        "tags": [
          "Invoices"
        ],
        "x-practor-permission": "PAYMENTS:READ",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl 'https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/payments' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\""
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/payments\", {\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n  },\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.get(\n    \"https://dashboard.practor.app/api/v1/invoices/i2q6w8e0r4t7y1u3o5p9a6sd/payments\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n    },\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "invoiceId",
            "schema": {
              "type": "string",
              "description": "The invoice's id.",
              "examples": [
                "i2q6w8e0r4t7y1u3o5p9a6sd"
              ]
            },
            "required": true,
            "description": "The invoice's id."
          }
        ],
        "responses": {
          "200": {
            "description": "A page of the payments that match, in `data`. While `hasMore` is true, send `nextCursor` back as `cursor` for the next page.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentList"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The record doesn't exist in this practice. A record in another practice answers the same way.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/code-systems": {
      "get": {
        "operationId": "codeSystemSearch",
        "summary": "List the code systems the practice can use",
        "description": "The published systems the practice can code with, and its own. Use a system's `url` as the `system` of a coding.",
        "tags": [
          "Code systems"
        ],
        "x-practor-permission": "CODE_SYSTEMS:READ",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl 'https://dashboard.practor.app/api/v1/code-systems?usage=procedure' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\""
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/code-systems?usage=procedure\", {\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n  },\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.get(\n    \"https://dashboard.practor.app/api/v1/code-systems?usage=procedure\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n    },\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "usage",
            "schema": {
              "description": "Only systems whose codes are picked for this kind of record.",
              "examples": [
                "procedure"
              ],
              "type": "string",
              "enum": [
                "procedure",
                "condition",
                "observation",
                "medication",
                "allergy",
                "immunization",
                "family-history",
                "body-site",
                "severity"
              ]
            },
            "description": "Only systems whose codes are picked for this kind of record."
          },
          {
            "in": "query",
            "name": "owner",
            "schema": {
              "description": "Only published systems, or only the practice's own.",
              "type": "string",
              "enum": [
                "practor",
                "practice"
              ]
            },
            "description": "Only published systems, or only the practice's own."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "description": "How many to answer with, from 1 to 100. The default is 50.",
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "description": "How many to answer with, from 1 to 100. The default is 50."
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "description": "The `nextCursor` of the page before, for the page after it.",
              "type": "string"
            },
            "description": "The `nextCursor` of the page before, for the page after it."
          }
        ],
        "responses": {
          "200": {
            "description": "A page of the code systems that match, in `data`. While `hasMore` is true, send `nextCursor` back as `cursor` for the next page.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CodeSystemList"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "codeSystemCreate",
        "summary": "Create one of the practice's own code systems",
        "description": "A system of the practice's own, such as the tariff it bills from. Add its codes, then send them as procedures on an encounter with the system's `url`.",
        "tags": [
          "Code systems"
        ],
        "x-practor-permission": "CODE_SYSTEMS:CREATE",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST 'https://dashboard.practor.app/api/v1/code-systems' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"name\": \"Practice tariff\",\n  \"description\": \"The procedure codes this practice bills.\",\n  \"usage\": [\n    \"procedure\"\n  ]\n}'"
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/code-systems\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n    \"Idempotency-Key\": crypto.randomUUID(),\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({\n    \"name\": \"Practice tariff\",\n    \"description\": \"The procedure codes this practice bills.\",\n    \"usage\": [\n      \"procedure\"\n    ]\n  }),\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.post(\n    \"https://dashboard.practor.app/api/v1/code-systems\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n        \"Idempotency-Key\": str(uuid.uuid4()),\n        \"Content-Type\": \"application/json\",\n    },\n    data=\"\"\"{\n  \"name\": \"Practice tariff\",\n  \"description\": \"The procedure codes this practice bills.\",\n  \"usage\": [\n    \"procedure\"\n  ]\n}\"\"\",\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255,
              "description": "A value you make up, new for each record you create, such as a UUID. If a create times out and you send it again with the same key and body, Practor doesn't create a second record: it answers with the one the first request made, and adds the header `Idempotent-Replayed: true` so you can tell the answer is a repeat. Keys are remembered for 24 hours.",
              "examples": [
                "2f1c7a52-8f0e-4c1b-9d7e-0b6a3f4e8c21"
              ]
            },
            "required": true,
            "description": "A value you make up, new for each record you create, such as a UUID. If a create times out and you send it again with the same key and body, Practor doesn't create a second record: it answers with the one the first request made, and adds the header `Idempotent-Replayed: true` so you can tell the answer is a repeat. Keys are remembered for 24 hours."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CodeSystemRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created. The body is what was created; its address is in the `Location` header. A set of codes Practor can record and bill: a published one, or one of the practice's own, such as its tariff.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              },
              "Location": {
                "required": true,
                "description": "Where to read what was created.",
                "schema": {
                  "type": "string",
                  "description": "Where to read what was created."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CodeSystem"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The record conflicts with one that exists (`detail` names it), or a request with the same Idempotency-Key is still running. Wait a moment and retry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 256 KB.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "415": {
            "description": "The body wasn't sent as `application/json`. Set the Content-Type header.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The body is valid JSON but breaks a rule, or the Idempotency-Key was used with a different body. `errors` lists every field that is missing or wrong, all at once.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/code-systems/{codeSystemId}": {
      "get": {
        "operationId": "codeSystemRead",
        "summary": "Read a code system",
        "tags": [
          "Code systems"
        ],
        "x-practor-permission": "CODE_SYSTEMS:READ",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl 'https://dashboard.practor.app/api/v1/code-systems/s3c7d1e5f9g2h6j0k4l8m2nq' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\""
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/code-systems/s3c7d1e5f9g2h6j0k4l8m2nq\", {\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n  },\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.get(\n    \"https://dashboard.practor.app/api/v1/code-systems/s3c7d1e5f9g2h6j0k4l8m2nq\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n    },\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "codeSystemId",
            "schema": {
              "type": "string",
              "description": "The code system's id.",
              "examples": [
                "s3c7d1e5f9g2h6j0k4l8m2nq"
              ]
            },
            "required": true,
            "description": "The code system's id."
          }
        ],
        "responses": {
          "200": {
            "description": "A set of codes Practor can record and bill: a published one, or one of the practice's own, such as its tariff.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CodeSystem"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The record doesn't exist in this practice. A record in another practice answers the same way.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "codeSystemUpdate",
        "summary": "Replace one of the practice's own code systems",
        "description": "Send the whole system. Its `name` makes its `url`, so it cannot change.",
        "tags": [
          "Code systems"
        ],
        "x-practor-permission": "CODE_SYSTEMS:UPDATE",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X PUT 'https://dashboard.practor.app/api/v1/code-systems/s3c7d1e5f9g2h6j0k4l8m2nq' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"name\": \"Practice tariff\",\n  \"description\": \"The procedure codes this practice bills.\",\n  \"usage\": [\n    \"procedure\"\n  ]\n}'"
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/code-systems/s3c7d1e5f9g2h6j0k4l8m2nq\", {\n  method: \"PUT\",\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({\n    \"name\": \"Practice tariff\",\n    \"description\": \"The procedure codes this practice bills.\",\n    \"usage\": [\n      \"procedure\"\n    ]\n  }),\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.put(\n    \"https://dashboard.practor.app/api/v1/code-systems/s3c7d1e5f9g2h6j0k4l8m2nq\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n        \"Content-Type\": \"application/json\",\n    },\n    data=\"\"\"{\n  \"name\": \"Practice tariff\",\n  \"description\": \"The procedure codes this practice bills.\",\n  \"usage\": [\n    \"procedure\"\n  ]\n}\"\"\",\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "codeSystemId",
            "schema": {
              "type": "string",
              "description": "The code system's id.",
              "examples": [
                "s3c7d1e5f9g2h6j0k4l8m2nq"
              ]
            },
            "required": true,
            "description": "The code system's id."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CodeSystemRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Replaced. The body is the record as it is now. A set of codes Practor can record and bill: a published one, or one of the practice's own, such as its tariff.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CodeSystem"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The record doesn't exist in this practice. A record in another practice answers the same way.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The record conflicts with one that exists (`detail` names it), or a request with the same Idempotency-Key is still running. Wait a moment and retry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 256 KB.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "415": {
            "description": "The body wasn't sent as `application/json`. Set the Content-Type header.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The body is valid JSON but breaks a rule, or the Idempotency-Key was used with a different body. `errors` lists every field that is missing or wrong, all at once.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/code-systems/{codeSystemId}/concepts": {
      "get": {
        "operationId": "codeConceptSearch",
        "summary": "List the codes in a code system",
        "description": "In code order, a page at a time.",
        "tags": [
          "Code systems"
        ],
        "x-practor-permission": "CODE_SYSTEMS:READ",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl 'https://dashboard.practor.app/api/v1/code-systems/s3c7d1e5f9g2h6j0k4l8m2nq/concepts?code=GP-' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\""
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/code-systems/s3c7d1e5f9g2h6j0k4l8m2nq/concepts?code=GP-\", {\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n  },\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.get(\n    \"https://dashboard.practor.app/api/v1/code-systems/s3c7d1e5f9g2h6j0k4l8m2nq/concepts?code=GP-\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n    },\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "codeSystemId",
            "schema": {
              "type": "string",
              "description": "The code system's id.",
              "examples": [
                "s3c7d1e5f9g2h6j0k4l8m2nq"
              ]
            },
            "required": true,
            "description": "The code system's id."
          },
          {
            "in": "query",
            "name": "code",
            "schema": {
              "description": "Codes that start with this.",
              "examples": [
                "GP-"
              ],
              "type": "string",
              "minLength": 1,
              "maxLength": 32
            },
            "description": "Codes that start with this."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "description": "How many to answer with, from 1 to 100. The default is 50.",
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "description": "How many to answer with, from 1 to 100. The default is 50."
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "description": "The `nextCursor` of the page before, for the page after it.",
              "type": "string"
            },
            "description": "The `nextCursor` of the page before, for the page after it."
          }
        ],
        "responses": {
          "200": {
            "description": "A page of the codes that match, in `data`. While `hasMore` is true, send `nextCursor` back as `cursor` for the next page.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CodeConceptList"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The record doesn't exist in this practice. A record in another practice answers the same way.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "codeConceptCreate",
        "summary": "Add a code to one of the practice's own systems",
        "description": "A code the system already has is refused with 409.",
        "tags": [
          "Code systems"
        ],
        "x-practor-permission": "CODE_SYSTEMS:UPDATE",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST 'https://dashboard.practor.app/api/v1/code-systems/s3c7d1e5f9g2h6j0k4l8m2nq/concepts' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"code\": \"GP-0190\",\n  \"display\": \"Consultation, 30 minutes\",\n  \"defaultPrice\": 45000\n}'"
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/code-systems/s3c7d1e5f9g2h6j0k4l8m2nq/concepts\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n    \"Idempotency-Key\": crypto.randomUUID(),\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({\n    \"code\": \"GP-0190\",\n    \"display\": \"Consultation, 30 minutes\",\n    \"defaultPrice\": 45000\n  }),\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.post(\n    \"https://dashboard.practor.app/api/v1/code-systems/s3c7d1e5f9g2h6j0k4l8m2nq/concepts\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n        \"Idempotency-Key\": str(uuid.uuid4()),\n        \"Content-Type\": \"application/json\",\n    },\n    data=\"\"\"{\n  \"code\": \"GP-0190\",\n  \"display\": \"Consultation, 30 minutes\",\n  \"defaultPrice\": 45000\n}\"\"\",\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "codeSystemId",
            "schema": {
              "type": "string",
              "description": "The code system's id.",
              "examples": [
                "s3c7d1e5f9g2h6j0k4l8m2nq"
              ]
            },
            "required": true,
            "description": "The code system's id."
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255,
              "description": "A value you make up, new for each record you create, such as a UUID. If a create times out and you send it again with the same key and body, Practor doesn't create a second record: it answers with the one the first request made, and adds the header `Idempotent-Replayed: true` so you can tell the answer is a repeat. Keys are remembered for 24 hours.",
              "examples": [
                "2f1c7a52-8f0e-4c1b-9d7e-0b6a3f4e8c21"
              ]
            },
            "required": true,
            "description": "A value you make up, new for each record you create, such as a UUID. If a create times out and you send it again with the same key and body, Practor doesn't create a second record: it answers with the one the first request made, and adds the header `Idempotent-Replayed: true` so you can tell the answer is a repeat. Keys are remembered for 24 hours."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CodeConceptRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created. The body is what was created; its address is in the `Location` header. One code in a code system.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              },
              "Location": {
                "required": true,
                "description": "Where to read what was created.",
                "schema": {
                  "type": "string",
                  "description": "Where to read what was created."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CodeConcept"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The record doesn't exist in this practice. A record in another practice answers the same way.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The record conflicts with one that exists (`detail` names it), or a request with the same Idempotency-Key is still running. Wait a moment and retry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 256 KB.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "415": {
            "description": "The body wasn't sent as `application/json`. Set the Content-Type header.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The body is valid JSON but breaks a rule, or the Idempotency-Key was used with a different body. `errors` lists every field that is missing or wrong, all at once.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/code-systems/{codeSystemId}/concepts/import": {
      "post": {
        "operationId": "codeConceptImport",
        "summary": "Add many codes to one of the practice's own systems",
        "description": "Up to 1000 codes in one call, such as a whole tariff. Codes the system already has are skipped and counted; each code that could not be added is listed with why.",
        "tags": [
          "Code systems"
        ],
        "x-practor-permission": "CODE_SYSTEMS:UPDATE",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X POST 'https://dashboard.practor.app/api/v1/code-systems/s3c7d1e5f9g2h6j0k4l8m2nq/concepts/import' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"concepts\": [\n    {\n      \"code\": \"GP-0190\",\n      \"display\": \"Consultation, 30 minutes\",\n      \"defaultPrice\": 45000\n    }\n  ]\n}'"
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/code-systems/s3c7d1e5f9g2h6j0k4l8m2nq/concepts/import\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({\n    \"concepts\": [\n      {\n        \"code\": \"GP-0190\",\n        \"display\": \"Consultation, 30 minutes\",\n        \"defaultPrice\": 45000\n      }\n    ]\n  }),\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.post(\n    \"https://dashboard.practor.app/api/v1/code-systems/s3c7d1e5f9g2h6j0k4l8m2nq/concepts/import\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n        \"Content-Type\": \"application/json\",\n    },\n    data=\"\"\"{\n  \"concepts\": [\n    {\n      \"code\": \"GP-0190\",\n      \"display\": \"Consultation, 30 minutes\",\n      \"defaultPrice\": 45000\n    }\n  ]\n}\"\"\",\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "codeSystemId",
            "schema": {
              "type": "string",
              "description": "The code system's id.",
              "examples": [
                "s3c7d1e5f9g2h6j0k4l8m2nq"
              ]
            },
            "required": true,
            "description": "The code system's id."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CodeConceptImportRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. How many codes an import created and skipped, and why each code in `errors` was not added.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CodeConceptImportResult"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The record doesn't exist in this practice. A record in another practice answers the same way.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The record conflicts with one that exists (`detail` names it), or a request with the same Idempotency-Key is still running. Wait a moment and retry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 256 KB.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "415": {
            "description": "The body wasn't sent as `application/json`. Set the Content-Type header.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The body is valid JSON but breaks a rule, or the Idempotency-Key was used with a different body. `errors` lists every field that is missing or wrong, all at once.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/code-systems/{codeSystemId}/concepts/{conceptId}": {
      "get": {
        "operationId": "codeConceptRead",
        "summary": "Read a code",
        "tags": [
          "Code systems"
        ],
        "x-practor-permission": "CODE_SYSTEMS:READ",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl 'https://dashboard.practor.app/api/v1/code-systems/s3c7d1e5f9g2h6j0k4l8m2nq/concepts/a7b2c6d0e4f8g1h5j9k3l7mw' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\""
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/code-systems/s3c7d1e5f9g2h6j0k4l8m2nq/concepts/a7b2c6d0e4f8g1h5j9k3l7mw\", {\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n  },\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.get(\n    \"https://dashboard.practor.app/api/v1/code-systems/s3c7d1e5f9g2h6j0k4l8m2nq/concepts/a7b2c6d0e4f8g1h5j9k3l7mw\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n    },\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "codeSystemId",
            "schema": {
              "type": "string",
              "description": "The code system's id.",
              "examples": [
                "s3c7d1e5f9g2h6j0k4l8m2nq"
              ]
            },
            "required": true,
            "description": "The code system's id."
          },
          {
            "in": "path",
            "name": "conceptId",
            "schema": {
              "type": "string",
              "description": "The code's id.",
              "examples": [
                "a7b2c6d0e4f8g1h5j9k3l7mw"
              ]
            },
            "required": true,
            "description": "The code's id."
          }
        ],
        "responses": {
          "200": {
            "description": "One code in a code system.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CodeConcept"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The record doesn't exist in this practice. A record in another practice answers the same way.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "codeConceptUpdate",
        "summary": "Replace a code in one of the practice's own systems",
        "description": "Send the whole code. Its `code` is what identifies it, so it cannot change.",
        "tags": [
          "Code systems"
        ],
        "x-practor-permission": "CODE_SYSTEMS:UPDATE",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X PUT 'https://dashboard.practor.app/api/v1/code-systems/s3c7d1e5f9g2h6j0k4l8m2nq/concepts/a7b2c6d0e4f8g1h5j9k3l7mw' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"code\": \"GP-0190\",\n  \"display\": \"Consultation, 30 minutes\",\n  \"defaultPrice\": 45000\n}'"
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/code-systems/s3c7d1e5f9g2h6j0k4l8m2nq/concepts/a7b2c6d0e4f8g1h5j9k3l7mw\", {\n  method: \"PUT\",\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({\n    \"code\": \"GP-0190\",\n    \"display\": \"Consultation, 30 minutes\",\n    \"defaultPrice\": 45000\n  }),\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.put(\n    \"https://dashboard.practor.app/api/v1/code-systems/s3c7d1e5f9g2h6j0k4l8m2nq/concepts/a7b2c6d0e4f8g1h5j9k3l7mw\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n        \"Content-Type\": \"application/json\",\n    },\n    data=\"\"\"{\n  \"code\": \"GP-0190\",\n  \"display\": \"Consultation, 30 minutes\",\n  \"defaultPrice\": 45000\n}\"\"\",\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "codeSystemId",
            "schema": {
              "type": "string",
              "description": "The code system's id.",
              "examples": [
                "s3c7d1e5f9g2h6j0k4l8m2nq"
              ]
            },
            "required": true,
            "description": "The code system's id."
          },
          {
            "in": "path",
            "name": "conceptId",
            "schema": {
              "type": "string",
              "description": "The code's id.",
              "examples": [
                "a7b2c6d0e4f8g1h5j9k3l7mw"
              ]
            },
            "required": true,
            "description": "The code's id."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CodeConceptRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Replaced. The body is the record as it is now. One code in a code system.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CodeConcept"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The record doesn't exist in this practice. A record in another practice answers the same way.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The record conflicts with one that exists (`detail` names it), or a request with the same Idempotency-Key is still running. Wait a moment and retry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 256 KB.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "415": {
            "description": "The body wasn't sent as `application/json`. Set the Content-Type header.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The body is valid JSON but breaks a rule, or the Idempotency-Key was used with a different body. `errors` lists every field that is missing or wrong, all at once.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "codeConceptDelete",
        "summary": "Remove a code from one of the practice's own systems",
        "description": "Invoices already billed with it keep the code and its description. A code still on a patient's record, such as a visit's procedures, or on a saved price is refused with 422.",
        "tags": [
          "Code systems"
        ],
        "x-practor-permission": "CODE_SYSTEMS:UPDATE",
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "curl",
            "source": "curl -X DELETE 'https://dashboard.practor.app/api/v1/code-systems/s3c7d1e5f9g2h6j0k4l8m2nq/concepts/a7b2c6d0e4f8g1h5j9k3l7mw' \\\n  -H \"Authorization: Bearer $PRACTOR_API_KEY\""
          },
          {
            "lang": "JavaScript",
            "label": "Node.js",
            "source": "const response = await fetch(\"https://dashboard.practor.app/api/v1/code-systems/s3c7d1e5f9g2h6j0k4l8m2nq/concepts/a7b2c6d0e4f8g1h5j9k3l7mw\", {\n  method: \"DELETE\",\n  headers: {\n    Authorization: `Bearer ${process.env.PRACTOR_API_KEY}`,\n  },\n});\nconst resource = await response.json();"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import os, uuid\nimport requests\n\nresponse = requests.delete(\n    \"https://dashboard.practor.app/api/v1/code-systems/s3c7d1e5f9g2h6j0k4l8m2nq/concepts/a7b2c6d0e4f8g1h5j9k3l7mw\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['PRACTOR_API_KEY']}\",\n    },\n)\nresource = response.json()"
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "codeSystemId",
            "schema": {
              "type": "string",
              "description": "The code system's id.",
              "examples": [
                "s3c7d1e5f9g2h6j0k4l8m2nq"
              ]
            },
            "required": true,
            "description": "The code system's id."
          },
          {
            "in": "path",
            "name": "conceptId",
            "schema": {
              "type": "string",
              "description": "The code's id.",
              "examples": [
                "a7b2c6d0e4f8g1h5j9k3l7mw"
              ]
            },
            "required": true,
            "description": "The code's id."
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted. The code that was removed.",
            "headers": {
              "X-Request-Id": {
                "required": true,
                "description": "Quote it if you contact support about this request.",
                "schema": {
                  "type": "string",
                  "description": "Quote it if you contact support about this request."
                }
              },
              "X-RateLimit-Limit": {
                "required": true,
                "description": "Requests allowed in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests allowed in the current window."
                }
              },
              "X-RateLimit-Remaining": {
                "required": true,
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "string",
                  "description": "Requests left in the current window."
                }
              },
              "X-RateLimit-Reset": {
                "required": true,
                "description": "When the window resets, in seconds since the Unix epoch.",
                "schema": {
                  "type": "string",
                  "description": "When the window resets, in seconds since the Unix epoch."
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedCodeConcept"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter or header is missing or malformed, or the body isn't JSON. `errors` names the parameter.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "No key was sent, or the key cannot be used: unknown, revoked or expired, its client suspended, or the call made from outside its allowed addresses. All of these answer the same way; the practice audit log names which it was.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "The client lacks the permission this endpoint needs, the practice's Integrations add-on is off, or the practice has been disabled.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "The record doesn't exist in this practice. A record in another practice answers the same way.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "This endpoint doesn't take that method. The `Allow` header names the one it does.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The record conflicts with one that exists (`detail` names it), or a request with the same Idempotency-Key is still running. Wait a moment and retry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 256 KB.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "415": {
            "description": "The body wasn't sent as `application/json`. Set the Content-Type header.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The body is valid JSON but breaks a rule, or the Idempotency-Key was used with a different body. `errors` lists every field that is missing or wrong, all at once.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on our side. Quote the X-Request-Id if you contact support.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The request couldn't be written to the practice audit log, so its result is withheld. Wait the number of seconds in the `Retry-After` header, then send it again.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {
    "invoice.issued": {
      "post": {
        "operationId": "webhookInvoiceIssued",
        "summary": "An invoice is issued",
        "description": "Sent as `invoice.issued`. Answer with any 2xx within 10 seconds. Anything else is retried with backoff, up to 8 attempts; an endpoint that keeps failing for three days is turned off and the practice is told. Verify the signature before you trust the body, and use `id` to ignore a repeat.",
        "tags": [
          "Webhooks"
        ],
        "security": [],
        "parameters": [
          {
            "in": "header",
            "name": "webhook-id",
            "schema": {
              "type": "string",
              "description": "The event id."
            },
            "required": true,
            "description": "The event id."
          },
          {
            "in": "header",
            "name": "webhook-timestamp",
            "schema": {
              "type": "string",
              "description": "Seconds since the Unix epoch when it was sent."
            },
            "required": true,
            "description": "Seconds since the Unix epoch when it was sent."
          },
          {
            "in": "header",
            "name": "webhook-signature",
            "schema": {
              "type": "string",
              "description": "Proves the delivery came from Practor. Check it before you trust the body: it's `v1,` then the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed with your endpoint's secret (drop the `whsec_` prefix, then base64-decode it). It follows the Standard Webhooks scheme, so any Standard Webhooks library can check it for you."
            },
            "required": true,
            "description": "Proves the delivery came from Practor. Check it before you trust the body: it's `v1,` then the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed with your endpoint's secret (drop the `whsec_` prefix, then base64-decode it). It follows the Standard Webhooks scheme, so any Standard Webhooks library can check it for you."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "Unique per event, and the same on every retry of it. Use it to ignore a repeat.",
                    "examples": [
                      "k2m9x7c4v5b8n1m3q6w9e2r5"
                    ]
                  },
                  "type": {
                    "type": "string",
                    "const": "invoice.issued"
                  },
                  "occurredAt": {
                    "type": "string",
                    "description": "When it happened, as an ISO 8601 date-time in UTC."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "object": {
                        "type": "string",
                        "const": "invoice",
                        "description": "What the event is about. A claim or payment event names the invoice it belongs to."
                      },
                      "id": {
                        "type": "string",
                        "examples": [
                          "i2q6w8e0r4t7y1u3o5p9a6sd"
                        ]
                      },
                      "url": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "Where to read it with your key."
                      }
                    },
                    "required": [
                      "object",
                      "id",
                      "url"
                    ]
                  }
                },
                "required": [
                  "id",
                  "type",
                  "occurredAt",
                  "data"
                ],
                "description": "What Practor sends for `invoice.issued`."
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Tell Practor you have it. Any 2xx answer stops the retries."
          }
        }
      }
    },
    "invoice.status_changed": {
      "post": {
        "operationId": "webhookInvoiceStatusChanged",
        "summary": "An invoice changes status",
        "description": "Sent as `invoice.status_changed`. Answer with any 2xx within 10 seconds. Anything else is retried with backoff, up to 8 attempts; an endpoint that keeps failing for three days is turned off and the practice is told. Verify the signature before you trust the body, and use `id` to ignore a repeat.",
        "tags": [
          "Webhooks"
        ],
        "security": [],
        "parameters": [
          {
            "in": "header",
            "name": "webhook-id",
            "schema": {
              "type": "string",
              "description": "The event id."
            },
            "required": true,
            "description": "The event id."
          },
          {
            "in": "header",
            "name": "webhook-timestamp",
            "schema": {
              "type": "string",
              "description": "Seconds since the Unix epoch when it was sent."
            },
            "required": true,
            "description": "Seconds since the Unix epoch when it was sent."
          },
          {
            "in": "header",
            "name": "webhook-signature",
            "schema": {
              "type": "string",
              "description": "Proves the delivery came from Practor. Check it before you trust the body: it's `v1,` then the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed with your endpoint's secret (drop the `whsec_` prefix, then base64-decode it). It follows the Standard Webhooks scheme, so any Standard Webhooks library can check it for you."
            },
            "required": true,
            "description": "Proves the delivery came from Practor. Check it before you trust the body: it's `v1,` then the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed with your endpoint's secret (drop the `whsec_` prefix, then base64-decode it). It follows the Standard Webhooks scheme, so any Standard Webhooks library can check it for you."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "Unique per event, and the same on every retry of it. Use it to ignore a repeat.",
                    "examples": [
                      "k2m9x7c4v5b8n1m3q6w9e2r5"
                    ]
                  },
                  "type": {
                    "type": "string",
                    "const": "invoice.status_changed"
                  },
                  "occurredAt": {
                    "type": "string",
                    "description": "When it happened, as an ISO 8601 date-time in UTC."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "object": {
                        "type": "string",
                        "const": "invoice",
                        "description": "What the event is about. A claim or payment event names the invoice it belongs to."
                      },
                      "id": {
                        "type": "string",
                        "examples": [
                          "i2q6w8e0r4t7y1u3o5p9a6sd"
                        ]
                      },
                      "url": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "Where to read it with your key."
                      }
                    },
                    "required": [
                      "object",
                      "id",
                      "url"
                    ]
                  }
                },
                "required": [
                  "id",
                  "type",
                  "occurredAt",
                  "data"
                ],
                "description": "What Practor sends for `invoice.status_changed`."
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Tell Practor you have it. Any 2xx answer stops the retries."
          }
        }
      }
    },
    "claim.status_changed": {
      "post": {
        "operationId": "webhookClaimStatusChanged",
        "summary": "A claim changes status",
        "description": "Sent as `claim.status_changed`. Answer with any 2xx within 10 seconds. Anything else is retried with backoff, up to 8 attempts; an endpoint that keeps failing for three days is turned off and the practice is told. Verify the signature before you trust the body, and use `id` to ignore a repeat.",
        "tags": [
          "Webhooks"
        ],
        "security": [],
        "parameters": [
          {
            "in": "header",
            "name": "webhook-id",
            "schema": {
              "type": "string",
              "description": "The event id."
            },
            "required": true,
            "description": "The event id."
          },
          {
            "in": "header",
            "name": "webhook-timestamp",
            "schema": {
              "type": "string",
              "description": "Seconds since the Unix epoch when it was sent."
            },
            "required": true,
            "description": "Seconds since the Unix epoch when it was sent."
          },
          {
            "in": "header",
            "name": "webhook-signature",
            "schema": {
              "type": "string",
              "description": "Proves the delivery came from Practor. Check it before you trust the body: it's `v1,` then the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed with your endpoint's secret (drop the `whsec_` prefix, then base64-decode it). It follows the Standard Webhooks scheme, so any Standard Webhooks library can check it for you."
            },
            "required": true,
            "description": "Proves the delivery came from Practor. Check it before you trust the body: it's `v1,` then the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed with your endpoint's secret (drop the `whsec_` prefix, then base64-decode it). It follows the Standard Webhooks scheme, so any Standard Webhooks library can check it for you."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "Unique per event, and the same on every retry of it. Use it to ignore a repeat.",
                    "examples": [
                      "k2m9x7c4v5b8n1m3q6w9e2r5"
                    ]
                  },
                  "type": {
                    "type": "string",
                    "const": "claim.status_changed"
                  },
                  "occurredAt": {
                    "type": "string",
                    "description": "When it happened, as an ISO 8601 date-time in UTC."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "object": {
                        "type": "string",
                        "const": "invoice",
                        "description": "What the event is about. A claim or payment event names the invoice it belongs to."
                      },
                      "id": {
                        "type": "string",
                        "examples": [
                          "i2q6w8e0r4t7y1u3o5p9a6sd"
                        ]
                      },
                      "url": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "Where to read it with your key."
                      }
                    },
                    "required": [
                      "object",
                      "id",
                      "url"
                    ]
                  }
                },
                "required": [
                  "id",
                  "type",
                  "occurredAt",
                  "data"
                ],
                "description": "What Practor sends for `claim.status_changed`."
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Tell Practor you have it. Any 2xx answer stops the retries."
          }
        }
      }
    },
    "payment.recorded": {
      "post": {
        "operationId": "webhookPaymentRecorded",
        "summary": "A payment is recorded",
        "description": "Sent as `payment.recorded`. Answer with any 2xx within 10 seconds. Anything else is retried with backoff, up to 8 attempts; an endpoint that keeps failing for three days is turned off and the practice is told. Verify the signature before you trust the body, and use `id` to ignore a repeat.",
        "tags": [
          "Webhooks"
        ],
        "security": [],
        "parameters": [
          {
            "in": "header",
            "name": "webhook-id",
            "schema": {
              "type": "string",
              "description": "The event id."
            },
            "required": true,
            "description": "The event id."
          },
          {
            "in": "header",
            "name": "webhook-timestamp",
            "schema": {
              "type": "string",
              "description": "Seconds since the Unix epoch when it was sent."
            },
            "required": true,
            "description": "Seconds since the Unix epoch when it was sent."
          },
          {
            "in": "header",
            "name": "webhook-signature",
            "schema": {
              "type": "string",
              "description": "Proves the delivery came from Practor. Check it before you trust the body: it's `v1,` then the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed with your endpoint's secret (drop the `whsec_` prefix, then base64-decode it). It follows the Standard Webhooks scheme, so any Standard Webhooks library can check it for you."
            },
            "required": true,
            "description": "Proves the delivery came from Practor. Check it before you trust the body: it's `v1,` then the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed with your endpoint's secret (drop the `whsec_` prefix, then base64-decode it). It follows the Standard Webhooks scheme, so any Standard Webhooks library can check it for you."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "Unique per event, and the same on every retry of it. Use it to ignore a repeat.",
                    "examples": [
                      "k2m9x7c4v5b8n1m3q6w9e2r5"
                    ]
                  },
                  "type": {
                    "type": "string",
                    "const": "payment.recorded"
                  },
                  "occurredAt": {
                    "type": "string",
                    "description": "When it happened, as an ISO 8601 date-time in UTC."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "object": {
                        "type": "string",
                        "const": "invoice",
                        "description": "What the event is about. A claim or payment event names the invoice it belongs to."
                      },
                      "id": {
                        "type": "string",
                        "examples": [
                          "i2q6w8e0r4t7y1u3o5p9a6sd"
                        ]
                      },
                      "url": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "Where to read it with your key."
                      }
                    },
                    "required": [
                      "object",
                      "id",
                      "url"
                    ]
                  }
                },
                "required": [
                  "id",
                  "type",
                  "occurredAt",
                  "data"
                ],
                "description": "What Practor sends for `payment.recorded`."
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Tell Practor you have it. Any 2xx answer stops the retries."
          }
        }
      }
    },
    "coverage.verified": {
      "post": {
        "operationId": "webhookCoverageVerified",
        "summary": "A patient's medical insurance is checked with the insurer",
        "description": "Sent as `coverage.verified`. Answer with any 2xx within 10 seconds. Anything else is retried with backoff, up to 8 attempts; an endpoint that keeps failing for three days is turned off and the practice is told. Verify the signature before you trust the body, and use `id` to ignore a repeat.",
        "tags": [
          "Webhooks"
        ],
        "security": [],
        "parameters": [
          {
            "in": "header",
            "name": "webhook-id",
            "schema": {
              "type": "string",
              "description": "The event id."
            },
            "required": true,
            "description": "The event id."
          },
          {
            "in": "header",
            "name": "webhook-timestamp",
            "schema": {
              "type": "string",
              "description": "Seconds since the Unix epoch when it was sent."
            },
            "required": true,
            "description": "Seconds since the Unix epoch when it was sent."
          },
          {
            "in": "header",
            "name": "webhook-signature",
            "schema": {
              "type": "string",
              "description": "Proves the delivery came from Practor. Check it before you trust the body: it's `v1,` then the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed with your endpoint's secret (drop the `whsec_` prefix, then base64-decode it). It follows the Standard Webhooks scheme, so any Standard Webhooks library can check it for you."
            },
            "required": true,
            "description": "Proves the delivery came from Practor. Check it before you trust the body: it's `v1,` then the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed with your endpoint's secret (drop the `whsec_` prefix, then base64-decode it). It follows the Standard Webhooks scheme, so any Standard Webhooks library can check it for you."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "Unique per event, and the same on every retry of it. Use it to ignore a repeat.",
                    "examples": [
                      "k2m9x7c4v5b8n1m3q6w9e2r5"
                    ]
                  },
                  "type": {
                    "type": "string",
                    "const": "coverage.verified"
                  },
                  "occurredAt": {
                    "type": "string",
                    "description": "When it happened, as an ISO 8601 date-time in UTC."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "object": {
                        "type": "string",
                        "const": "coverage",
                        "description": "The coverage that was checked. Read it for `verificationStatus` and `verificationMessage`."
                      },
                      "id": {
                        "type": "string",
                        "examples": [
                          "c9d1f4g7h2j5k8l0z3x6v1bn"
                        ]
                      },
                      "url": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "Where to read it with your key."
                      }
                    },
                    "required": [
                      "object",
                      "id",
                      "url"
                    ]
                  }
                },
                "required": [
                  "id",
                  "type",
                  "occurredAt",
                  "data"
                ],
                "description": "What Practor sends for `coverage.verified`."
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Tell Practor you have it. Any 2xx answer stops the retries."
          }
        }
      }
    },
    "webhook.test": {
      "post": {
        "operationId": "webhookTest",
        "summary": "A test event",
        "description": "Sent as `webhook.test`, once, when someone at the practice picks \"Send a test event\" on the endpoint. Answer it like any other.",
        "tags": [
          "Webhooks"
        ],
        "security": [],
        "parameters": [
          {
            "in": "header",
            "name": "webhook-id",
            "schema": {
              "type": "string",
              "description": "The event id."
            },
            "required": true,
            "description": "The event id."
          },
          {
            "in": "header",
            "name": "webhook-timestamp",
            "schema": {
              "type": "string",
              "description": "Seconds since the Unix epoch when it was sent."
            },
            "required": true,
            "description": "Seconds since the Unix epoch when it was sent."
          },
          {
            "in": "header",
            "name": "webhook-signature",
            "schema": {
              "type": "string",
              "description": "Proves the delivery came from Practor. Check it before you trust the body: it's `v1,` then the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed with your endpoint's secret (drop the `whsec_` prefix, then base64-decode it). It follows the Standard Webhooks scheme, so any Standard Webhooks library can check it for you."
            },
            "required": true,
            "description": "Proves the delivery came from Practor. Check it before you trust the body: it's `v1,` then the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed with your endpoint's secret (drop the `whsec_` prefix, then base64-decode it). It follows the Standard Webhooks scheme, so any Standard Webhooks library can check it for you."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string",
                    "const": "webhook.test"
                  },
                  "occurredAt": {
                    "type": "string"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "message": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "message"
                    ]
                  }
                },
                "required": [
                  "id",
                  "type",
                  "occurredAt",
                  "data"
                ],
                "description": "Sent when someone at the practice presses \"Send test event\"."
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Tell Practor you have it."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "PatientRequest": {
        "type": "object",
        "properties": {
          "prefix": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "mr",
                  "ms",
                  "mrs",
                  "mx",
                  "master",
                  "miss",
                  "dr",
                  "prof",
                  "assoc_prof",
                  "asst_prof",
                  "md",
                  "do",
                  "phd",
                  "np",
                  "pa",
                  "rn",
                  "lpn",
                  "cna",
                  "rev",
                  "hon"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "givenNames": {
            "minItems": 1,
            "maxItems": 10,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          "lastName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "gender": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "male",
                  "female",
                  "other",
                  "unknown"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "birthDate": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
          },
          "identifiers": {
            "anyOf": [
              {
                "maxItems": 10,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "za",
                        "dl",
                        "ppn",
                        "brn",
                        "mr",
                        "mcn",
                        "en",
                        "tax",
                        "niip",
                        "prn",
                        "md",
                        "dr",
                        "acsn",
                        "udi",
                        "sno",
                        "sb",
                        "plac",
                        "fill",
                        "jhn",
                        "vat",
                        "abn",
                        "acn",
                        "ein",
                        "state_tax",
                        "uk_vat",
                        "uk_company",
                        "npi",
                        "npi_org",
                        "hpcsa",
                        "sanc",
                        "sapc",
                        "sacnasp",
                        "hpcsa_disp",
                        "bhf",
                        "gmc",
                        "nhs_ods",
                        "ahpra",
                        "medicare_au",
                        "medicare_us",
                        "medicaid"
                      ],
                      "description": "What kind of identifier it is, such as `za` for a South African ID number or `ppn` for a passport."
                    },
                    "value": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    }
                  },
                  "required": [
                    "type",
                    "value"
                  ]
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "externalId": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ExternalId"
              },
              {
                "type": "null"
              }
            ]
          },
          "contactPoints": {
            "anyOf": [
              {
                "maxItems": 10,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "system": {
                      "type": "string",
                      "enum": [
                        "phone",
                        "fax",
                        "email",
                        "pager",
                        "url",
                        "sms",
                        "other"
                      ]
                    },
                    "value": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 255
                    },
                    "use": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "home",
                            "work",
                            "temp",
                            "old",
                            "mobile"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "rank": {
                      "description": "Order of preference, 1 first.",
                      "anyOf": [
                        {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 2147483647
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "system",
                    "value"
                  ]
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "addresses": {
            "anyOf": [
              {
                "maxItems": 5,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "physical",
                            "postal",
                            "both"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "use": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "home",
                            "work",
                            "temp",
                            "old",
                            "billing"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "lines": {
                      "anyOf": [
                        {
                          "maxItems": 5,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "maxLength": 200
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "city": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "district": {
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 100
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "state": {
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 100
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "postalCode": {
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 20
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "country": {
                      "description": "Two-letter ISO country code.",
                      "examples": [
                        "ZA"
                      ],
                      "type": "string"
                    }
                  },
                  "required": [
                    "city",
                    "country"
                  ]
                }
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "givenNames",
          "lastName",
          "birthDate"
        ],
        "description": "A patient to register, or the whole patient to replace one with.",
        "examples": [
          {
            "givenNames": [
              "Thandi"
            ],
            "lastName": "Mokoena",
            "gender": "female",
            "birthDate": "1985-06-12",
            "externalId": {
              "system": "urn:your-clinic:patient",
              "value": "12345"
            },
            "contactPoints": [
              {
                "system": "email",
                "value": "thandi@example.com"
              }
            ]
          }
        ]
      },
      "ExternalId": {
        "type": "object",
        "properties": {
          "system": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "Names your system, so two systems can use the same number. Any URI you choose.",
            "examples": [
              "urn:your-clinic:patient"
            ]
          },
          "value": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "examples": [
              "12345"
            ]
          }
        },
        "required": [
          "system",
          "value"
        ],
        "description": "The patient's number in your own system. One per patient; Practor refuses a second patient with the same one."
      },
      "CoverageRequest": {
        "type": "object",
        "properties": {
          "patientId": {
            "type": "string",
            "minLength": 1
          },
          "type": {
            "type": "string",
            "enum": [
              "insurance",
              "self_pay"
            ]
          },
          "status": {
            "default": "active",
            "type": "string",
            "enum": [
              "active",
              "cancelled",
              "draft",
              "entered_in_error"
            ]
          },
          "relationship": {
            "description": "How the patient is related to the main member.",
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "child",
                  "parent",
                  "spouse",
                  "common",
                  "other",
                  "self",
                  "injured"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "memberNumber": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 50
              },
              {
                "type": "null"
              }
            ]
          },
          "dependentCode": {
            "description": "The dependant code on the membership, such as `01`.",
            "anyOf": [
              {
                "type": "string",
                "maxLength": 10
              },
              {
                "type": "null"
              }
            ]
          },
          "insurerId": {
            "description": "Leave it out and Practor sets it from the plan. With `planOptionCode`, it picks between insurers whose plans share an option code.",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "null"
              }
            ]
          },
          "planId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "null"
              }
            ]
          },
          "planOptionCode": {
            "description": "The plan by its option code, instead of `planId`. Several insurers can share a code, so send `insurerId` with it.",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 40
              },
              {
                "type": "null"
              }
            ]
          },
          "priority": {
            "description": "Which coverage is claimed from first, 1 first.",
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1,
                "maximum": 10
              },
              {
                "type": "null"
              }
            ]
          },
          "paymentMethod": {
            "description": "How a private-pay patient pays.",
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "bank_transfer",
                  "card",
                  "cash",
                  "check",
                  "debit_order",
                  "medical_aid",
                  "mobile_payment",
                  "other"
                ]
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "patientId",
          "type"
        ],
        "description": "Medical insurance or private pay to record for a patient, or the whole coverage to replace one with.",
        "examples": [
          {
            "patientId": "k3v9x2m8q1w7e4r6t0y5u2ia",
            "type": "insurance",
            "memberNumber": "900123456",
            "dependentCode": "01",
            "relationship": "self",
            "planId": "n6m1b5v8c2x4z7a9s3d0f5gh"
          }
        ]
      },
      "EncounterRequest": {
        "type": "object",
        "properties": {
          "status": {
            "default": "completed",
            "type": "string",
            "const": "completed"
          },
          "patientId": {
            "type": "string",
            "minLength": 1
          },
          "practitionerId": {
            "type": "string",
            "minLength": 1
          },
          "start": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "end": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "diagnoses": {
            "minItems": 1,
            "maxItems": 12,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "system": {
                  "description": "The code system, by its URL. Left out, the practitioner's default system for that kind of code.",
                  "examples": [
                    "http://hl7.org/fhir/sid/icd-10"
                  ],
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "code": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 40
                },
                "display": {
                  "description": "Ignored on the way in: Practor records its own wording for the code.",
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 500
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "code"
              ]
            },
            "description": "In order of importance: the first is the primary diagnosis."
          },
          "procedures": {
            "minItems": 1,
            "maxItems": 40,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "system": {
                  "description": "The code system, by its URL. Left out, the practitioner's default system for that kind of code.",
                  "examples": [
                    "http://hl7.org/fhir/sid/icd-10"
                  ],
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "code": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 40
                },
                "display": {
                  "description": "Ignored on the way in: Practor records its own wording for the code.",
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 500
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "diagnosisCodes": {
                  "description": "The diagnoses this procedure was done for, by their `code` in `diagnoses`. The first is the primary one on the claim.",
                  "anyOf": [
                    {
                      "maxItems": 4,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "note": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 1000
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "code"
              ]
            }
          }
        },
        "required": [
          "patientId",
          "practitionerId",
          "start",
          "end",
          "diagnoses",
          "procedures"
        ],
        "description": "A finished visit, with its diagnoses and procedures.",
        "examples": [
          {
            "patientId": "k3v9x2m8q1w7e4r6t0y5u2ia",
            "practitionerId": "p4n8b6r2t9y3u7i1o5a0s8dm",
            "start": "2026-10-01T09:00:00+02:00",
            "end": "2026-10-01T09:45:00+02:00",
            "diagnoses": [
              {
                "code": "J06.9"
              }
            ],
            "procedures": [
              {
                "code": "0190",
                "diagnosisCodes": [
                  "J06.9"
                ]
              }
            ]
          }
        ]
      },
      "BillRequest": {
        "type": "object",
        "properties": {
          "issue": {
            "default": false,
            "description": "`true` issues the invoice and tells the patient. The client needs Update on Invoices.",
            "type": "boolean"
          },
          "submitClaim": {
            "default": false,
            "description": "`true` sends the claim to the insurer. Send `issue` as `true` too; the client needs Submit on Claims.",
            "type": "boolean"
          },
          "coverageId": {
            "description": "The coverage to claim from. Left out, the patient's first active one.",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "null"
              }
            ]
          },
          "placeOfServiceCode": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 4
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "description": "What to do after the invoice is drafted. Send no body at all to draft it and leave it for the practice to review.",
        "examples": [
          {
            "issue": true,
            "submitClaim": true,
            "coverageId": "c9d1f4g7h2j5k8l0z3x6v1bn"
          }
        ]
      },
      "ClaimRequest": {
        "type": "object",
        "properties": {
          "coverageId": {
            "description": "The coverage to claim from. Left out, the one the invoice was last claimed against, else the patient's first active one.",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "null"
              }
            ]
          },
          "placeOfServiceCode": {
            "description": "Where the service was given, as the insurer codes it. Left out, the invoice's own.",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 4
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "description": "Which cover to claim from, and where the service was given. Both are optional.",
        "examples": [
          {
            "coverageId": "c9d1f4g7h2j5k8l0z3x6v1bn",
            "placeOfServiceCode": "11"
          }
        ]
      },
      "LineItemRequest": {
        "type": "object",
        "properties": {
          "system": {
            "description": "The code system's URL. Left out, the practitioner's default for this kind of code.",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ]
          },
          "code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "description": "The procedure or tariff code."
          },
          "description": {
            "description": "What the patient sees on the line. Left out, the code's own description.",
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ]
          },
          "serviceDate": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "description": "When the service was given.",
            "examples": [
              "2026-10-01"
            ]
          },
          "serviceDateEnd": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "When a service that ran over several days ended.",
                "examples": [
                  "2026-10-01"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "quantity": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 10000,
            "examples": [
              1
            ]
          },
          "unitPrice": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "The price of one, in the currency's minor unit. Read the line's rates for the prices Practor knows.",
            "examples": [
              45000
            ]
          },
          "pricingSource": {
            "description": "Where `unitPrice` came from. Send the `pricingSource` of the rate you chose; left out, the price counts as set by hand.",
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "governing_body",
                  "medical_aid",
                  "custom",
                  "favorite"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "modifiers": {
            "description": "Tariff modifiers, which can change what the line is billed at.",
            "anyOf": [
              {
                "maxItems": 4,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 16
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "diagnoses": {
            "description": "What the line treats. Mark one `primary`; left unmarked, the first is. A claim needs at least one.",
            "anyOf": [
              {
                "maxItems": 12,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "system": {
                      "description": "The code system's URL. Left out, the practitioner's default for this kind of code.",
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "code": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    },
                    "primary": {
                      "anyOf": [
                        {
                          "type": "boolean"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "code"
                  ]
                }
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "code",
          "serviceDate",
          "quantity",
          "unitPrice"
        ],
        "description": "A line on a draft or amending invoice.",
        "examples": [
          {
            "code": "0190",
            "serviceDate": "2026-10-01",
            "quantity": 1,
            "unitPrice": 40000,
            "pricingSource": "medical_aid",
            "diagnoses": [
              {
                "system": "http://hl7.org/fhir/sid/icd-10-za",
                "code": "J06.9",
                "primary": true
              }
            ]
          }
        ]
      },
      "CodeSystemRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60,
            "description": "What a practitioner sees in the code picker. It also makes the system's `url`, so it cannot be changed once the system exists."
          },
          "title": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 1000
              },
              {
                "type": "null"
              }
            ]
          },
          "usage": {
            "minItems": 1,
            "maxItems": 9,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "procedure",
                "condition",
                "observation",
                "medication",
                "allergy",
                "immunization",
                "family-history",
                "body-site",
                "severity"
              ]
            }
          }
        },
        "required": [
          "name",
          "usage"
        ],
        "description": "One of the practice's own code systems.",
        "examples": [
          {
            "name": "Practice tariff",
            "description": "The procedure codes this practice bills.",
            "usage": [
              "procedure"
            ]
          }
        ]
      },
      "CodeConceptRequest": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._-]{1,32}$"
          },
          "display": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "definition": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ]
          },
          "usage": {
            "description": "Kinds of record it is picked for beyond its system's own.",
            "anyOf": [
              {
                "maxItems": 9,
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "procedure",
                    "condition",
                    "observation",
                    "medication",
                    "allergy",
                    "immunization",
                    "family-history",
                    "body-site",
                    "severity"
                  ]
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "defaultPrice": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1,
                "maximum": 1000000000,
                "description": "What a line with this code starts at when nothing more particular is known, in the practice's currency's minor unit (cents for ZAR).",
                "examples": [
                  45000
                ]
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "code",
          "display"
        ],
        "description": "One code, with the price a line starts at when nothing more particular is known.",
        "examples": [
          {
            "code": "GP-0190",
            "display": "Consultation, 30 minutes",
            "defaultPrice": 45000
          }
        ]
      },
      "CodeConceptImportRequest": {
        "type": "object",
        "properties": {
          "concepts": {
            "minItems": 1,
            "maxItems": 1000,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CodeConceptRequest"
            }
          }
        },
        "required": [
          "concepts"
        ],
        "description": "Up to 1000 codes for one system. A code the system already has is skipped and left as it is.",
        "examples": [
          {
            "concepts": [
              {
                "code": "GP-0190",
                "display": "Consultation, 30 minutes",
                "defaultPrice": 45000
              }
            ]
          }
        ]
      },
      "PractitionerList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Practitioner"
            }
          },
          "hasMore": {
            "type": "boolean",
            "description": "Whether another page follows this one."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Send it as `cursor` for the next page. Null on the last page."
          }
        },
        "required": [
          "object",
          "data",
          "hasMore",
          "nextCursor"
        ],
        "description": "A page of the practitioners that match, in `data`. While `hasMore` is true, send `nextCursor` back as `cursor` for the next page."
      },
      "Practitioner": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "practitioner"
          },
          "id": {
            "type": "string"
          },
          "prefix": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "givenNames": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "lastName": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "displayName": {
            "type": "string",
            "description": "The name to show a person."
          },
          "gender": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "registrationNumbers": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Professional registration numbers, including the one claims are sent with (an HPCSA number, for example)."
          }
        },
        "required": [
          "object",
          "id",
          "prefix",
          "givenNames",
          "lastName",
          "displayName",
          "gender",
          "registrationNumbers"
        ],
        "description": "A practitioner at the practice, to name who saw a patient.",
        "examples": [
          {
            "object": "practitioner",
            "id": "p4n8b6r2t9y3u7i1o5a0s8dm",
            "prefix": "dr",
            "givenNames": [
              "Sanjay"
            ],
            "lastName": "Naidoo",
            "displayName": "Dr Sanjay Naidoo",
            "gender": "male",
            "registrationNumbers": [
              "MP0123456"
            ]
          }
        ]
      },
      "Problem": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Where the error is explained: `https://developers.practor.app/guides/errors#` and the code, with hyphens for underscores.",
            "examples": [
              "https://developers.practor.app/guides/errors#validation-failed"
            ]
          },
          "title": {
            "type": "string",
            "description": "A short summary of the kind of problem."
          },
          "status": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "The HTTP status, repeated."
          },
          "detail": {
            "type": "string",
            "description": "What went wrong with this request, in a sentence you can show a person."
          },
          "code": {
            "type": "string",
            "enum": [
              "invalid_request",
              "invalid_cursor",
              "validation_failed",
              "unauthenticated",
              "forbidden",
              "addon_inactive",
              "organization_disabled",
              "not_found",
              "method_not_allowed",
              "conflict",
              "duplicate",
              "business_rule",
              "unprocessable",
              "idempotency_key_reused",
              "payload_too_large",
              "unsupported_media_type",
              "rate_limited",
              "internal_error",
              "service_unavailable"
            ],
            "description": "The kind of problem. It stays the same across releases, so branch on it."
          },
          "requestId": {
            "type": "string",
            "description": "The same as the X-Request-Id header. Quote it if you contact support."
          },
          "errors": {
            "description": "One entry per field that is missing or wrong, all at once, so you can fix a request in one round trip.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FieldError"
            }
          }
        },
        "required": [
          "type",
          "title",
          "status",
          "detail",
          "code",
          "requestId"
        ],
        "description": "What was wrong with the request.",
        "examples": [
          {
            "type": "https://developers.practor.app/guides/errors#validation-failed",
            "title": "Some fields are missing or wrong",
            "status": 422,
            "detail": "Fix the fields listed in errors and send it again.",
            "code": "validation_failed",
            "requestId": "x9k2m4p7q1w8e3r6t5y0u2i4",
            "errors": [
              {
                "field": "lastName",
                "code": "required",
                "message": "Send lastName."
              },
              {
                "field": "birthDate",
                "code": "invalid",
                "message": "birthDate must be a real date, written YYYY-MM-DD"
              }
            ]
          }
        ]
      },
      "FieldError": {
        "type": "object",
        "properties": {
          "field": {
            "type": "string",
            "description": "The field, query parameter or header the problem is in. A field in the body is a dotted path, such as `givenNames.0` or `procedures.1.code`.",
            "examples": [
              "birthDate"
            ]
          },
          "code": {
            "type": "string",
            "enum": [
              "required",
              "invalid"
            ],
            "description": "`required` when it was left out, `invalid` when its value is wrong."
          },
          "message": {
            "type": "string",
            "description": "What was wrong, in a sentence you can show a person."
          }
        },
        "required": [
          "field",
          "code",
          "message"
        ]
      },
      "PatientList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Patient"
            }
          },
          "hasMore": {
            "type": "boolean",
            "description": "Whether another page follows this one."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Send it as `cursor` for the next page. Null on the last page."
          }
        },
        "required": [
          "object",
          "data",
          "hasMore",
          "nextCursor"
        ],
        "description": "A page of the patients that match, in `data`. While `hasMore` is true, send `nextCursor` back as `cursor` for the next page."
      },
      "Patient": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "patient"
          },
          "id": {
            "type": "string"
          },
          "active": {
            "type": "boolean"
          },
          "prefix": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "mr",
                  "ms",
                  "mrs",
                  "mx",
                  "master",
                  "miss",
                  "dr",
                  "prof",
                  "assoc_prof",
                  "asst_prof",
                  "md",
                  "do",
                  "phd",
                  "np",
                  "pa",
                  "rn",
                  "lpn",
                  "cna",
                  "rev",
                  "hon"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "givenNames": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "lastName": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "gender": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "male",
                  "female",
                  "other",
                  "unknown"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "birthDate": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "YYYY-MM-DD."
          },
          "identifiers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "description": "As in the request."
                },
                "value": {
                  "type": "string"
                }
              },
              "required": [
                "type",
                "value"
              ]
            }
          },
          "externalId": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "system": {
                    "type": "string"
                  },
                  "value": {
                    "type": "string"
                  }
                },
                "required": [
                  "system",
                  "value"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "contactPoints": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "system": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                },
                "use": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "rank": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "system",
                "value",
                "use",
                "rank"
              ]
            }
          },
          "addresses": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "use": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "lines": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "city": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "district": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "state": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "postalCode": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "country": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Two-letter ISO country code."
                }
              },
              "required": [
                "type",
                "use",
                "lines",
                "city",
                "district",
                "state",
                "postalCode",
                "country"
              ]
            }
          },
          "organizationId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The practice that manages the patient."
          },
          "updatedAt": {
            "type": "string",
            "description": "An ISO 8601 date-time in UTC.",
            "examples": [
              "2026-10-01T07:45:12.000Z"
            ]
          }
        },
        "required": [
          "object",
          "id",
          "active",
          "prefix",
          "givenNames",
          "lastName",
          "gender",
          "birthDate",
          "identifiers",
          "externalId",
          "contactPoints",
          "addresses",
          "organizationId",
          "updatedAt"
        ],
        "description": "A patient of the practice.",
        "examples": [
          {
            "object": "patient",
            "id": "k3v9x2m8q1w7e4r6t0y5u2ia",
            "active": true,
            "prefix": null,
            "givenNames": [
              "Thandi"
            ],
            "lastName": "Mokoena",
            "gender": "female",
            "birthDate": "1985-06-12",
            "identifiers": [],
            "externalId": {
              "system": "urn:your-clinic:patient",
              "value": "12345"
            },
            "contactPoints": [
              {
                "system": "email",
                "value": "thandi@example.com",
                "use": "home",
                "rank": 1
              }
            ],
            "addresses": [],
            "organizationId": "o1r5g9a3n7i2z6a0t4i8o3np",
            "updatedAt": "2026-10-01T07:45:12.000Z"
          }
        ]
      },
      "CoverageList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Coverage"
            }
          },
          "hasMore": {
            "type": "boolean",
            "description": "Whether another page follows this one."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Send it as `cursor` for the next page. Null on the last page."
          }
        },
        "required": [
          "object",
          "data",
          "hasMore",
          "nextCursor"
        ],
        "description": "A page of the coverages that match, in `data`. While `hasMore` is true, send `nextCursor` back as `cursor` for the next page."
      },
      "Coverage": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "coverage"
          },
          "id": {
            "type": "string"
          },
          "patientId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "insurance",
              "self_pay"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "cancelled",
              "draft",
              "entered_in_error"
            ]
          },
          "relationship": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "child",
                  "parent",
                  "spouse",
                  "common",
                  "other",
                  "self",
                  "injured"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "memberNumber": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "dependentCode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "insurerId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "insurerName": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "planId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "planName": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "planOptionCode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "priority": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ],
            "description": "Which coverage is claimed from first."
          },
          "paymentMethod": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "bank_transfer",
                  "card",
                  "cash",
                  "check",
                  "debit_order",
                  "medical_aid",
                  "mobile_payment",
                  "other"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "verificationStatus": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "pending",
                  "eligible",
                  "not_eligible",
                  "error"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Whether the membership was confirmed with the insurer: `pending` while the check runs, `eligible` or `not_eligible` as the insurer answered, `error` when the insurer did not answer and the check should be run again. Null for private pay."
          },
          "verifiedAt": {
            "anyOf": [
              {
                "type": "string",
                "description": "An ISO 8601 date-time in UTC.",
                "examples": [
                  "2026-10-01T07:45:12.000Z"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "When the insurer was last asked. Null if it never has been."
          },
          "verificationMessage": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The insurer's answer in words, or why the check could not be made."
          },
          "updatedAt": {
            "type": "string",
            "description": "An ISO 8601 date-time in UTC.",
            "examples": [
              "2026-10-01T07:45:12.000Z"
            ]
          }
        },
        "required": [
          "object",
          "id",
          "patientId",
          "type",
          "status",
          "relationship",
          "memberNumber",
          "dependentCode",
          "insurerId",
          "insurerName",
          "planId",
          "planName",
          "planOptionCode",
          "priority",
          "paymentMethod",
          "verificationStatus",
          "verifiedAt",
          "verificationMessage",
          "updatedAt"
        ],
        "description": "A patient's medical insurance, or their private-pay arrangement.",
        "examples": [
          {
            "object": "coverage",
            "id": "c9d1f4g7h2j5k8l0z3x6v1bn",
            "patientId": "k3v9x2m8q1w7e4r6t0y5u2ia",
            "type": "insurance",
            "status": "active",
            "relationship": "self",
            "memberNumber": "900123456",
            "dependentCode": "01",
            "insurerId": "o1r5g9a3n7i2z6a0t4i8o3np",
            "insurerName": "Example Medical Scheme",
            "planId": "n6m1b5v8c2x4z7a9s3d0f5gh",
            "planName": "Classic",
            "planOptionCode": "600830",
            "priority": 1,
            "paymentMethod": null,
            "verificationStatus": "eligible",
            "verifiedAt": "2026-10-01T07:40:02.000Z",
            "verificationMessage": "Member active",
            "updatedAt": "2026-10-01T07:45:12.000Z"
          }
        ]
      },
      "InsurancePlanList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InsurancePlan"
            }
          },
          "hasMore": {
            "type": "boolean",
            "description": "Whether another page follows this one."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Send it as `cursor` for the next page. Null on the last page."
          }
        },
        "required": [
          "object",
          "data",
          "hasMore",
          "nextCursor"
        ],
        "description": "A page of the insurance plans that match, in `data`. While `hasMore` is true, send `nextCursor` back as `cursor` for the next page."
      },
      "InsurancePlan": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "insurance_plan"
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "aliases": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "active": {
            "type": "boolean",
            "description": "False once the plan is no longer offered."
          },
          "optionCode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The plan option's code, which Practor sends the plan's claims under."
          },
          "claimCodes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "covers": {
                  "type": "string",
                  "enum": [
                    "consults_and_procedures",
                    "medicine_dispensed"
                  ],
                  "description": "What a claim under the code is for: `consults_and_procedures` for a practitioner's consults and procedures, `medicine_dispensed` for medicine a practice dispenses."
                },
                "code": {
                  "type": "string"
                }
              },
              "required": [
                "covers",
                "code"
              ]
            },
            "description": "Every code the plan is listed under on the claims network, with what each covers. A practitioner's consults and procedures belong on a plan with a `consults_and_procedures` code."
          },
          "insurerId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The scheme the plan belongs to."
          },
          "insurerName": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "object",
          "id",
          "name",
          "aliases",
          "active",
          "optionCode",
          "claimCodes",
          "insurerId",
          "insurerName"
        ],
        "description": "A medical insurance plan Practor can claim against.",
        "examples": [
          {
            "object": "insurance_plan",
            "id": "n6m1b5v8c2x4z7a9s3d0f5gh",
            "name": "Classic",
            "aliases": [
              "Classic Saver"
            ],
            "active": true,
            "optionCode": "600830",
            "claimCodes": [
              {
                "covers": "consults_and_procedures",
                "code": "600830"
              }
            ],
            "insurerId": "o1r5g9a3n7i2z6a0t4i8o3np",
            "insurerName": "Example Medical Scheme"
          }
        ]
      },
      "EncounterList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Encounter"
            }
          },
          "hasMore": {
            "type": "boolean",
            "description": "Whether another page follows this one."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Send it as `cursor` for the next page. Null on the last page."
          }
        },
        "required": [
          "object",
          "data",
          "hasMore",
          "nextCursor"
        ],
        "description": "A page of the encounters that match, in `data`. While `hasMore` is true, send `nextCursor` back as `cursor` for the next page."
      },
      "Encounter": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "encounter"
          },
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "planned",
              "arrived",
              "in_progress",
              "processing",
              "review",
              "finalizing",
              "locked",
              "on_hold",
              "discharged",
              "completed",
              "cancelled",
              "discontinued",
              "entered_in_error",
              "error",
              "unknown"
            ]
          },
          "class": {
            "type": "string",
            "enum": [
              "imp",
              "amb",
              "obsenc",
              "emer",
              "vr",
              "hh"
            ],
            "description": "The kind of visit, such as `amb` for an outpatient visit."
          },
          "patientId": {
            "type": "string"
          },
          "practitionerId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "start": {
            "type": "string",
            "description": "An ISO 8601 date-time in UTC.",
            "examples": [
              "2026-10-01T07:45:12.000Z"
            ]
          },
          "end": {
            "anyOf": [
              {
                "type": "string",
                "description": "An ISO 8601 date-time in UTC.",
                "examples": [
                  "2026-10-01T07:45:12.000Z"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "diagnoses": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "system": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "The code system, by its URL."
                },
                "code": {
                  "type": "string"
                },
                "display": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "system",
                "code",
                "display"
              ]
            },
            "description": "In order of importance: the first is the primary diagnosis."
          },
          "procedures": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "preparation",
                    "in_progress",
                    "not_done",
                    "on_hold",
                    "stopped",
                    "completed",
                    "entered_in_error"
                  ]
                },
                "system": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "The code system, by its URL."
                },
                "code": {
                  "type": "string"
                },
                "display": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "diagnosisCodes": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "note": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "status",
                "system",
                "code",
                "display",
                "diagnosisCodes",
                "note"
              ]
            }
          },
          "updatedAt": {
            "type": "string",
            "description": "An ISO 8601 date-time in UTC.",
            "examples": [
              "2026-10-01T07:45:12.000Z"
            ]
          }
        },
        "required": [
          "object",
          "id",
          "status",
          "class",
          "patientId",
          "practitionerId",
          "start",
          "end",
          "diagnoses",
          "procedures",
          "updatedAt"
        ],
        "description": "A visit, with its diagnoses and procedures.",
        "examples": [
          {
            "object": "encounter",
            "id": "e7j3p5s9d1f4g6h8k2l0m3nb",
            "status": "completed",
            "class": "amb",
            "patientId": "k3v9x2m8q1w7e4r6t0y5u2ia",
            "practitionerId": "p4n8b6r2t9y3u7i1o5a0s8dm",
            "start": "2026-10-01T07:00:00.000Z",
            "end": "2026-10-01T07:45:00.000Z",
            "diagnoses": [
              {
                "id": "x8c5v2b9n6m3q0w7e4r1t8yu",
                "system": "http://hl7.org/fhir/sid/icd-10",
                "code": "J06.9",
                "display": "Acute upper respiratory infection, unspecified"
              }
            ],
            "procedures": [
              {
                "id": "r5t8y2u6i9o1p4a7s0d3f6gh",
                "status": "completed",
                "system": null,
                "code": "0190",
                "display": "Consultation",
                "diagnosisCodes": [
                  "J06.9"
                ],
                "note": null
              }
            ],
            "updatedAt": "2026-10-01T07:45:12.000Z"
          }
        ]
      },
      "BillResult": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "bill_result"
          },
          "invoice": {
            "$ref": "#/components/schemas/Invoice"
          },
          "issued": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "Whether the invoice was issued. Null when you did not ask for it to be."
          },
          "issueSkippedReason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Why it was not issued, when you asked and it was not."
          },
          "claimQueued": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "Whether the claim was queued for the insurer. Null when you did not ask for it to be."
          },
          "claimSkippedReason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Why the claim was not queued, so it can be fixed and sent from the dashboard."
          }
        },
        "required": [
          "object",
          "invoice",
          "issued",
          "issueSkippedReason",
          "claimQueued",
          "claimSkippedReason"
        ],
        "description": "The invoice, and what happened to the issue and the claim you asked for. The invoice exists either way."
      },
      "Invoice": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "invoice"
          },
          "id": {
            "type": "string"
          },
          "number": {
            "type": "string",
            "description": "The invoice number the patient sees."
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "issued",
              "amending",
              "balanced",
              "cancelled",
              "entered_in_error",
              "partially_paid",
              "overdue",
              "written_off"
            ]
          },
          "claimStatus": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "submitting",
                  "accepted",
                  "rejected",
                  "partially_accepted",
                  "reversed",
                  "reversal_failed",
                  "reversing"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Where the claim to the insurer stands. Null when none was sent."
          },
          "patientId": {
            "type": "string"
          },
          "coverageId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The coverage the claim was sent under. Null on an invoice whose claim has not been sent."
          },
          "encounterIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The visits billed on it."
          },
          "recipientName": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "date": {
            "type": "string",
            "description": "YYYY-MM-DD.",
            "examples": [
              "2026-10-01"
            ]
          },
          "dueDate": {
            "anyOf": [
              {
                "type": "string",
                "description": "YYYY-MM-DD.",
                "examples": [
                  "2026-10-01"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code. Every amount on the resource is in it.",
            "examples": [
              "ZAR"
            ]
          },
          "totalNet": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Before tax, in the currency's minor unit (cents for ZAR).",
            "examples": [
              45000
            ]
          },
          "totalGross": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "What the invoice is for, in the currency's minor unit (cents for ZAR).",
            "examples": [
              45000
            ]
          },
          "amountPaid": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Paid so far, in the currency's minor unit (cents for ZAR).",
            "examples": [
              45000
            ]
          },
          "balanceDue": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Still owed, in the currency's minor unit (cents for ZAR).",
            "examples": [
              45000
            ]
          },
          "lineItems": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "serviceDate": {
                  "type": "string",
                  "description": "YYYY-MM-DD.",
                  "examples": [
                    "2026-10-01"
                  ]
                },
                "serviceDateEnd": {
                  "anyOf": [
                    {
                      "type": "string",
                      "description": "YYYY-MM-DD.",
                      "examples": [
                        "2026-10-01"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "system": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "The code system, by its URL."
                },
                "code": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "modifiers": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "Tariff modifiers applied to the line."
                },
                "quantity": {
                  "type": "number"
                },
                "unitPrice": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "The price of one, in the currency's minor unit (cents for ZAR).",
                  "examples": [
                    45000
                  ]
                },
                "subtotal": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Quantity times the unit price, in the currency's minor unit (cents for ZAR).",
                  "examples": [
                    45000
                  ]
                },
                "total": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "The line after any discount or surcharge, in the currency's minor unit (cents for ZAR).",
                  "examples": [
                    45000
                  ]
                },
                "pricingSource": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "governing_body",
                        "medical_aid",
                        "custom",
                        "favorite"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Where the unit price came from: a professional body, a medical insurance rate, the practice, or set by hand."
                },
                "diagnoses": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "system": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "The code system, by its URL."
                      },
                      "code": {
                        "type": "string"
                      },
                      "display": {
                        "type": "string"
                      },
                      "primary": {
                        "type": "boolean",
                        "description": "The diagnosis the line is claimed under. One per line."
                      }
                    },
                    "required": [
                      "system",
                      "code",
                      "display",
                      "primary"
                    ]
                  },
                  "description": "What the line treats. A claim needs a primary one."
                }
              },
              "required": [
                "id",
                "serviceDate",
                "serviceDateEnd",
                "system",
                "code",
                "description",
                "modifiers",
                "quantity",
                "unitPrice",
                "subtotal",
                "total",
                "pricingSource",
                "diagnoses"
              ]
            }
          },
          "updatedAt": {
            "type": "string",
            "description": "An ISO 8601 date-time in UTC.",
            "examples": [
              "2026-10-01T07:45:12.000Z"
            ]
          }
        },
        "required": [
          "object",
          "id",
          "number",
          "status",
          "claimStatus",
          "patientId",
          "coverageId",
          "encounterIds",
          "recipientName",
          "date",
          "dueDate",
          "currency",
          "totalNet",
          "totalGross",
          "amountPaid",
          "balanceDue",
          "lineItems",
          "updatedAt"
        ],
        "description": "An invoice, with its lines and what has been paid.",
        "examples": [
          {
            "object": "invoice",
            "id": "i2q6w8e0r4t7y1u3o5p9a6sd",
            "number": "INV-000123",
            "status": "issued",
            "claimStatus": "submitting",
            "patientId": "k3v9x2m8q1w7e4r6t0y5u2ia",
            "coverageId": "c9d1f4g7h2j5k8l0z3x6v1bn",
            "encounterIds": [
              "e7j3p5s9d1f4g6h8k2l0m3nb"
            ],
            "recipientName": "Thandi Mokoena",
            "date": "2026-10-01",
            "dueDate": "2026-10-31",
            "currency": "ZAR",
            "totalNet": 45000,
            "totalGross": 45000,
            "amountPaid": 0,
            "balanceDue": 45000,
            "lineItems": [
              {
                "id": "l8k5j2h9g6f3d0s7a4q1w8ez",
                "serviceDate": "2026-10-01",
                "serviceDateEnd": null,
                "system": null,
                "code": "0190",
                "description": "Consultation",
                "modifiers": [],
                "quantity": 1,
                "unitPrice": 45000,
                "subtotal": 45000,
                "total": 45000,
                "pricingSource": "medical_aid",
                "diagnoses": [
                  {
                    "system": "http://hl7.org/fhir/sid/icd-10-za",
                    "code": "J06.9",
                    "display": "Acute upper respiratory infection, unspecified",
                    "primary": true
                  }
                ]
              }
            ],
            "updatedAt": "2026-10-01T07:45:12.000Z"
          }
        ]
      },
      "InvoiceList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Invoice"
            }
          },
          "hasMore": {
            "type": "boolean",
            "description": "Whether another page follows this one."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Send it as `cursor` for the next page. Null on the last page."
          }
        },
        "required": [
          "object",
          "data",
          "hasMore",
          "nextCursor"
        ],
        "description": "A page of the invoices that match, in `data`. While `hasMore` is true, send `nextCursor` back as `cursor` for the next page."
      },
      "Claim": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "claim"
          },
          "id": {
            "type": "string"
          },
          "invoiceId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "submitting",
              "accepted",
              "rejected",
              "partially_accepted",
              "reversed",
              "reversal_failed",
              "reversing"
            ]
          },
          "outcome": {
            "type": "string",
            "enum": [
              "queued",
              "complete",
              "partial",
              "error"
            ],
            "description": "`queued` while the insurer has not answered, `complete` when every line was accepted, `partial` when some were, `error` when it was refused."
          },
          "message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The insurer's reason when the claim or its reversal failed, or why it was not sent."
          },
          "resubmittable": {
            "type": "boolean",
            "description": "Whether `POST /invoices/{invoiceId}/claim/resubmit` would be taken: the claim was rejected or reversed."
          },
          "reversible": {
            "type": "boolean",
            "description": "Whether `POST /invoices/{invoiceId}/claim/reverse` would be taken: the insurer accepted some or all of it, or a reversal failed."
          },
          "authorizationReference": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "submittedAt": {
            "anyOf": [
              {
                "type": "string",
                "description": "An ISO 8601 date-time in UTC.",
                "examples": [
                  "2026-10-01T07:45:12.000Z"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code. Every amount on the resource is in it.",
            "examples": [
              "ZAR"
            ]
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "lineNumber": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "The invoice line's position, 1 first."
                },
                "lineItemId": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "decision": {
                  "type": "string",
                  "enum": [
                    "approved",
                    "approved_with_warning",
                    "denied"
                  ]
                },
                "submitted": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991,
                      "description": "What was claimed for the line, in the currency's minor unit (cents for ZAR).",
                      "examples": [
                        45000
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "benefit": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991,
                      "description": "What the insurer will pay for the line, in the currency's minor unit (cents for ZAR).",
                      "examples": [
                        45000
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "rejections": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "code": {
                        "type": "string"
                      },
                      "description": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "code",
                      "description"
                    ]
                  }
                },
                "warnings": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "code": {
                        "type": "string"
                      },
                      "description": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "code",
                      "description"
                    ]
                  }
                }
              },
              "required": [
                "lineNumber",
                "lineItemId",
                "decision",
                "submitted",
                "benefit",
                "rejections",
                "warnings"
              ]
            }
          }
        },
        "required": [
          "object",
          "id",
          "invoiceId",
          "status",
          "outcome",
          "message",
          "resubmittable",
          "reversible",
          "authorizationReference",
          "submittedAt",
          "currency",
          "items"
        ],
        "description": "Where an invoice's claim stands with the insurer, line by line.",
        "examples": [
          {
            "object": "claim",
            "id": "m3k8j5h2g9f6d3s0a7p4o1iu",
            "invoiceId": "i2q6w8e0r4t7y1u3o5p9a6sd",
            "status": "partially_accepted",
            "outcome": "partial",
            "message": null,
            "resubmittable": false,
            "reversible": true,
            "authorizationReference": null,
            "submittedAt": "2026-10-01T08:00:00.000Z",
            "currency": "ZAR",
            "items": [
              {
                "lineNumber": 1,
                "lineItemId": "l8k5j2h9g6f3d0s7a4q1w8ez",
                "decision": "approved_with_warning",
                "submitted": 45000,
                "benefit": 40000,
                "rejections": [],
                "warnings": [
                  {
                    "code": "306",
                    "description": "Tariff paid at scheme rate"
                  }
                ]
              }
            ]
          }
        ]
      },
      "RateList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Rate"
            }
          },
          "hasMore": {
            "type": "boolean",
            "description": "Whether another page follows this one."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Send it as `cursor` for the next page. Null on the last page."
          }
        },
        "required": [
          "object",
          "data",
          "hasMore",
          "nextCursor"
        ],
        "description": "A page of the rates that match, in `data`. While `hasMore` is true, send `nextCursor` back as `cursor` for the next page."
      },
      "Rate": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "rate"
          },
          "source": {
            "type": "string",
            "enum": [
              "practitioner",
              "practice",
              "insurance_plan",
              "insurance_scheme",
              "governing_body",
              "code_default"
            ],
            "description": "Whose price it is: the practitioner's or the practice's own, the patient's medical insurance plan or scheme, a professional body's tariff, or the default price on a practice's own code."
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The plan, scheme or body it belongs to, where there is one."
          },
          "amount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "The price of one, in the currency's minor unit (cents for ZAR).",
            "examples": [
              45000
            ]
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code. Every amount on the resource is in it.",
            "examples": [
              "ZAR"
            ]
          },
          "pricingSource": {
            "type": "string",
            "enum": [
              "governing_body",
              "medical_aid",
              "custom",
              "favorite"
            ],
            "description": "Send it as the line's `pricingSource` when you use this rate."
          },
          "current": {
            "type": "boolean",
            "description": "Whether it is the line's unit price now."
          }
        },
        "required": [
          "object",
          "source",
          "name",
          "amount",
          "currency",
          "pricingSource",
          "current"
        ],
        "description": "A price Practor knows for a line, from the most particular to the most general.",
        "examples": [
          {
            "object": "rate",
            "source": "insurance_plan",
            "name": "Classic",
            "amount": 40000,
            "currency": "ZAR",
            "pricingSource": "medical_aid",
            "current": false
          }
        ]
      },
      "ClaimReadiness": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "claim_readiness"
          },
          "invoiceId": {
            "type": "string"
          },
          "ready": {
            "type": "boolean",
            "description": "Whether every check passes, so a claim would be sent."
          },
          "checks": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Stable, for matching a check in code."
                },
                "group": {
                  "type": "string",
                  "enum": [
                    "invoice",
                    "patient",
                    "coverage",
                    "configuration",
                    "enrollment"
                  ]
                },
                "label": {
                  "type": "string",
                  "description": "What has to be true, as an instruction."
                },
                "passed": {
                  "type": "boolean"
                },
                "blocking": {
                  "type": "boolean",
                  "description": "Whether a failed check stops the claim. False for a warning: the claim is still sent, and `ready` ignores it."
                },
                "detail": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "group",
                "label",
                "passed",
                "blocking",
                "detail"
              ]
            }
          }
        },
        "required": [
          "object",
          "invoiceId",
          "ready",
          "checks"
        ],
        "description": "Every check a claim has to pass before it is sent, and whether it passes now.",
        "examples": [
          {
            "object": "claim_readiness",
            "invoiceId": "i2q6w8e0r4t7y1u3o5p9a6sd",
            "ready": false,
            "checks": [
              {
                "id": "coverage-verified",
                "group": "coverage",
                "label": "Verify the patient's eligibility",
                "passed": false,
                "blocking": true,
                "detail": "Current status: PENDING"
              }
            ]
          }
        ]
      },
      "PaymentList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Payment"
            }
          },
          "hasMore": {
            "type": "boolean",
            "description": "Whether another page follows this one."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Send it as `cursor` for the next page. Null on the last page."
          }
        },
        "required": [
          "object",
          "data",
          "hasMore",
          "nextCursor"
        ],
        "description": "A page of the payments that match, in `data`. While `hasMore` is true, send `nextCursor` back as `cursor` for the next page."
      },
      "Payment": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "payment"
          },
          "id": {
            "type": "string"
          },
          "invoiceId": {
            "type": "string"
          },
          "amount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "What was paid, in the currency's minor unit (cents for ZAR).",
            "examples": [
              45000
            ]
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code. Every amount on the resource is in it.",
            "examples": [
              "ZAR"
            ]
          },
          "method": {
            "type": "string",
            "enum": [
              "bank_transfer",
              "card",
              "cash",
              "check",
              "debit_order",
              "medical_aid",
              "mobile_payment",
              "other"
            ]
          },
          "paidOn": {
            "type": "string",
            "description": "YYYY-MM-DD.",
            "examples": [
              "2026-10-01"
            ]
          },
          "reference": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The payer's reference, such as an EFT reference."
          },
          "medicalAidClaimId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "medicalAidPaid": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991,
                "description": "The part the insurer paid, in the currency's minor unit (cents for ZAR).",
                "examples": [
                  45000
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "patientPaid": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991,
                "description": "The part the patient paid, in the currency's minor unit (cents for ZAR).",
                "examples": [
                  45000
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "description": "An ISO 8601 date-time in UTC.",
            "examples": [
              "2026-10-01T07:45:12.000Z"
            ]
          }
        },
        "required": [
          "object",
          "id",
          "invoiceId",
          "amount",
          "currency",
          "method",
          "paidOn",
          "reference",
          "medicalAidClaimId",
          "medicalAidPaid",
          "patientPaid",
          "createdAt"
        ],
        "description": "A payment against an invoice, from the patient or from an insurer.",
        "examples": [
          {
            "object": "payment",
            "id": "y4u7i0o3p6a9s2d5f8g1h4jk",
            "invoiceId": "i2q6w8e0r4t7y1u3o5p9a6sd",
            "amount": 40000,
            "currency": "ZAR",
            "method": "medical_aid",
            "paidOn": "2026-10-15",
            "reference": "EFT123",
            "medicalAidClaimId": null,
            "medicalAidPaid": 40000,
            "patientPaid": null,
            "createdAt": "2026-10-15T09:00:00.000Z"
          }
        ]
      },
      "CodeSystemList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CodeSystem"
            }
          },
          "hasMore": {
            "type": "boolean",
            "description": "Whether another page follows this one."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Send it as `cursor` for the next page. Null on the last page."
          }
        },
        "required": [
          "object",
          "data",
          "hasMore",
          "nextCursor"
        ],
        "description": "A page of the code systems that match, in `data`. While `hasMore` is true, send `nextCursor` back as `cursor` for the next page."
      },
      "CodeSystem": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "code_system"
          },
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "description": "What a coding names as its `system`."
          },
          "name": {
            "type": "string"
          },
          "title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "owner": {
            "type": "string",
            "enum": [
              "practor",
              "practice",
              "practitioner"
            ],
            "description": "Who keeps its codes: Practor for a published system such as ICD-10, else the practice or one practitioner. Only a practice's own can be changed through the API."
          },
          "usage": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "procedure",
                "condition",
                "observation",
                "medication",
                "allergy",
                "immunization",
                "family-history",
                "body-site",
                "severity"
              ]
            },
            "description": "The kinds of record its codes are picked for: `procedure` for what is billed, `condition` for diagnoses."
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "retired"
            ]
          },
          "updatedAt": {
            "type": "string",
            "description": "An ISO 8601 date-time in UTC.",
            "examples": [
              "2026-10-01T07:45:12.000Z"
            ]
          }
        },
        "required": [
          "object",
          "id",
          "url",
          "name",
          "title",
          "description",
          "owner",
          "usage",
          "status",
          "updatedAt"
        ],
        "description": "A set of codes Practor can record and bill: a published one, or one of the practice's own, such as its tariff.",
        "examples": [
          {
            "object": "code_system",
            "id": "s3c7d1e5f9g2h6j0k4l8m2nq",
            "url": "urn:practor:organization:o1r5g9a3n7i2z6a0t4i8o3np:codesystem:practice-tariff",
            "name": "Practice tariff",
            "title": null,
            "description": "The procedure codes this practice bills.",
            "owner": "practice",
            "usage": [
              "procedure"
            ],
            "status": "active",
            "updatedAt": "2026-10-01T07:45:12.000Z"
          }
        ]
      },
      "CodeConceptList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CodeConcept"
            }
          },
          "hasMore": {
            "type": "boolean",
            "description": "Whether another page follows this one."
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Send it as `cursor` for the next page. Null on the last page."
          }
        },
        "required": [
          "object",
          "data",
          "hasMore",
          "nextCursor"
        ],
        "description": "A page of the codes that match, in `data`. While `hasMore` is true, send `nextCursor` back as `cursor` for the next page."
      },
      "CodeConcept": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "code_concept"
          },
          "id": {
            "type": "string"
          },
          "codeSystemId": {
            "type": "string"
          },
          "system": {
            "type": "string",
            "description": "The system's URL, as a coding names it."
          },
          "code": {
            "type": "string"
          },
          "display": {
            "type": "string"
          },
          "definition": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "usage": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "procedure",
                "condition",
                "observation",
                "medication",
                "allergy",
                "immunization",
                "family-history",
                "body-site",
                "severity"
              ]
            },
            "description": "The kinds of record its codes are picked for: `procedure` for what is billed, `condition` for diagnoses."
          },
          "defaultPrice": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1,
                "maximum": 1000000000,
                "description": "What a line with this code starts at when nothing more particular is known, in the practice's currency's minor unit (cents for ZAR).",
                "examples": [
                  45000
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "currency": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The currency `defaultPrice` is in."
          },
          "updatedAt": {
            "type": "string",
            "description": "An ISO 8601 date-time in UTC.",
            "examples": [
              "2026-10-01T07:45:12.000Z"
            ]
          }
        },
        "required": [
          "object",
          "id",
          "codeSystemId",
          "system",
          "code",
          "display",
          "definition",
          "usage",
          "defaultPrice",
          "currency",
          "updatedAt"
        ],
        "description": "One code in a code system.",
        "examples": [
          {
            "object": "code_concept",
            "id": "a7b2c6d0e4f8g1h5j9k3l7mw",
            "codeSystemId": "s3c7d1e5f9g2h6j0k4l8m2nq",
            "system": "urn:practor:organization:o1r5g9a3n7i2z6a0t4i8o3np:codesystem:practice-tariff",
            "code": "GP-0190",
            "display": "Consultation, 30 minutes",
            "definition": null,
            "usage": [
              "procedure"
            ],
            "defaultPrice": 45000,
            "currency": "ZAR",
            "updatedAt": "2026-10-01T07:45:12.000Z"
          }
        ]
      },
      "CodeConceptImportResult": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "code_concept_import"
          },
          "created": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "skipped": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Codes the system already had."
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Its position in `concepts`, 0 first."
                },
                "code": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              },
              "required": [
                "index",
                "code",
                "message"
              ]
            }
          }
        },
        "required": [
          "object",
          "created",
          "skipped",
          "errors"
        ],
        "description": "How many codes an import created and skipped, and why each code in `errors` was not added.",
        "examples": [
          {
            "object": "code_concept_import",
            "created": 41,
            "skipped": 1,
            "errors": []
          }
        ]
      },
      "DeletedCodeConcept": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "code_concept"
          },
          "id": {
            "type": "string"
          },
          "deleted": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "object",
          "id",
          "deleted"
        ],
        "description": "The code that was removed.",
        "examples": [
          {
            "object": "code_concept",
            "id": "a7b2c6d0e4f8g1h5j9k3l7mw",
            "deleted": true
          }
        ]
      }
    },
    "securitySchemes": {
      "integrationKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "An integration key, sent as `Authorization: Bearer prk_live_...`."
      }
    }
  }
}
