{
  "openapi": "3.1.0",
  "info": {
    "title": "Nexfield API",
    "version": "1",
    "summary": "The public API of a Nexfield company key: clients, jobs, calls, technicians, estimates, invoices, payments, webhooks and website booking.",
    "description": "Read a company’s clients, jobs, finished AI calls, technicians, estimates, invoices and payments, create and change clients and jobs, get each event at a webhook (the schemas named PublicEvent…, signed as Standard Webhooks says: the headers named PublicDelivery…), and book the company’s free times from its own website’s server. The reference with examples: https://nexfield.pro/developers. Within version 1 changes are only additions: answers may gain fields and the values of an `x-extensible-enum` may grow, so accept fields and values you do not know.",
    "contact": {
      "name": "Nexfield support",
      "email": "support@nexfield.pro",
      "url": "https://nexfield.pro/developers"
    },
    "license": {
      "name": "Proprietary: Nexfield terms of service",
      "url": "https://nexfield.pro/terms"
    },
    "x-logo": {
      "url": "https://nexfield.pro/assets/brand/nexfield-logo-512.png",
      "altText": "Nexfield"
    }
  },
  "servers": [
    {
      "url": "https://nexfield.pro/api/v1"
    }
  ],
  "paths": {
    "/me": {
      "get": {
        "tags": [
          "public"
        ],
        "operationId": "publicMe",
        "summary": "Who the key belongs to",
        "description": "The company of the key: Zapier's test call and its connection label. Any key may call it (no scope). Answers\n403 forbidden with `current.reason` `plan_required` while the company is on hold or is not on a paid plan,\nwith a sentence that says which.\n",
        "security": [
          {
            "companyKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "The company.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicMeResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/PublicUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PublicForbidden"
          },
          "429": {
            "$ref": "#/components/responses/PublicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/clients": {
      "get": {
        "tags": [
          "public"
        ],
        "operationId": "publicClients",
        "x-nf-scope": "clients:read",
        "summary": "Clients",
        "description": "The company's clients, newest first by when they were added unless `order` says otherwise. A page at a time:\nsend `meta.next_cursor` back as `cursor` with the same `order` and filters; it is null on the last page. The\nlist of the `client.created` and `client.updated` triggers, and with `phone`, `email` or `q` the search of\n\"find a client\". Each client says how it first came (`source`): `clients:read` is all it takes (a key is made\nby the owner, who sees where clients come from in the app). There is no filter by `source.kind`: a client's\nkind is its first job's, which no one indexed condition finds.\n",
        "security": [
          {
            "companyKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicLimit"
          },
          {
            "$ref": "#/components/parameters/PublicCursor"
          },
          {
            "$ref": "#/components/parameters/PublicOrder"
          },
          {
            "$ref": "#/components/parameters/PublicCreatedSince"
          },
          {
            "$ref": "#/components/parameters/PublicUpdatedSince"
          },
          {
            "name": "number",
            "in": "query",
            "required": false,
            "description": "The client with this number, the one the company sees on it (the record's `number`), exactly: digits only. A number no client has matches nothing.",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]{1,10}$",
              "examples": [
                "1042"
              ]
            }
          },
          {
            "name": "phone",
            "in": "query",
            "required": false,
            "description": "The client with this phone number: a US number in any common form, matched with the number on file. A value that is not a US number matches nothing.",
            "schema": {
              "type": "string",
              "maxLength": 32
            }
          },
          {
            "name": "email",
            "in": "query",
            "required": false,
            "description": "The clients whose main email is this address (the whole address).",
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "A search: a part of the name, of the main email, or (three digits or more) of the phone number.",
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The clients.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicClientListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/PublicUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PublicForbidden"
          },
          "429": {
            "$ref": "#/components/responses/PublicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      },
      "post": {
        "tags": [
          "public"
        ],
        "operationId": "publicClientCreate",
        "x-nf-scope": "clients:write",
        "x-nf-read-scopes": [
          "clients:read"
        ],
        "summary": "Create a client",
        "description": "A new client. The key needs `clients:write` (the route) and also `clients:read` (`x-nf-read-scopes`: the answer\nholds what is on file). A phone number another client already has answers 409 `conflict` with `current.reason`\n`phone_taken` and that client in `current.client`. A company creates at most 500 clients a rolling 24 hours\nthrough the API: past it 429 `rate_limited` with `current.reason` `daily_limit` until those 24 hours free room\n(the key keeps working; the owner gets one email a limit a day). With an Idempotency-Key, the same key and body\nagain within 24 hours replays the first answer (`meta.replayed`), or the client its first request made; 409\n`conflict` with `current.reason` `record_gone` when that client is gone. Raises `client.created`.\n",
        "security": [
          {
            "companyKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicIdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicClientInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The client.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicClientResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/PublicUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PublicForbidden"
          },
          "409": {
            "$ref": "#/components/responses/PublicConflict"
          },
          "413": {
            "$ref": "#/components/responses/PublicTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/PublicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/clients/{client_id}": {
      "get": {
        "tags": [
          "public"
        ],
        "operationId": "publicClient",
        "x-nf-scope": "clients:read",
        "summary": "A client",
        "description": "One client of the company by its id. 404 not_found for an id that names no client of the company (gone,\nanother company's, an id of another kind, not an id). A query parameter answers 400.\n",
        "security": [
          {
            "companyKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicClientId"
          }
        ],
        "responses": {
          "200": {
            "description": "The client.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicClientResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/PublicUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PublicForbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/PublicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      },
      "patch": {
        "tags": [
          "public"
        ],
        "operationId": "publicClientUpdate",
        "x-nf-scope": "clients:write",
        "x-nf-read-scopes": [
          "clients:read"
        ],
        "summary": "Change a client",
        "description": "Changes the fields sent and answers the client as it is now. A field not sent stays; an empty string also stays\n(a blank mapping in a no-code tool must not wipe data); null clears `email`, `address` or `notes`; null for\n`name` or `phone` answers 422 on that field. A body that changes nothing answers the client as it is. The\nclient's other emails, its other addresses and its access note are not changed. No field is compared with what\nthe caller last read: the last write wins. A phone number another client has answers 409 `conflict` with\n`current.reason` `phone_taken` and that client in `current.client`. The key needs `clients:write` and\n`clients:read`. A company makes at most 2000 changes (of clients and jobs together) a rolling 24 hours through\nthe API: past it 429 `rate_limited` with `current.reason` `daily_limit` until those 24 hours free room (the key\nkeeps working; the owner gets one email a limit a day). With an Idempotency-Key, the same key and body again\nwithin 24 hours replays the first answer (`meta.replayed`).\n",
        "security": [
          {
            "companyKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicIdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/PublicClientId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicClientPatch"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The client as it is now.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicClientResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/PublicUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PublicForbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/PublicConflict"
          },
          "413": {
            "$ref": "#/components/responses/PublicTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/PublicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/jobs": {
      "get": {
        "tags": [
          "public"
        ],
        "operationId": "publicJobs",
        "x-nf-scope": "jobs:read",
        "summary": "Jobs",
        "description": "The company's jobs, newest first by when they were made unless `order` says otherwise. A page at a time: send\n`meta.next_cursor` back as `cursor` with the same `order` and filters; it is null on the last page. A job\nmarked spam is not in the list. The filters add to each other. The list of the job triggers, and the search of\n\"find a job\". Each job says where its client came from (`source`): `jobs:read` is all it takes (a key is made\nby the owner, who sees where clients come from in the app). There is no filter by `source.kind`: the stored\nsource has no index, and `api` is a mark in the job's own answers.\n",
        "security": [
          {
            "companyKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicLimit"
          },
          {
            "$ref": "#/components/parameters/PublicCursor"
          },
          {
            "$ref": "#/components/parameters/PublicOrder"
          },
          {
            "$ref": "#/components/parameters/PublicCreatedSince"
          },
          {
            "$ref": "#/components/parameters/PublicUpdatedSince"
          },
          {
            "name": "number",
            "in": "query",
            "required": false,
            "description": "The job with this number, the one the company sees on it (the record's `number`), exactly: digits only. A number no job has matches nothing.",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]{1,10}$",
              "examples": [
                "5012"
              ]
            }
          },
          {
            "name": "stage",
            "in": "query",
            "required": false,
            "description": "The jobs of this stage.",
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "done",
                "canceled"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "The jobs of this built-in status.",
            "schema": {
              "type": "string",
              "enum": [
                "new",
                "confirmed",
                "rescheduled",
                "in_progress",
                "completed",
                "canceled",
                "warranty_callback",
                "important_message"
              ]
            }
          },
          {
            "name": "client_id",
            "in": "query",
            "required": false,
            "description": "The jobs of this client.",
            "schema": {
              "type": "string",
              "maxLength": 64,
              "examples": [
                "cli_1042"
              ]
            }
          },
          {
            "name": "technician_id",
            "in": "query",
            "required": false,
            "description": "The jobs this technician is assigned to. A technician who is on a job only as a helper is not matched.",
            "schema": {
              "type": "string",
              "maxLength": 64,
              "examples": [
                "tech_12"
              ]
            }
          },
          {
            "name": "scheduled_from",
            "in": "query",
            "required": false,
            "description": "The jobs that start on or after this day, the company's date (\"2026-12-01\"). A job with no time yet is left out.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "scheduled_to",
            "in": "query",
            "required": false,
            "description": "The jobs that start on or before this day, the company's date. A job with no time yet is left out.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The jobs.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicJobListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/PublicUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PublicForbidden"
          },
          "429": {
            "$ref": "#/components/responses/PublicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      },
      "post": {
        "tags": [
          "public"
        ],
        "operationId": "publicJobCreate",
        "x-nf-scope": "jobs:write",
        "summary": "Create a job",
        "description": "A new job, status new. The client is `client_id` (a client of the company), or `client_name` and `client_phone`:\nthe company's client with that phone number, or a new one (a client on file keeps its saved emails; the email\nsent stays on the job). With `start` (the company's wall clock in its zone) the job lasts `duration_minutes`\n(60); without it the job waits for a date (a lead from a form). `lead_source` (\"Website form\") is kept on the\njob and shown in its origin. The key needs `jobs:write` (the route) and also `jobs:read` and `clients:read`\n(PublicJobInput's `x-nf-read-scopes`: the answer holds what is on file). `start` is resolved in the company's\nzone: a time the clocks skip answers 422 on `start`, a time they repeat is its first occurrence, and the end is\n`duration_minutes` of elapsed time after the start. The same job sent again within 30 seconds (the same start\nand phone) answers 409 `conflict` with `current.reason` `duplicate` and the job already there in `current.job`.\nA company creates at most 500 jobs a rolling 24 hours through the API: past it 429 `rate_limited` with\n`current.reason` `daily_limit` until those 24 hours free room (the key keeps working; the owner gets one email a\nlimit a day). With an Idempotency-Key, the same key and body again within 24 hours replays the first answer\n(`meta.replayed`), or the job its first request made; 409 `conflict` with `current.reason` `record_gone` when\nthat job is gone. Raises `job.created`.\n\nA booking: a body with `slot_token` (a time of GET /availability; PublicBookingInput) instead of `start` books\nthat time as the company's online booking does. The time is checked again on the server, and again under the\nbooking's own lock of the company's day: 409 `conflict` with `current.reason` `slot_taken` when it is no\nlonger free; a token of another company, a changed one, one older than 30 minutes or one whose service was\nrenamed or reordered since answers 422 on `slot_token`; an address of another ZIP than the token's answers 422\non `address`; 503 with Retry-After when the time cannot be checked now (send it again). A resend of the same\nbooking is its 409 `duplicate`, never `slot_taken`. A booking needs `jobs:write` only: a key without\n`jobs:read` and `clients:read` (a Website booking key) gets a confirmation of its job\n(PublicBookingConfirmation) and its 409 `duplicate` carries no job; a key with them gets the job. A number on\nthe company's blocklist answers 403 `booking_refused`. A company whose online booking is off, uses Housecall\nPro or asks customers for a texted code answers as GET /availability does.\n",
        "security": [
          {
            "companyKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicIdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/PublicJobInput"
                  },
                  {
                    "$ref": "#/components/schemas/PublicBookingInput"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The job.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicJobCreateResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/PublicUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PublicForbidden"
          },
          "409": {
            "$ref": "#/components/responses/PublicConflict"
          },
          "413": {
            "$ref": "#/components/responses/PublicTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/PublicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/jobs/{job_id}": {
      "get": {
        "tags": [
          "public"
        ],
        "operationId": "publicJob",
        "x-nf-scope": "jobs:read",
        "summary": "A job",
        "description": "One job of the company by its id. 404 not_found for an id that names no job of the company (gone, another\ncompany's, an id of another kind, not an id). A job that was marked spam is still answered by its id, with\n`stage` canceled and `status` spam, so a copy kept elsewhere learns it is gone. A query parameter answers 400.\n",
        "security": [
          {
            "companyKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicJobId"
          }
        ],
        "responses": {
          "200": {
            "description": "The job.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicJobResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/PublicUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PublicForbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/PublicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      },
      "patch": {
        "tags": [
          "public"
        ],
        "operationId": "publicJobUpdate",
        "x-nf-scope": "jobs:write",
        "x-nf-read-scopes": [
          "jobs:read",
          "clients:read"
        ],
        "summary": "Change a job",
        "description": "Changes the fields sent, through the job's own save, and answers the job as it is now: its history, its\nnotifications, the technicians' pushes and an external calendar's sync are what the same change in the app\ngives. A field not sent stays; an empty string also stays; null clears what may be empty: `start` null takes the\ntime off, `service` and `description` null clear them (the copy of the service a job keeps as its appliance\ngoes with it, as in the app and on the web; an appliance the AI receptionist heard stays and is then answered\nas its `service`), `address` null puts the job back at its client's address; `technician_ids` `[]`\ntakes everybody off, and an id that is not an active technician of the company answers 422 on `technician_ids`.\n`start` alone keeps the job's length; `duration_minutes` alone keeps the start and moves the end (422 for a job\nwith no start). `status` is `confirmed`, `completed` or `canceled`. A body that changes nothing answers the job\nas it is. No field is compared with what the caller last read: the last write wins. 409 `conflict` with\n`current.reason` `job_conflict` and the reason as the message when the job cannot change this way now (a\ntechnician who is busy then, a change the job's state refuses). A job marked spam answers 404. The key needs\n`jobs:write`, `jobs:read` and `clients:read`. A company makes at most 2000 changes (of clients and jobs\ntogether) a rolling 24 hours through the API: past it 429 `rate_limited` with `current.reason` `daily_limit`\nuntil those 24 hours free room (the key keeps working; the owner gets one email a limit a day). With an\nIdempotency-Key, the same key and body again within 24 hours replays the first answer (`meta.replayed`). The\nchange raises the job's events as the same change in the app does: `job.updated` and, for what happened,\n`job.scheduled`, `job.completed` or `job.canceled`.\n",
        "security": [
          {
            "companyKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicIdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/PublicJobId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicJobPatch"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The job as it is now.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicJobResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/PublicUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PublicForbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/PublicConflict"
          },
          "413": {
            "$ref": "#/components/responses/PublicTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/PublicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/jobs/{job_id}/notes": {
      "post": {
        "tags": [
          "public"
        ],
        "operationId": "publicJobNote",
        "x-nf-scope": "jobs:write",
        "x-nf-read-scopes": [
          "jobs:read"
        ],
        "summary": "Add a note to a job",
        "description": "A note for the team: `text` is added as a new paragraph to the job's team note (what the app's \"Team note\"\nshows), never written over what is there. Answers 201 with the note as it was added (PublicJobNote); a note has\nno id and no author. 422 on `text` when the team note is full. 409 `conflict` with `current.reason`\n`job_conflict` when the team note kept changing while the note was added (send it again). A job marked spam\nanswers 404. The key needs `jobs:write` (the route) and also `jobs:read` (`x-nf-read-scopes`: a note names a job\nby its id; a Website booking key adds none). A company adds at most 1000 notes a rolling 24 hours through the\nAPI: past it 429 `rate_limited` with `current.reason` `daily_limit` until those 24 hours free room (the key\nkeeps working; the owner gets one email a limit a day). With an Idempotency-Key, the same key and body again\nwithin 24 hours replays the first answer (`meta.replayed`) and adds nothing.\n",
        "security": [
          {
            "companyKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicIdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/PublicJobId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicJobNoteInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The note.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicJobNoteResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/PublicUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PublicForbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/PublicConflict"
          },
          "413": {
            "$ref": "#/components/responses/PublicTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/PublicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/calls": {
      "get": {
        "tags": [
          "public"
        ],
        "operationId": "publicCalls",
        "x-nf-scope": "calls:read",
        "summary": "Finished AI calls",
        "description": "The AI receptionist's finished calls that are not spam, newest first by their end (then by id) unless `order`\nsays otherwise. A page at a time: send `meta.next_cursor` back as `cursor` with the same `order` and filters;\nit is null on the last page. Spam is left out after the read, so a page may hold fewer than `limit` calls\nwhile more follow: page on until `next_cursor` is null. `created_since` compares a call's end. The list of the\n`call.finished` trigger.\n",
        "security": [
          {
            "companyKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicLimit"
          },
          {
            "$ref": "#/components/parameters/PublicCursor"
          },
          {
            "$ref": "#/components/parameters/PublicOrder"
          },
          {
            "$ref": "#/components/parameters/PublicCreatedSince"
          },
          {
            "$ref": "#/components/parameters/PublicUpdatedSince"
          },
          {
            "name": "phone",
            "in": "query",
            "required": false,
            "description": "The calls from this number: a US number in any common form, matched with the caller's number on file. A value that is not a US number matches nothing.",
            "schema": {
              "type": "string",
              "maxLength": 32
            }
          },
          {
            "name": "client_id",
            "in": "query",
            "required": false,
            "description": "The calls of this client.",
            "schema": {
              "type": "string",
              "maxLength": 64,
              "examples": [
                "cli_1042"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The calls.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicCallListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/PublicUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PublicForbidden"
          },
          "429": {
            "$ref": "#/components/responses/PublicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/calls/{call_id}": {
      "get": {
        "tags": [
          "public"
        ],
        "operationId": "publicCall",
        "x-nf-scope": "calls:read",
        "summary": "A call",
        "description": "One call of the company by its id. 404 not_found for an id that names no call of the company (gone, another\ncompany's, an id of another kind, not an id). A call that is not finished, or that is spam, answers 404 too. A\nquery parameter answers 400.\n",
        "security": [
          {
            "companyKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicCallId"
          }
        ],
        "responses": {
          "200": {
            "description": "The call.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicCallResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/PublicUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PublicForbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/PublicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/technicians": {
      "get": {
        "tags": [
          "public"
        ],
        "operationId": "publicTechnicians",
        "x-nf-scope": "technicians:read",
        "summary": "Technicians",
        "description": "The company's technicians, those turned off too (`active` false), newest first by when they were added unless\n`order` says otherwise. A page at a time: send `meta.next_cursor` back as `cursor` with the same `order` and\nfilters; it is null on the last page. Their ids are what a job's `technicians`, the jobs list's\n`technician_id` and PATCH /jobs/{job_id}'s `technician_ids` use.\n",
        "security": [
          {
            "companyKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicLimit"
          },
          {
            "$ref": "#/components/parameters/PublicCursor"
          },
          {
            "$ref": "#/components/parameters/PublicOrder"
          },
          {
            "$ref": "#/components/parameters/PublicCreatedSince"
          },
          {
            "$ref": "#/components/parameters/PublicUpdatedSince"
          }
        ],
        "responses": {
          "200": {
            "description": "The technicians.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicTechnicianListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/PublicUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PublicForbidden"
          },
          "429": {
            "$ref": "#/components/responses/PublicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/technicians/{technician_id}": {
      "get": {
        "tags": [
          "public"
        ],
        "operationId": "publicTechnician",
        "x-nf-scope": "technicians:read",
        "summary": "A technician",
        "description": "One technician of the company by its id. 404 not_found for an id that names no technician of the company\n(gone, another company's, an id of another kind, not an id). A query parameter answers 400.\n",
        "security": [
          {
            "companyKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicTechnicianId"
          }
        ],
        "responses": {
          "200": {
            "description": "The technician.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicTechnicianResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/PublicUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PublicForbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/PublicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/estimates": {
      "get": {
        "tags": [
          "public"
        ],
        "operationId": "publicEstimates",
        "x-nf-scope": "estimates:read",
        "summary": "Estimates",
        "description": "The company's estimates, newest first by when they were made unless `order` says otherwise. A page at a time:\nsend `meta.next_cursor` back as `cursor` with the same `order` and filters; it is null on the last page. Read\nonly: the API makes and changes no estimate. `status` is worked out for each estimate (expired depends on the\ncompany's day), so its filter is applied after the read: a page may hold fewer than `limit` estimates while\nmore follow; page on until `next_cursor` is null. The list of the estimate triggers.\n",
        "security": [
          {
            "companyKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicLimit"
          },
          {
            "$ref": "#/components/parameters/PublicCursor"
          },
          {
            "$ref": "#/components/parameters/PublicOrder"
          },
          {
            "$ref": "#/components/parameters/PublicCreatedSince"
          },
          {
            "$ref": "#/components/parameters/PublicUpdatedSince"
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "The estimates of this status.",
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "sent",
                "approved",
                "declined",
                "expired"
              ]
            }
          },
          {
            "name": "client_id",
            "in": "query",
            "required": false,
            "description": "The estimates of this client.",
            "schema": {
              "type": "string",
              "maxLength": 64,
              "examples": [
                "cli_1042"
              ]
            }
          },
          {
            "name": "job_id",
            "in": "query",
            "required": false,
            "description": "The estimates of this job.",
            "schema": {
              "type": "string",
              "maxLength": 64,
              "examples": [
                "job_48213"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The estimates.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicEstimateListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/PublicUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PublicForbidden"
          },
          "429": {
            "$ref": "#/components/responses/PublicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/estimates/{estimate_id}": {
      "get": {
        "tags": [
          "public"
        ],
        "operationId": "publicEstimate",
        "x-nf-scope": "estimates:read",
        "summary": "An estimate",
        "description": "One estimate of the company by its id. 404 not_found for an id that names no estimate of the company (gone,\nanother company's, an id of another kind, not an id). A query parameter answers 400.\n",
        "security": [
          {
            "companyKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicEstimateId"
          }
        ],
        "responses": {
          "200": {
            "description": "The estimate.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicEstimateResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/PublicUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PublicForbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/PublicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/invoices": {
      "get": {
        "tags": [
          "public"
        ],
        "operationId": "publicInvoices",
        "x-nf-scope": "invoices:read",
        "summary": "Invoices",
        "description": "The company's invoices, newest first by when they were made unless `order` says otherwise. A page at a time:\nsend `meta.next_cursor` back as `cursor` with the same `order` and filters; it is null on the last page. Read\nonly: the API makes and changes no invoice. `status` is worked out for each invoice (overdue depends on the\ncompany's day), so its filter is applied after the read: a page may hold fewer than `limit` invoices while\nmore follow; page on until `next_cursor` is null. The list of the invoice triggers.\n",
        "security": [
          {
            "companyKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicLimit"
          },
          {
            "$ref": "#/components/parameters/PublicCursor"
          },
          {
            "$ref": "#/components/parameters/PublicOrder"
          },
          {
            "$ref": "#/components/parameters/PublicCreatedSince"
          },
          {
            "$ref": "#/components/parameters/PublicUpdatedSince"
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "The invoices of this status.",
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "sent",
                "viewed",
                "partial",
                "paid",
                "overdue",
                "canceled"
              ]
            }
          },
          {
            "name": "client_id",
            "in": "query",
            "required": false,
            "description": "The invoices of this client.",
            "schema": {
              "type": "string",
              "maxLength": 64,
              "examples": [
                "cli_1042"
              ]
            }
          },
          {
            "name": "job_id",
            "in": "query",
            "required": false,
            "description": "The invoices of this job.",
            "schema": {
              "type": "string",
              "maxLength": 64,
              "examples": [
                "job_48213"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The invoices.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicInvoiceListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/PublicUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PublicForbidden"
          },
          "429": {
            "$ref": "#/components/responses/PublicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/invoices/{invoice_id}": {
      "get": {
        "tags": [
          "public"
        ],
        "operationId": "publicInvoice",
        "x-nf-scope": "invoices:read",
        "summary": "An invoice",
        "description": "One invoice of the company by its id. 404 not_found for an id that names no invoice of the company (gone,\nanother company's, an id of another kind, not an id). A query parameter answers 400.\n",
        "security": [
          {
            "companyKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicInvoiceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The invoice.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicInvoiceResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/PublicUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PublicForbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/PublicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/payments": {
      "get": {
        "tags": [
          "public"
        ],
        "operationId": "publicPayments",
        "x-nf-scope": "payments:read",
        "summary": "Payments",
        "description": "The payments recorded on the company's invoices (payments, deposits and tips), newest first in the order they\nwere recorded unless `order` says otherwise. A page at a time: send `meta.next_cursor` back as `cursor` with\nthe same `order` and filters; it is null on the last page. Read only: the API takes and records no payment.\n`created_since` compares when a payment was recorded; `updated_since` and `order=updated_asc` go by when the\npayment's invoice last changed (a void or a refund always changes it). A page may hold fewer than `limit`\npayments while more follow: page on until `next_cursor` is null. The list of the payment triggers.\n",
        "security": [
          {
            "companyKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicLimit"
          },
          {
            "$ref": "#/components/parameters/PublicCursor"
          },
          {
            "$ref": "#/components/parameters/PublicOrder"
          },
          {
            "$ref": "#/components/parameters/PublicCreatedSince"
          },
          {
            "$ref": "#/components/parameters/PublicUpdatedSince"
          },
          {
            "name": "invoice_id",
            "in": "query",
            "required": false,
            "description": "The payments of this invoice.",
            "schema": {
              "type": "string",
              "maxLength": 64,
              "examples": [
                "inv_3305"
              ]
            }
          },
          {
            "name": "client_id",
            "in": "query",
            "required": false,
            "description": "The payments of this client's invoices.",
            "schema": {
              "type": "string",
              "maxLength": 64,
              "examples": [
                "cli_1042"
              ]
            }
          },
          {
            "name": "job_id",
            "in": "query",
            "required": false,
            "description": "The payments of this job's invoices.",
            "schema": {
              "type": "string",
              "maxLength": 64,
              "examples": [
                "job_48213"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The payments.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicPaymentListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/PublicUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PublicForbidden"
          },
          "429": {
            "$ref": "#/components/responses/PublicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/payments/{payment_id}": {
      "get": {
        "tags": [
          "public"
        ],
        "operationId": "publicPayment",
        "x-nf-scope": "payments:read",
        "summary": "A payment",
        "description": "One payment of the company by its id. 404 not_found for an id that names no payment of the company (gone,\nanother company's, an id of another kind, not an id). A query parameter answers 400.\n",
        "security": [
          {
            "companyKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicPaymentId"
          }
        ],
        "responses": {
          "200": {
            "description": "The payment.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicPaymentResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/PublicUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PublicForbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/PublicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/services": {
      "get": {
        "tags": [
          "public"
        ],
        "operationId": "publicServices",
        "x-nf-scope": "services:read",
        "summary": "Bookable services",
        "description": "The services the company's online booking offers, in the order its booking page shows them, for a booking form\non the company's own website (its server calls this, never a browser). `id` is what GET /availability takes.\n`duration_minutes` is the booking's slot length (every service is booked for one slot). `price_from_cents` and\n`price_to_cents` are the booking's service fee in cents when the booking page shows prices, else null. 403\n`forbidden` with `current.reason` `booking_closed` when the company's online booking is off.\n",
        "security": [
          {
            "companyKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "The services.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicServiceListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/PublicUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PublicForbidden"
          },
          "429": {
            "$ref": "#/components/responses/PublicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/availability": {
      "get": {
        "tags": [
          "public"
        ],
        "operationId": "publicAvailability",
        "x-nf-scope": "availability:read",
        "summary": "Free times",
        "description": "The free times of the company's online booking for one service, computed by the same code as its booking page\nand its Google booking: its online booking on or off, its hours and days, its slot length and the gap between\nslots, the visits a slot may take, its blocked time and holidays, its lead time, its booking window (60 days),\nits technicians' own hours, its service areas by ZIP, and its time zone. Each time carries a `slot_token` for\nPOST /jobs, good for 30 minutes. Where the company's booking needs the job's ZIP (its map gives jobs to\ntechnicians, or it turns down ZIPs it does not serve), `zip` is required: without it 422 with `fields.zip` and\n`current.reason` `zip_required`; a ZIP the company turns down online answers 422 `zip_not_served` with the\ncompany's own words. 409 `conflict` with `current.reason` `external_schedule` for a company whose online\nbooking uses Housecall Pro, its times or its jobs (the API does not book into it), and\n`phone_verification_required` for a company whose booking page asks each customer for a code texted to their\nphone (the API cannot ask it yet). Whether the company books online is answered before the query is read. A\nvalue of the query that is not what its parameter takes answers 422 with its field. A window an hour the\nclocks skip (DST) on its day is never offered.\n",
        "security": [
          {
            "companyKey": []
          }
        ],
        "parameters": [
          {
            "name": "service",
            "in": "query",
            "required": true,
            "description": "The `id` of a service of GET /services.",
            "schema": {
              "type": "string",
              "maxLength": 80
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "The first day, the company's date (\"2026-12-01\"); today in the company's zone when not sent.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 14,
              "default": 7
            }
          },
          {
            "name": "zip",
            "in": "query",
            "required": false,
            "description": "The job's 5-digit ZIP code; required where the company's booking needs it.",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]{5}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The free times, in order.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicAvailabilityResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/PublicUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PublicForbidden"
          },
          "409": {
            "$ref": "#/components/responses/PublicConflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/PublicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/webhooks": {
      "get": {
        "tags": [
          "public"
        ],
        "operationId": "publicWebhooks",
        "x-nf-scope": "webhooks:write",
        "summary": "The key's webhooks",
        "description": "The webhooks this key made, newest first, in one page (a company has at most 50; `meta.next_cursor` is null).\nA key sees only its own: a webhook that belongs to the company itself or to another key is not listed. No\n`secret` is in the list. A query parameter answers 400.\n",
        "security": [
          {
            "companyKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "The webhooks.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicWebhookListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/PublicUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PublicForbidden"
          },
          "429": {
            "$ref": "#/components/responses/PublicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      },
      "post": {
        "tags": [
          "public"
        ],
        "operationId": "publicWebhookCreate",
        "x-nf-scope": "webhooks:write",
        "summary": "Create a webhook",
        "description": "Each later event of the types in `events` is POSTed to `url` as its envelope (PublicEvent: the record as it\nwas when the event was raised under `data.object`), signed as Standard Webhooks says, a few seconds after it\nhappens. Every send carries `webhook-id` (the event's id, the same on every retry and for every webhook),\n`webhook-timestamp` (Unix seconds of this try) and `webhook-signature` (the components' headers\nPublicDelivery* describe each), with `Content-Type: application/json` and `User-Agent: Nexfield-Webhooks/1`.\nAnswers 201 with the webhook and its `secret`, once.\n\nA webhook belongs to the key that made it and ends with it (revoked, expired, or ended by a change of the\nowner's password); while the key is suspended it sends nothing. The same `url` again from the same key answers\n200 with the webhook already there, `secret` null: it takes this request's `events` and `description` and is\nturned back on (rotate the secret for a new one). From another key the same `url` makes that key's own webhook.\nA replay of the first answer by its Idempotency-Key carries the secret again (409 `conflict` with\n`current.reason` `webhook_gone` when the webhook was deleted since). The key needs `webhooks:write` and, for\neach type it names, the read scope of every record that type's event holds (else 403 `scope_missing`):\n`client.*` `clients:read`; `job.*` `jobs:read` and `clients:read` (a job holds its client's name, phone and\nemail); `call.finished` `calls:read`, `clients:read` and `jobs:read` (a call holds its client and its job);\n`estimate.*` `estimates:read`; `invoice.*` `invoices:read`; `payment.*` `payments:read`. `[\"*\"]` is every type\nthe key may read so, asked again at each send. `url` is any https address of the receiver's own (422 on `url`\notherwise): a host name, port 443, no IP address, no user or password, never a Nexfield host; at each send every\naddress the name resolves to must be public, and no redirect is followed. At most 50 webhooks a company, those\nturned off counted (422 on `url` past it). A key revoked, suspended or ended by a password change while the\nrequest ran answers 401.\n\nDelivery: any 2xx answer within 10 seconds is a delivery, on the first try and on every later one; the body of\nthe answer is not used. While a webhook is failing (no accepted delivery since a send failed) its first try of\neach pass of the sender has 10 seconds and its other tries 3, and a new event of it waits for the sender's next\npass instead of being sent at once. Anything else is tried again after 1, 5 and 30 minutes, then 2, 5, 10, 14,\n20 and 24 hours (three days), each wait moved by up to a tenth at random; a `Retry-After` of the receiver is\nhonored up to an hour. A 410 turns the webhook off at once (`disabled_reason` gone). After a day without one\naccepted delivery the company's owner gets one email; after three days the webhook is turned off (`failing`) and\nthe owner gets a second. A delivery that failed is kept 30 days. Deliveries are at least once, in no promised\norder: skip a `webhook-id` you already have. A `*.updated` event is raised only when its record says something\nnew, and one that waits unsent takes the newer event of the same record instead of a second delivery; a specific\njob event (`job.scheduled`, `job.started`, `job.completed`, `job.canceled`) is sent together with `job.updated`.\nEvents start when a webhook of their type exists: nothing from before is sent. At most 1000 deliveries of a\ncompany wait; past that the oldest are dropped. While the company is on hold or is not on a paid plan nothing is\nsent, and the sends that come up then are dropped. A key's webhook that stays off for 30 days is deleted.\n",
        "security": [
          {
            "companyKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicIdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicWebhookInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The webhook this key already had for the address, with `secret` null.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicWebhookSecretResponse"
                }
              }
            }
          },
          "201": {
            "description": "The new webhook, with its secret.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicWebhookSecretResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/PublicUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PublicForbidden"
          },
          "409": {
            "$ref": "#/components/responses/PublicConflict"
          },
          "413": {
            "$ref": "#/components/responses/PublicTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/PublicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/webhooks/{webhook_id}": {
      "get": {
        "tags": [
          "public"
        ],
        "operationId": "publicWebhook",
        "x-nf-scope": "webhooks:write",
        "summary": "A webhook",
        "description": "One webhook of this key by its id, without its secret. 404 not_found for an id that names no webhook of this\nkey (gone, another key's, the company's own, not an id). A query parameter answers 400.\n",
        "security": [
          {
            "companyKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicWebhookId"
          }
        ],
        "responses": {
          "200": {
            "description": "The webhook.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicWebhookResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/PublicUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PublicForbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/PublicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      },
      "patch": {
        "tags": [
          "public"
        ],
        "operationId": "publicWebhookUpdate",
        "x-nf-scope": "webhooks:write",
        "summary": "Change a webhook",
        "description": "Changes the fields sent of a webhook of this key and answers it as it is now, without its secret. A field not\nsent stays; an empty string also stays; null clears `description`. `enabled` true turns the webhook on (also one\nthe receiver's 410 or three failing days turned off; its failing time starts over), false turns it off: no event\nis raised for it while it is off, and a send that comes up then is dropped. `events` and `url` follow the rules\nof POST /webhooks (403 `scope_missing` for a type of which the key may not read every record its event holds;\n422 on `url` for an address that is not allowed, or that another webhook of this key already has). 404 for a\nwebhook that is not this key's. It takes no Idempotency-Key: sending the same change again changes nothing.\n",
        "security": [
          {
            "companyKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicWebhookId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicWebhookPatch"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The webhook as it is now.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicWebhookResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/PublicUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PublicForbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "$ref": "#/components/responses/PublicTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/PublicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "public"
        ],
        "operationId": "publicWebhookDelete",
        "x-nf-scope": "webhooks:write",
        "summary": "Delete a webhook",
        "description": "Deletes the webhook of the calling key and drops its waiting sends. A webhook that is not there, or that\nbelongs to another key or to the company, answers 204 as well and stays as it is (an unsubscribe is sent again\nby its sender; a late one of an old connection never ends a newer one's webhook). 404 only for a path that is\nnot a webhook's id. It takes no body (a field in one answers 422).\n",
        "security": [
          {
            "companyKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicWebhookId"
          }
        ],
        "responses": {
          "204": {
            "description": "The webhook is gone.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/PublicUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PublicForbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "$ref": "#/components/responses/PublicTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/PublicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/webhooks/{webhook_id}/rotate-secret": {
      "post": {
        "tags": [
          "public"
        ],
        "operationId": "publicWebhookRotateSecret",
        "x-nf-scope": "webhooks:write",
        "summary": "Rotate a webhook's secret",
        "description": "A new signing secret for a webhook of this key: 200 with the webhook and its new `secret`, once. For 24 hours\nevery send is signed with both, the new secret and the one before it (two signatures in `webhook-signature`,\nseparated by a space), so the receiver changes over without losing an event. 404 for a webhook that is not\nthis key's. It takes no body (a field in one answers 422) and no Idempotency-Key: each call makes a new\nsecret.\n",
        "security": [
          {
            "companyKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicWebhookId"
          }
        ],
        "responses": {
          "200": {
            "description": "The webhook with its new secret.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicWebhookSecretResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/PublicUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PublicForbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "$ref": "#/components/responses/PublicTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/PublicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/webhooks/{webhook_id}/test": {
      "post": {
        "tags": [
          "public"
        ],
        "operationId": "publicWebhookTest",
        "x-nf-scope": "webhooks:write",
        "summary": "Send a test event",
        "description": "Sends a `webhook.test` event (PublicEventWebhookTest: its `data.object` is the webhook's own record, with `url`\nnull) to a webhook of this key now, signed and guarded as every send, one try within 10 seconds, and answers\nwhat came back: 200 with `delivered`, the receiver's `status` and the event's id. A receiver that refuses or\ndoes not answer is still a 200 here, with `delivered` false. 409 `conflict` with `current.reason`\n`webhook_disabled` for a webhook that is off; 404 for one that is not this key's. It takes no body (a field in\none answers 422) and no Idempotency-Key.\n",
        "security": [
          {
            "companyKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PublicWebhookId"
          }
        ],
        "responses": {
          "200": {
            "description": "What the address answered.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Nexfield-Api-Version": {
                "$ref": "#/components/headers/PublicApiVersion"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/PublicRateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/PublicRateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/PublicRateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicWebhookTestResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "401": {
            "$ref": "#/components/responses/PublicUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PublicForbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/PublicConflict"
          },
          "413": {
            "$ref": "#/components/responses/PublicTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "429": {
            "$ref": "#/components/responses/PublicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    }
  },
  "components": {
    "headers": {
      "PublicApiVersion": {
        "description": "The public API's version of this answer, `1` (on every answer of /api/v1).",
        "schema": {
          "type": "string",
          "enum": [
            "1"
          ]
        }
      },
      "PublicDeliveryId": {
        "description": "Delivery header `webhook-id` (Standard Webhooks): the id of the event (`evt_…`, the body's `id`), the same on every retry and for every webhook that gets the event. Deliveries are at least once: skip an id you already have. Part of the signed text.",
        "schema": {
          "type": "string",
          "maxLength": 64,
          "examples": [
            "evt_81234"
          ]
        }
      },
      "PublicDeliverySignature": {
        "description": "Delivery header `webhook-signature` (Standard Webhooks): `v1,` and the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>` (the two header values as sent and the raw body bytes, joined by dots). The HMAC's key is the base64-decoded part of the webhook's `secret` after `whsec_`. For 24 hours after POST /webhooks/{webhook_id}/rotate-secret there are two signatures separated by a space, the new secret's and the one before it: accept a delivery when any one matches. Compare in constant time; the standardwebhooks libraries do all of it.",
        "schema": {
          "type": "string",
          "pattern": "^v1,[A-Za-z0-9+/]{43}=( v1,[A-Za-z0-9+/]{43}=)*$"
        }
      },
      "PublicDeliveryTimestamp": {
        "description": "Delivery header `webhook-timestamp` (Standard Webhooks): Unix seconds of this try (refuse one far from your clock, e.g. 5 minutes). Part of the signed text.",
        "schema": {
          "type": "string",
          "pattern": "^[0-9]+$"
        }
      },
      "PublicRateLimitLimit": {
        "description": "The requests the tightest bucket of this request allows in its window (the key's 120 a minute, the company's 300; for a refused key, the address's 600).",
        "schema": {
          "type": "integer",
          "minimum": 1
        }
      },
      "PublicRateLimitRemaining": {
        "description": "The requests left in the window after this one (0 at or past the limit).",
        "schema": {
          "type": "integer",
          "minimum": 0
        }
      },
      "PublicRateLimitReset": {
        "description": "Seconds until the window ends and the bucket is full again.",
        "schema": {
          "type": "integer",
          "minimum": 1
        }
      },
      "RequestId": {
        "description": "The id of this request (also `meta.request_id`). Quote it to support.",
        "schema": {
          "$ref": "#/components/schemas/RequestId"
        }
      },
      "RetryAfter": {
        "description": "Seconds to wait before trying again.",
        "schema": {
          "type": "integer",
          "minimum": 1
        }
      }
    },
    "parameters": {
      "PublicCallId": {
        "name": "call_id",
        "in": "path",
        "required": true,
        "description": "A call's `id`, as the API gave it.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64,
          "examples": [
            "call_9917"
          ]
        }
      },
      "PublicClientId": {
        "name": "client_id",
        "in": "path",
        "required": true,
        "description": "A client's `id`, as the API gave it.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64,
          "examples": [
            "cli_1042"
          ]
        }
      },
      "PublicCreatedSince": {
        "name": "created_since",
        "in": "query",
        "required": false,
        "description": "Only records made at or after this time (RFC 3339 with `Z` or an offset, \"2026-12-01T17:05:00Z\"). Calls: only those that ended at or after it (a call is listed when it ends).",
        "schema": {
          "type": "string",
          "format": "date-time"
        }
      },
      "PublicCursor": {
        "name": "cursor",
        "in": "query",
        "required": false,
        "description": "`meta.next_cursor` of the previous page of the same list, as it is (opaque, signed, of this list, company and `order`; an empty one, another list's, another company's, another order's or a changed one answers 400 invalid_request with `fields.cursor`). Send the same `order` and filters with it. Not sent: the first page.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 2048
        }
      },
      "PublicEstimateId": {
        "name": "estimate_id",
        "in": "path",
        "required": true,
        "description": "An estimate's `id`, as the API gave it.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64,
          "examples": [
            "est_771"
          ]
        }
      },
      "PublicIdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "description": "Any 1 to 255 visible characters per intended write (another value answers 400). Held 24 hours for the key that sent it: the same key and body again replays the first answer with `meta.replayed` true; the same key with another body or route answers 409 idempotency_conflict with `current.reason` `idempotency_mismatch`. A record made whose answer was lost is answered again (201); one deleted since answers 409 conflict with `current.reason` `record_gone` (a webhook: `webhook_gone`). An error answer is not held, so a retry after one runs again. Without it the write runs every time.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255
        }
      },
      "PublicInvoiceId": {
        "name": "invoice_id",
        "in": "path",
        "required": true,
        "description": "An invoice's `id`, as the API gave it.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64,
          "examples": [
            "inv_3305"
          ]
        }
      },
      "PublicJobId": {
        "name": "job_id",
        "in": "path",
        "required": true,
        "description": "A job's `id`, as the API gave it.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64,
          "examples": [
            "job_48213"
          ]
        }
      },
      "PublicLimit": {
        "name": "limit",
        "in": "query",
        "required": false,
        "description": "How many records a page holds (1 to 100; 25 when not sent). Another value answers 400 invalid_request with `fields.limit`.",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 25
        }
      },
      "PublicOrder": {
        "name": "order",
        "in": "query",
        "required": false,
        "description": "`created_desc` (the default): newest first by when the record was made, then by id (calls: by when they ended; payments: in the order they were recorded), what a trigger's list call needs; records added meanwhile never shift a later page. `updated_asc`: oldest change first, by `updated_at` then id, what a sync needs.",
        "schema": {
          "type": "string",
          "enum": [
            "created_desc",
            "updated_asc"
          ],
          "default": "created_desc"
        }
      },
      "PublicPaymentId": {
        "name": "payment_id",
        "in": "path",
        "required": true,
        "description": "A payment's `id`, as the API gave it.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64,
          "examples": [
            "pay_20417"
          ]
        }
      },
      "PublicTechnicianId": {
        "name": "technician_id",
        "in": "path",
        "required": true,
        "description": "A technician's `id`, as the API gave it.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64,
          "examples": [
            "tech_12"
          ]
        }
      },
      "PublicUpdatedSince": {
        "name": "updated_since",
        "in": "query",
        "required": false,
        "description": "Only records whose `updated_at` is at or after this time (RFC 3339 with `Z` or an offset). A sync asks again from a minute before its last record's `updated_at` and skips what it already has: a change that was being saved while the page was read can carry an earlier time. Once a year, in the hour the clocks go back, the times of jobs, estimates, invoices and payments (and of a client that was never changed) are kept as a wall clock that reads the same twice: such a time is answered as the earlier of its two instants, and this filter then reaches up to an hour further back, so a record of that hour may be answered a second time and none is left out. The times of clients' changes, technicians and calls are exact in every hour.",
        "schema": {
          "type": "string",
          "format": "date-time"
        }
      },
      "PublicWebhookId": {
        "name": "webhook_id",
        "in": "path",
        "required": true,
        "description": "A webhook's `id`, as the API gave it.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64,
          "examples": [
            "wh_42"
          ]
        }
      }
    },
    "responses": {
      "InvalidRequest": {
        "description": "`invalid_request`: malformed JSON, a wrong content type, a missing or malformed header, an unknown cursor.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "NotFound": {
        "description": "`not_found`: the object does not exist or is not visible to this person.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "PublicConflict": {
        "description": "`conflict` with `current.reason` `phone_taken` (the client that has the number in `current.client`), `duplicate` (the job in `current.job`, for a key that may read jobs), `job_conflict` (the job cannot change this way now; the message says why), `slot_taken` (a booking's time is no longer free), `external_schedule` (the company's online booking takes its times from Housecall Pro), `phone_verification_required` (its booking page asks each customer for a texted code), `webhook_disabled` (a test of a webhook that is off), `record_gone` or `webhook_gone` (what an Idempotency-Key's first request made was deleted since); or `idempotency_conflict` with `current.reason` `idempotency_mismatch`, or while the key's first request still runs.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          },
          "Nexfield-Api-Version": {
            "$ref": "#/components/headers/PublicApiVersion"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "PublicForbidden": {
        "description": "`forbidden` with `current.reason` `key_suspended` (the key kept trying what it may not: a scope it lacks, an address it is not allowed from; the owner resumes or revokes it in Settings -> API), `plan_required` (the company is on hold, or it is not on a paid plan; the message says which), `scope_missing` (the key lacks a scope the route needs, or the read scope of a record the answer or a webhook's event holds, named in `current.scope`), `ip_not_allowed` (the key has allowed IP addresses and the request came from another; it counts toward suspension), `booking_closed` (the company's online booking is off) or `booking_refused` (the number is on the company's blocklist).",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          },
          "Nexfield-Api-Version": {
            "$ref": "#/components/headers/PublicApiVersion"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "PublicRateLimited": {
        "description": "`rate_limited`, with `retry_after` (seconds) and the `Retry-After` header: past the key's 120 or the company's 300 requests a minute, or a refused key's address's 600. On a write also with `current.reason` `daily_limit` and `current.limit`: the company reached what a rolling 24 hours allows (500 new clients, 500 new jobs, 2000 changes, 1000 notes). The write is refused until those 24 hours free room (`Retry-After` an hour); the key is not suspended and every other request goes on.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          },
          "Nexfield-Api-Version": {
            "$ref": "#/components/headers/PublicApiVersion"
          },
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/PublicRateLimitLimit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/PublicRateLimitRemaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/PublicRateLimitReset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "PublicTooLarge": {
        "description": "`invalid_request` with status 413: the request body is larger than 16 KB.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          },
          "Nexfield-Api-Version": {
            "$ref": "#/components/headers/PublicApiVersion"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "PublicUnauthorized": {
        "description": "`unauthorized`: no key, or a key that is not a live key (revoked, mistyped or without its checksum, expired, ended by a change of the owner's password, or a device token), or a closed company. The message says what to do (an expired key's says when it expired).",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          },
          "Nexfield-Api-Version": {
            "$ref": "#/components/headers/PublicApiVersion"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "ServerError": {
        "description": "`server_error`: an unexpected error (logged with the request id).",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "Unavailable": {
        "description": "`unavailable`: the server is being updated or misconfigured, or busy for a moment (parallel requests that kept\nmeeting in the database; `retry_after` 1). Try again later (`retry_after` when known); a write repeats with\nthe same `Idempotency-Key`.\n",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "ValidationFailed": {
        "description": "`validation_failed`: `fields` maps each bad field (dotted path) to a sentence to show next to it.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      }
    },
    "schemas": {
      "ClosedAccount": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "closed_at",
          "purge_after",
          "restore_ticket"
        ],
        "description": "The owner's closed company, sent only with 403 `account_closed` on `POST /auth/login` (ADR-080).",
        "properties": {
          "closed_at": {
            "description": "When the owner's deletion closed the company.",
            "$ref": "#/components/schemas/DateTime"
          },
          "purge_after": {
            "description": "The end of the 30 days, the deletion's `restore_until`: the day \"Your account is closed\" names. Until then\nsigning in offers the restore; after it the personal data of the company's logins is erased, the business\nrecords stay, and the owner comes back by signing up again with the same email.\n",
            "$ref": "#/components/schemas/DateTime"
          },
          "restore_ticket": {
            "description": "For `POST /account/restore`: single use, for 10 minutes, bound to this company and its deletion. A\nsecret: kept out of logs.\n",
            "$ref": "#/components/schemas/Token43"
          }
        }
      },
      "Currency": {
        "type": "string",
        "pattern": "^[A-Z]{3}$"
      },
      "Cursor": {
        "type": "string",
        "minLength": 1,
        "maxLength": 2048,
        "pattern": "^[A-Za-z0-9_.-]+$"
      },
      "DateTime": {
        "type": "string",
        "format": "date-time",
        "description": "RFC 3339, UTC."
      },
      "ErrorBody": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "$ref": "#/components/schemas/ErrorCode"
          },
          "message": {
            "type": "string",
            "minLength": 1,
            "description": "One sentence safe to show to people."
          },
          "fields": {
            "type": "object",
            "description": "Dotted field path to a sentence to show next to that field.",
            "additionalProperties": {
              "type": "string"
            }
          },
          "retry_after": {
            "type": "integer",
            "minimum": 1,
            "description": "Seconds to wait (rate_limited, unavailable)."
          },
          "current": {
            "type": "object",
            "description": "The current state of the object a `conflict` was about."
          },
          "closed": {
            "description": "Only with 403 `account_closed`: the closed company and the ticket that restores it.",
            "$ref": "#/components/schemas/ClosedAccount"
          }
        }
      },
      "ErrorCode": {
        "type": "string",
        "enum": [
          "invalid_request",
          "validation_failed",
          "invalid_credentials",
          "unauthorized",
          "session_expired",
          "session_revoked",
          "forbidden",
          "capability_required",
          "not_found",
          "conflict",
          "idempotency_conflict",
          "rate_limited",
          "step_up_required",
          "step_up_failed",
          "reauth_required",
          "account_on_hold",
          "account_closed",
          "company_closed",
          "upgrade_required",
          "unavailable",
          "server_error"
        ]
      },
      "ErrorResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "$ref": "#/components/schemas/ErrorBody"
          }
        }
      },
      "Meta": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "request_id"
        ],
        "properties": {
          "request_id": {
            "$ref": "#/components/schemas/RequestId"
          },
          "next_cursor": {
            "description": "The cursor of the next page; null on the last page.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/Cursor"
              },
              {
                "type": "null"
              }
            ]
          },
          "replayed": {
            "type": "boolean",
            "description": "True when this is the stored answer to a repeated Idempotency-Key."
          },
          "notice": {
            "type": "string",
            "minLength": 1,
            "maxLength": 600,
            "description": "What the person must be told although the request succeeded, in plain words, to be shown as it is and\nnot as a passing toast. Today only `POST /service-plans/members/{member_id}/cancel` sends it: Stripe gave\nthe last payment back and the payment does not show the refund yet (\"... The CRM has not recorded it on\nthis payment yet ...\"). Absent when there is nothing to say. A client that does not know it ignores it.\n"
          }
        }
      },
      "PublicAvailabilityResponse": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicSlot"
            }
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "PublicBookingConfirmation": {
        "type": "object",
        "required": [
          "id",
          "number",
          "stage",
          "status",
          "start_local",
          "end_local",
          "timezone",
          "start",
          "end",
          "service"
        ],
        "description": "The job of a booking for a key without jobs:read and clients:read. It holds nothing of the client.",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "examples": [
              "job_48213"
            ]
          },
          "number": {
            "type": "string"
          },
          "stage": {
            "type": "string",
            "x-extensible-enum": [
              "open",
              "done",
              "canceled"
            ]
          },
          "status": {
            "type": "string",
            "x-extensible-enum": [
              "new",
              "confirmed",
              "rescheduled",
              "in_progress",
              "completed",
              "canceled",
              "warranty_callback",
              "important_message",
              "spam"
            ]
          },
          "start_local": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}$"
          },
          "end_local": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}$"
          },
          "timezone": {
            "type": "string"
          },
          "start": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DateTime"
              },
              {
                "type": "null"
              }
            ]
          },
          "end": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DateTime"
              },
              {
                "type": "null"
              }
            ]
          },
          "service": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "PublicBookingInput": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "slot_token",
          "client_name",
          "client_phone",
          "address"
        ],
        "properties": {
          "slot_token": {
            "type": "string",
            "maxLength": 600
          },
          "client_name": {
            "type": "string",
            "maxLength": 100
          },
          "client_phone": {
            "type": "string",
            "maxLength": 32,
            "description": "Finds the company's client with this number, else a new client is added."
          },
          "client_email": {
            "type": "string",
            "maxLength": 100
          },
          "address": {
            "type": "string",
            "maxLength": 255
          },
          "service": {
            "type": "string",
            "maxLength": 100,
            "description": "The slot_token's service id, when sent (the token names the service)."
          },
          "description": {
            "type": "string",
            "maxLength": 4000
          }
        }
      },
      "PublicBookingResponse": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/PublicBookingConfirmation"
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "PublicCall": {
        "type": "object",
        "required": [
          "id",
          "started_at",
          "ended_at",
          "duration_seconds",
          "caller_phone",
          "caller_phone_display",
          "summary",
          "outcome",
          "client",
          "job",
          "line",
          "recording_url",
          "created_at",
          "updated_at",
          "url"
        ],
        "description": "A call the AI receptionist answered and finished. Spam calls are never listed, read or sent.",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "description": "An opaque string, at most 64 characters.",
            "examples": [
              "call_9917"
            ]
          },
          "started_at": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DateTime"
              },
              {
                "type": "null"
              }
            ]
          },
          "ended_at": {
            "$ref": "#/components/schemas/DateTime"
          },
          "duration_seconds": {
            "type": "integer",
            "minimum": 0
          },
          "caller_phone": {
            "type": [
              "string",
              "null"
            ],
            "description": "E.164 (+17145550123), or null."
          },
          "caller_phone_display": {
            "type": [
              "string",
              "null"
            ]
          },
          "summary": {
            "type": [
              "string",
              "null"
            ]
          },
          "outcome": {
            "type": "string",
            "x-extensible-enum": [
              "booked",
              "message",
              "conversation"
            ],
            "description": "booked (the call made a job), message (the caller left a message), conversation (anything else). More values may come; accept values you do not know."
          },
          "client": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PublicCallClient"
              },
              {
                "type": "null"
              }
            ]
          },
          "job": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PublicCallJob"
              },
              {
                "type": "null"
              }
            ]
          },
          "line": {
            "description": "The company's own line the call came in on (its parts null when unknown).",
            "$ref": "#/components/schemas/PublicLine"
          },
          "recording_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "The recording through Nexfield's signed link, valid 7 days."
          },
          "created_at": {
            "description": "When the call began (the same as started_at).",
            "oneOf": [
              {
                "$ref": "#/components/schemas/DateTime"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DateTime"
              },
              {
                "type": "null"
              }
            ]
          },
          "url": {
            "type": "string",
            "description": "The call's job, else its client, else Activity in the web CRM."
          }
        }
      },
      "PublicCallClient": {
        "type": "object",
        "required": [
          "id",
          "name"
        ],
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "examples": [
              "cli_1042"
            ]
          },
          "name": {
            "type": "string"
          }
        }
      },
      "PublicCallJob": {
        "type": "object",
        "required": [
          "id",
          "number"
        ],
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "examples": [
              "job_48213"
            ]
          },
          "number": {
            "type": "string"
          }
        }
      },
      "PublicCallListResponse": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/PublicCall"
            }
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "PublicCallResponse": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/PublicCall"
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "PublicClient": {
        "type": "object",
        "required": [
          "id",
          "number",
          "name",
          "phone",
          "phone_display",
          "email",
          "address",
          "notes",
          "source",
          "sms_opted_out",
          "created_at",
          "updated_at",
          "url"
        ],
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "description": "An opaque string, at most 64 characters.",
            "examples": [
              "cli_1042"
            ]
          },
          "number": {
            "type": [
              "string",
              "null"
            ],
            "description": "The client number the company sees."
          },
          "name": {
            "type": "string"
          },
          "phone": {
            "type": [
              "string",
              "null"
            ],
            "description": "E.164 (+17145550123); null when there is none, or when the number on file is not one that can be written so."
          },
          "phone_display": {
            "type": [
              "string",
              "null"
            ],
            "description": "The number as people read it, (714) 555-0123; a number that is not E.164 as it is on file."
          },
          "email": {
            "type": [
              "string",
              "null"
            ],
            "description": "The main email."
          },
          "address": {
            "type": [
              "string",
              "null"
            ],
            "description": "The main address."
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "description": "How the client first came: the `source` of the client's first job when the client was added with it (not more than a day before it: a booking or a call adds its client with its job), else the way the client was added (`kind` only), so within a day of being added a client's source may be settled by its first job. Nexfield keeps no mark of a client the API added alone (`POST /clients`): such a client answers `manual` until a job of it settles its source. Settling it raises no `client.updated` by itself.",
            "$ref": "#/components/schemas/PublicSource"
          },
          "sms_opted_out": {
            "type": "boolean",
            "description": "The client's phone told the company STOP and has not said START since: Nexfield sends it no text. Kept for the company by the number, so another client with the same number says the same. No email opt-out is kept per client. A STOP changes no client: it raises no `client.updated` by itself."
          },
          "created_at": {
            "description": "When the client was added. Null only for an old record without a time on file (no list holds such a record).",
            "oneOf": [
              {
                "$ref": "#/components/schemas/DateTime"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "description": "When the client last changed; its created_at until its first change.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/DateTime"
              },
              {
                "type": "null"
              }
            ]
          },
          "url": {
            "type": "string",
            "description": "The client's page in the web CRM."
          }
        }
      },
      "PublicClientInput": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "phone"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 100
          },
          "phone": {
            "type": "string",
            "maxLength": 32,
            "description": "A 10-digit US number in any common format."
          },
          "email": {
            "type": "string",
            "maxLength": 100
          },
          "address": {
            "type": "string",
            "maxLength": 255
          },
          "notes": {
            "type": "string",
            "maxLength": 4000
          }
        }
      },
      "PublicClientListResponse": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/PublicClient"
            }
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "PublicClientPatch": {
        "type": "object",
        "additionalProperties": false,
        "description": "Only the fields to change. A field not sent stays; an empty string also stays; null clears `email`, `address` or `notes`; null for `name` or `phone` answers 422.",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 100
          },
          "phone": {
            "type": "string",
            "maxLength": 32,
            "description": "A 10-digit US number in any common format."
          },
          "email": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 100,
            "description": "Null clears the main email."
          },
          "address": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 255,
            "description": "Null clears the main address."
          },
          "notes": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 4000,
            "description": "Null clears the notes."
          }
        }
      },
      "PublicClientResponse": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/PublicClient"
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "PublicEstimate": {
        "type": "object",
        "required": [
          "id",
          "number",
          "status",
          "client_id",
          "job_id",
          "total_cents",
          "total_max_cents",
          "currency",
          "valid_until",
          "sent_at",
          "approved_at",
          "declined_at",
          "created_at",
          "updated_at",
          "url"
        ],
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "description": "An opaque string, at most 64 characters.",
            "examples": [
              "est_771"
            ]
          },
          "number": {
            "type": "string",
            "description": "The estimate number the company sees."
          },
          "status": {
            "type": "string",
            "x-extensible-enum": [
              "draft",
              "sent",
              "approved",
              "declined",
              "expired"
            ],
            "description": "As the app shows it; expired on the company's day. An estimate turned into a job or an invoice is approved. More values may come."
          },
          "client_id": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64
          },
          "job_id": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64
          },
          "total_cents": {
            "type": "integer",
            "description": "The total; while the client still chooses between options, the lowest option's."
          },
          "total_max_cents": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The highest option's total while the client still chooses between options with different totals; else null."
          },
          "currency": {
            "$ref": "#/components/schemas/Currency"
          },
          "valid_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "The company's date, \"2026-12-31\"."
          },
          "sent_at": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DateTime"
              },
              {
                "type": "null"
              }
            ]
          },
          "approved_at": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DateTime"
              },
              {
                "type": "null"
              }
            ]
          },
          "declined_at": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DateTime"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DateTime"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DateTime"
              },
              {
                "type": "null"
              }
            ]
          },
          "url": {
            "type": "string",
            "description": "The estimate's page in the web CRM."
          }
        }
      },
      "PublicEstimateListResponse": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/PublicEstimate"
            }
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "PublicEstimateResponse": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/PublicEstimate"
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "PublicEvent": {
        "type": "object",
        "required": [
          "id",
          "type",
          "created_at",
          "api_version",
          "data"
        ],
        "description": "The body of every delivery to a webhook: one event, with the record it is about under `data.object` as it was when the event was raised (every try and every receiver gets the same bytes; read the record by its id for how it is now). One schema per type follows (PublicEvent<Type>). More types may come: accept a `type` you do not know and answer 2xx.",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "description": "The event's id, an opaque string; also the delivery's `webhook-id` header.",
            "examples": [
              "evt_81234"
            ]
          },
          "type": {
            "type": "string",
            "x-extensible-enum": [
              "client.created",
              "client.updated",
              "job.created",
              "job.updated",
              "job.scheduled",
              "job.started",
              "job.completed",
              "job.canceled",
              "call.finished",
              "estimate.created",
              "estimate.sent",
              "estimate.approved",
              "estimate.declined",
              "invoice.created",
              "invoice.sent",
              "invoice.paid",
              "payment.created",
              "payment.refunded",
              "webhook.test"
            ]
          },
          "created_at": {
            "description": "When the event was raised.",
            "$ref": "#/components/schemas/DateTime"
          },
          "api_version": {
            "type": "string",
            "enum": [
              "1"
            ],
            "description": "The public API's version of the body."
          },
          "data": {
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "type": "object",
                "description": "The record, in the shape of its kind (a client, a job, a call, an estimate, an invoice, a payment; for webhook.test the webhook)."
              }
            }
          }
        }
      },
      "PublicEventCallFinished": {
        "type": "object",
        "x-nf-event": "call.finished",
        "required": [
          "id",
          "type",
          "created_at",
          "api_version",
          "data"
        ],
        "description": "The AI receptionist finished a call that is not spam and its report is in.",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "examples": [
              "evt_81234"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "call.finished"
            ]
          },
          "created_at": {
            "$ref": "#/components/schemas/DateTime"
          },
          "api_version": {
            "type": "string",
            "enum": [
              "1"
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/PublicCall"
              }
            }
          }
        }
      },
      "PublicEventClientCreated": {
        "type": "object",
        "x-nf-event": "client.created",
        "required": [
          "id",
          "type",
          "created_at",
          "api_version",
          "data"
        ],
        "description": "A client was added.",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "examples": [
              "evt_81234"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "client.created"
            ]
          },
          "created_at": {
            "$ref": "#/components/schemas/DateTime"
          },
          "api_version": {
            "type": "string",
            "enum": [
              "1"
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/PublicClient"
              }
            }
          }
        }
      },
      "PublicEventClientUpdated": {
        "type": "object",
        "x-nf-event": "client.updated",
        "required": [
          "id",
          "type",
          "created_at",
          "api_version",
          "data"
        ],
        "description": "A client changed. Raised only when the record says something its last event did not.",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "examples": [
              "evt_81234"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "client.updated"
            ]
          },
          "created_at": {
            "$ref": "#/components/schemas/DateTime"
          },
          "api_version": {
            "type": "string",
            "enum": [
              "1"
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/PublicClient"
              }
            }
          }
        }
      },
      "PublicEventEstimateApproved": {
        "type": "object",
        "x-nf-event": "estimate.approved",
        "required": [
          "id",
          "type",
          "created_at",
          "api_version",
          "data"
        ],
        "description": "An estimate was approved.",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "examples": [
              "evt_81234"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "estimate.approved"
            ]
          },
          "created_at": {
            "$ref": "#/components/schemas/DateTime"
          },
          "api_version": {
            "type": "string",
            "enum": [
              "1"
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/PublicEstimate"
              }
            }
          }
        }
      },
      "PublicEventEstimateCreated": {
        "type": "object",
        "x-nf-event": "estimate.created",
        "required": [
          "id",
          "type",
          "created_at",
          "api_version",
          "data"
        ],
        "description": "An estimate was made.",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "examples": [
              "evt_81234"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "estimate.created"
            ]
          },
          "created_at": {
            "$ref": "#/components/schemas/DateTime"
          },
          "api_version": {
            "type": "string",
            "enum": [
              "1"
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/PublicEstimate"
              }
            }
          }
        }
      },
      "PublicEventEstimateDeclined": {
        "type": "object",
        "x-nf-event": "estimate.declined",
        "required": [
          "id",
          "type",
          "created_at",
          "api_version",
          "data"
        ],
        "description": "An estimate was declined.",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "examples": [
              "evt_81234"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "estimate.declined"
            ]
          },
          "created_at": {
            "$ref": "#/components/schemas/DateTime"
          },
          "api_version": {
            "type": "string",
            "enum": [
              "1"
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/PublicEstimate"
              }
            }
          }
        }
      },
      "PublicEventEstimateSent": {
        "type": "object",
        "x-nf-event": "estimate.sent",
        "required": [
          "id",
          "type",
          "created_at",
          "api_version",
          "data"
        ],
        "description": "An estimate was sent to its client.",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "examples": [
              "evt_81234"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "estimate.sent"
            ]
          },
          "created_at": {
            "$ref": "#/components/schemas/DateTime"
          },
          "api_version": {
            "type": "string",
            "enum": [
              "1"
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/PublicEstimate"
              }
            }
          }
        }
      },
      "PublicEventInvoiceCreated": {
        "type": "object",
        "x-nf-event": "invoice.created",
        "required": [
          "id",
          "type",
          "created_at",
          "api_version",
          "data"
        ],
        "description": "An invoice was made.",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "examples": [
              "evt_81234"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "invoice.created"
            ]
          },
          "created_at": {
            "$ref": "#/components/schemas/DateTime"
          },
          "api_version": {
            "type": "string",
            "enum": [
              "1"
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/PublicInvoice"
              }
            }
          }
        }
      },
      "PublicEventInvoicePaid": {
        "type": "object",
        "x-nf-event": "invoice.paid",
        "required": [
          "id",
          "type",
          "created_at",
          "api_version",
          "data"
        ],
        "description": "An invoice became paid.",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "examples": [
              "evt_81234"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "invoice.paid"
            ]
          },
          "created_at": {
            "$ref": "#/components/schemas/DateTime"
          },
          "api_version": {
            "type": "string",
            "enum": [
              "1"
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/PublicInvoice"
              }
            }
          }
        }
      },
      "PublicEventInvoiceSent": {
        "type": "object",
        "x-nf-event": "invoice.sent",
        "required": [
          "id",
          "type",
          "created_at",
          "api_version",
          "data"
        ],
        "description": "An invoice was sent to its client.",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "examples": [
              "evt_81234"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "invoice.sent"
            ]
          },
          "created_at": {
            "$ref": "#/components/schemas/DateTime"
          },
          "api_version": {
            "type": "string",
            "enum": [
              "1"
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/PublicInvoice"
              }
            }
          }
        }
      },
      "PublicEventJobCanceled": {
        "type": "object",
        "x-nf-event": "job.canceled",
        "required": [
          "id",
          "type",
          "created_at",
          "api_version",
          "data"
        ],
        "description": "A job was canceled (sent together with job.updated), or marked spam (once, alone, with stage canceled and status spam).",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "examples": [
              "evt_81234"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "job.canceled"
            ]
          },
          "created_at": {
            "$ref": "#/components/schemas/DateTime"
          },
          "api_version": {
            "type": "string",
            "enum": [
              "1"
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/PublicJob"
              }
            }
          }
        }
      },
      "PublicEventJobCompleted": {
        "type": "object",
        "x-nf-event": "job.completed",
        "required": [
          "id",
          "type",
          "created_at",
          "api_version",
          "data"
        ],
        "description": "A job was done. Sent together with job.updated.",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "examples": [
              "evt_81234"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "job.completed"
            ]
          },
          "created_at": {
            "$ref": "#/components/schemas/DateTime"
          },
          "api_version": {
            "type": "string",
            "enum": [
              "1"
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/PublicJob"
              }
            }
          }
        }
      },
      "PublicEventJobCreated": {
        "type": "object",
        "x-nf-event": "job.created",
        "required": [
          "id",
          "type",
          "created_at",
          "api_version",
          "data"
        ],
        "description": "A job was made. A row that is spam raises none.",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "examples": [
              "evt_81234"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "job.created"
            ]
          },
          "created_at": {
            "$ref": "#/components/schemas/DateTime"
          },
          "api_version": {
            "type": "string",
            "enum": [
              "1"
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/PublicJob"
              }
            }
          }
        }
      },
      "PublicEventJobScheduled": {
        "type": "object",
        "x-nf-event": "job.scheduled",
        "required": [
          "id",
          "type",
          "created_at",
          "api_version",
          "data"
        ],
        "description": "A job's time was set or moved. Sent together with job.updated.",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "examples": [
              "evt_81234"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "job.scheduled"
            ]
          },
          "created_at": {
            "$ref": "#/components/schemas/DateTime"
          },
          "api_version": {
            "type": "string",
            "enum": [
              "1"
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/PublicJob"
              }
            }
          }
        }
      },
      "PublicEventJobStarted": {
        "type": "object",
        "x-nf-event": "job.started",
        "required": [
          "id",
          "type",
          "created_at",
          "api_version",
          "data"
        ],
        "description": "Work on a job began. Sent together with job.updated.",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "examples": [
              "evt_81234"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "job.started"
            ]
          },
          "created_at": {
            "$ref": "#/components/schemas/DateTime"
          },
          "api_version": {
            "type": "string",
            "enum": [
              "1"
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/PublicJob"
              }
            }
          }
        }
      },
      "PublicEventJobUpdated": {
        "type": "object",
        "x-nf-event": "job.updated",
        "required": [
          "id",
          "type",
          "created_at",
          "api_version",
          "data"
        ],
        "description": "A job changed in any way. Raised only when the record says something its last event did not.",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "examples": [
              "evt_81234"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "job.updated"
            ]
          },
          "created_at": {
            "$ref": "#/components/schemas/DateTime"
          },
          "api_version": {
            "type": "string",
            "enum": [
              "1"
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/PublicJob"
              }
            }
          }
        }
      },
      "PublicEventPaymentCreated": {
        "type": "object",
        "x-nf-event": "payment.created",
        "required": [
          "id",
          "type",
          "created_at",
          "api_version",
          "data"
        ],
        "description": "A payment was recorded on an invoice.",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "examples": [
              "evt_81234"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "payment.created"
            ]
          },
          "created_at": {
            "$ref": "#/components/schemas/DateTime"
          },
          "api_version": {
            "type": "string",
            "enum": [
              "1"
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/PublicPayment"
              }
            }
          }
        }
      },
      "PublicEventPaymentRefunded": {
        "type": "object",
        "x-nf-event": "payment.refunded",
        "required": [
          "id",
          "type",
          "created_at",
          "api_version",
          "data"
        ],
        "description": "Money of a payment went back.",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "examples": [
              "evt_81234"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "payment.refunded"
            ]
          },
          "created_at": {
            "$ref": "#/components/schemas/DateTime"
          },
          "api_version": {
            "type": "string",
            "enum": [
              "1"
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/PublicPayment"
              }
            }
          }
        }
      },
      "PublicEventWebhookTest": {
        "type": "object",
        "x-nf-event": "webhook.test",
        "required": [
          "id",
          "type",
          "created_at",
          "api_version",
          "data"
        ],
        "description": "A test send of POST /webhooks/{webhook_id}/test: never subscribed, sent to that one webhook. Its object is the webhook's own record with `url` always null: an event is kept 30 days, and the address is not kept in clear with it.",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "examples": [
              "evt_81234"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "webhook.test"
            ]
          },
          "created_at": {
            "$ref": "#/components/schemas/DateTime"
          },
          "api_version": {
            "type": "string",
            "enum": [
              "1"
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/PublicWebhook"
              }
            }
          }
        }
      },
      "PublicInvoice": {
        "type": "object",
        "required": [
          "id",
          "number",
          "status",
          "client_id",
          "job_id",
          "estimate_id",
          "total_cents",
          "paid_cents",
          "balance_cents",
          "currency",
          "invoice_date",
          "due_date",
          "sent_at",
          "paid_at",
          "created_at",
          "updated_at",
          "url"
        ],
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "description": "An opaque string, at most 64 characters.",
            "examples": [
              "inv_3305"
            ]
          },
          "number": {
            "type": "string",
            "description": "The invoice number the company sees."
          },
          "status": {
            "type": "string",
            "x-extensible-enum": [
              "draft",
              "sent",
              "viewed",
              "partial",
              "paid",
              "overdue",
              "canceled"
            ],
            "description": "As the app shows it; overdue on the company's day. More values may come."
          },
          "client_id": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64
          },
          "job_id": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64
          },
          "estimate_id": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The estimate the invoice was made from."
          },
          "total_cents": {
            "type": "integer"
          },
          "paid_cents": {
            "type": "integer"
          },
          "balance_cents": {
            "type": "integer",
            "description": "What is still due."
          },
          "currency": {
            "$ref": "#/components/schemas/Currency"
          },
          "invoice_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "due_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "The day the invoice is due. An invoice due on receipt holds its invoice_date here; `status` says when it is overdue (the app's rule: after the due day, or two weeks after an invoice due on receipt went out)."
          },
          "sent_at": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DateTime"
              },
              {
                "type": "null"
              }
            ]
          },
          "paid_at": {
            "description": "When the invoice became paid; null while its status is not paid.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/DateTime"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DateTime"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DateTime"
              },
              {
                "type": "null"
              }
            ]
          },
          "url": {
            "type": "string",
            "description": "The invoice's page in the web CRM."
          }
        }
      },
      "PublicInvoiceListResponse": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/PublicInvoice"
            }
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "PublicInvoiceResponse": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/PublicInvoice"
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "PublicJob": {
        "type": "object",
        "required": [
          "id",
          "number",
          "stage",
          "status",
          "custom_status",
          "created_at",
          "updated_at",
          "completed_at",
          "canceled_at",
          "start_local",
          "end_local",
          "timezone",
          "start",
          "end",
          "service",
          "description",
          "address",
          "lead_source",
          "source",
          "client",
          "technicians",
          "url"
        ],
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "description": "An opaque string, at most 64 characters.",
            "examples": [
              "job_48213"
            ]
          },
          "number": {
            "type": "string",
            "description": "The job number the company sees."
          },
          "stage": {
            "type": "string",
            "x-extensible-enum": [
              "open",
              "done",
              "canceled"
            ],
            "description": "Where the job stands, the stable field to branch on. A job marked spam answers canceled."
          },
          "status": {
            "type": "string",
            "x-extensible-enum": [
              "new",
              "confirmed",
              "rescheduled",
              "in_progress",
              "completed",
              "canceled",
              "warranty_callback",
              "important_message",
              "spam"
            ],
            "description": "The built-in status. `spam` only for a job read by its id after it was marked spam (no list holds it). More values may come; accept values you do not know and branch on `stage`."
          },
          "custom_status": {
            "description": "The company's own status of the job, when it has one of the job's stage now; else null.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/PublicJobCustomStatus"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DateTime"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DateTime"
              },
              {
                "type": "null"
              }
            ]
          },
          "completed_at": {
            "description": "When the job last became done, while it is done (`stage` done); null otherwise, and null once it is opened again. The time of the job's own history entry of that change, the one `job.completed` is raised by. Null too for a job done before Nexfield kept that history (November 2026), which has no reliable time.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/DateTime"
              },
              {
                "type": "null"
              }
            ]
          },
          "canceled_at": {
            "description": "When the job last became canceled (or was marked spam), while it is canceled; null otherwise, and null once it is opened again. From the job's history as `completed_at`; null for a job canceled before that history was kept.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/DateTime"
              },
              {
                "type": "null"
              }
            ]
          },
          "start_local": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}$",
            "description": "The start on the company's wall clock in `timezone`; null for a job with no time yet."
          },
          "end_local": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}$"
          },
          "timezone": {
            "type": "string"
          },
          "start": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DateTime"
              },
              {
                "type": "null"
              }
            ]
          },
          "end": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DateTime"
              },
              {
                "type": "null"
              }
            ]
          },
          "service": {
            "type": [
              "string",
              "null"
            ],
            "description": "What the job is, in a few words; for a job without a service of its own, the appliance on file; else null."
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "What the client needs. Never the same words as `service`."
          },
          "address": {
            "type": [
              "string",
              "null"
            ],
            "description": "Where the job is (its own address, else its client's)."
          },
          "lead_source": {
            "type": [
              "string",
              "null"
            ],
            "description": "Where the job came from, as POST /jobs sent it (\"Website form\"); else null. The same as `source.lead_source`."
          },
          "source": {
            "description": "Where the job's client came from: how the job was made (`kind`), and for an online booking the visit's attribution, for an AI call the line. It is what the job was made with and does not change after.",
            "$ref": "#/components/schemas/PublicSource"
          },
          "client": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PublicJobClient"
              },
              {
                "type": "null"
              }
            ]
          },
          "technicians": {
            "type": "array",
            "description": "The job's team; the first is the job's technician, the others work with them. Empty when nobody is on the job.",
            "items": {
              "$ref": "#/components/schemas/PublicJobTechnician"
            }
          },
          "url": {
            "type": "string",
            "description": "The job's page in the web CRM."
          }
        }
      },
      "PublicJobClient": {
        "type": "object",
        "required": [
          "id",
          "name",
          "phone",
          "phone_display",
          "email"
        ],
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "examples": [
              "cli_1042"
            ]
          },
          "name": {
            "type": "string"
          },
          "phone": {
            "type": [
              "string",
              "null"
            ],
            "description": "E.164 (+17145550123), or null."
          },
          "phone_display": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "PublicJobCreateResponse": {
        "description": "The job (a key with jobs:read and clients:read) or the confirmation of a booking (a key without them).",
        "anyOf": [
          {
            "$ref": "#/components/schemas/PublicJobResponse"
          },
          {
            "$ref": "#/components/schemas/PublicBookingResponse"
          }
        ]
      },
      "PublicJobCustomStatus": {
        "type": "object",
        "required": [
          "id",
          "name"
        ],
        "description": "A status the company made itself.",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "examples": [
              "jst_7"
            ]
          },
          "name": {
            "type": "string"
          }
        }
      },
      "PublicJobInput": {
        "type": "object",
        "x-nf-read-scopes": [
          "jobs:read",
          "clients:read"
        ],
        "additionalProperties": false,
        "description": "The client is `client_id`, or `client_name` and `client_phone` (never both: 422 on `client_id`). Without `start` the job waits for a date (a lead from a form), and `duration_minutes` is then refused.",
        "oneOf": [
          {
            "required": [
              "client_id"
            ]
          },
          {
            "required": [
              "client_name",
              "client_phone"
            ]
          }
        ],
        "dependentRequired": {
          "duration_minutes": [
            "start"
          ]
        },
        "properties": {
          "client_id": {
            "type": "string",
            "maxLength": 64,
            "description": "The id of a client of the company (422 on `client_id` when there is none). With it, send no client_name, client_phone or client_email."
          },
          "client_name": {
            "type": "string",
            "maxLength": 100
          },
          "client_phone": {
            "type": "string",
            "maxLength": 32,
            "description": "Finds the company's client with this number, else a new client is added."
          },
          "client_email": {
            "type": "string",
            "maxLength": 100,
            "description": "Kept on the job. A client on file keeps its saved emails."
          },
          "address": {
            "type": "string",
            "maxLength": 255
          },
          "start": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}$",
            "description": "The company's wall clock in its zone, \"2026-12-01 09:30\"; from a year ago to five years ahead (else 422 on `start`). A time the clocks skip answers 422 on `start`; a time they repeat is its first occurrence. Not sent: a job with no time yet."
          },
          "duration_minutes": {
            "type": "integer",
            "minimum": 15,
            "maximum": 1440,
            "default": 60,
            "description": "Only with `start`. A whole number typed as text (\"90\") is taken too."
          },
          "service": {
            "type": "string",
            "maxLength": 100
          },
          "description": {
            "type": "string",
            "maxLength": 4000
          },
          "lead_source": {
            "type": "string",
            "maxLength": 60,
            "description": "Where the job came from (\"Website form\"). It is kept on the job and shown in its origin."
          }
        }
      },
      "PublicJobListResponse": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/PublicJob"
            }
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "PublicJobNote": {
        "type": "object",
        "required": [
          "job_id",
          "text",
          "created_at"
        ],
        "description": "The note as it was added. A note has no id and no author; it is a paragraph of the job's team note.",
        "properties": {
          "job_id": {
            "type": "string",
            "maxLength": 64,
            "examples": [
              "job_48213"
            ]
          },
          "text": {
            "type": "string"
          },
          "created_at": {
            "$ref": "#/components/schemas/DateTime"
          }
        }
      },
      "PublicJobNoteInput": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "text"
        ],
        "properties": {
          "text": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000
          }
        }
      },
      "PublicJobNoteResponse": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/PublicJobNote"
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "PublicJobPatch": {
        "type": "object",
        "additionalProperties": false,
        "description": "Only the fields to change. A field not sent stays; an empty string also stays; null clears a field that may be empty (`start`, `service`, `description`, `address`).",
        "properties": {
          "start": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}$",
            "description": "The company's wall clock, as in PublicJobInput. Without `duration_minutes` the job keeps its own length (60 minutes when it had none). Null takes the time off (then `duration_minutes` is refused)."
          },
          "duration_minutes": {
            "type": "integer",
            "minimum": 15,
            "maximum": 1440,
            "description": "Alone it keeps the start and moves the end (422 for a job with no start). A whole number typed as text is taken too."
          },
          "status": {
            "type": "string",
            "enum": [
              "confirmed",
              "completed",
              "canceled"
            ],
            "description": "The statuses the API sets (not every status there is)."
          },
          "service": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 100
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 4000
          },
          "address": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 255,
            "description": "The job's own address (the client's saved addresses are not changed). Null puts the job back at its client's address."
          },
          "technician_ids": {
            "type": "array",
            "maxItems": 10,
            "uniqueItems": true,
            "description": "The whole team after the change: the first is the job's technician, the others its helpers (more than one only where the company has helpers on, else 422). An empty list takes everybody off.",
            "items": {
              "type": "string",
              "maxLength": 64,
              "examples": [
                "tech_12"
              ]
            }
          }
        }
      },
      "PublicJobResponse": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/PublicJob"
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "PublicJobTechnician": {
        "type": "object",
        "required": [
          "id",
          "name"
        ],
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "examples": [
              "tech_12"
            ]
          },
          "name": {
            "type": "string"
          }
        }
      },
      "PublicLine": {
        "type": "object",
        "required": [
          "name",
          "number"
        ],
        "description": "One of the company's own phone lines.",
        "properties": {
          "name": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 100,
            "description": "The line's name in Nexfield (\"Austin office\"), as it is now; null when it has none."
          },
          "number": {
            "type": [
              "string",
              "null"
            ],
            "description": "The line's number in E.164 (+15125550142); null when unknown."
          }
        }
      },
      "PublicMe": {
        "type": "object",
        "required": [
          "company_id",
          "company_name",
          "email",
          "timezone",
          "currency"
        ],
        "properties": {
          "company_id": {
            "type": "string",
            "maxLength": 64,
            "description": "The company's id, an opaque string.",
            "examples": [
              "co_1042"
            ]
          },
          "company_name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "description": "The owner's email."
          },
          "timezone": {
            "type": "string",
            "description": "The company's IANA zone (America/Los_Angeles), the zone of every job's start_local."
          },
          "currency": {
            "$ref": "#/components/schemas/Currency"
          }
        }
      },
      "PublicMeResponse": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/PublicMe"
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "PublicPayment": {
        "type": "object",
        "required": [
          "id",
          "invoice_id",
          "client_id",
          "job_id",
          "kind",
          "method",
          "status",
          "amount_cents",
          "refunded_cents",
          "currency",
          "created_at",
          "updated_at"
        ],
        "description": "A payment recorded on an invoice, as the invoice lists it.",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "description": "An opaque string, at most 64 characters.",
            "examples": [
              "pay_20417"
            ]
          },
          "invoice_id": {
            "type": "string",
            "maxLength": 64
          },
          "client_id": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64
          },
          "job_id": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64
          },
          "kind": {
            "type": "string",
            "x-extensible-enum": [
              "payment",
              "deposit",
              "tip"
            ]
          },
          "method": {
            "type": "string",
            "x-extensible-enum": [
              "card",
              "tap_to_pay",
              "stripe",
              "square",
              "card_manual",
              "cash",
              "check",
              "zelle",
              "venmo",
              "wallet",
              "external",
              "other"
            ],
            "description": "How it was paid. More values may come; accept values you do not know."
          },
          "status": {
            "type": "string",
            "x-extensible-enum": [
              "succeeded",
              "voided",
              "returned",
              "partially_refunded",
              "refunded"
            ],
            "description": "voided (recorded by mistake and taken back), returned (a deposit given back), refunded in part or whole, else succeeded."
          },
          "amount_cents": {
            "type": "integer",
            "minimum": 0
          },
          "refunded_cents": {
            "type": "integer",
            "minimum": 0,
            "description": "What went back of it."
          },
          "currency": {
            "$ref": "#/components/schemas/Currency"
          },
          "created_at": {
            "description": "When the payment was recorded.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/DateTime"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "description": "When the payment or its invoice last changed (a void or a refund always changes the invoice): never earlier than the payment's own last change, sometimes later.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/DateTime"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "PublicPaymentListResponse": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/PublicPayment"
            }
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "PublicPaymentResponse": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/PublicPayment"
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "PublicService": {
        "type": "object",
        "required": [
          "id",
          "name",
          "duration_minutes",
          "price_from_cents",
          "price_to_cents",
          "currency",
          "price_label",
          "description"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "The service's id for GET /availability (its name in lower-case words joined by -); it changes when the service is renamed."
          },
          "name": {
            "type": "string"
          },
          "duration_minutes": {
            "type": "integer",
            "minimum": 1
          },
          "price_from_cents": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The booking's service fee in cents (8900), when the booking page shows a price; else null."
          },
          "price_to_cents": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The same as price_from_cents today (one service fee)."
          },
          "currency": {
            "$ref": "#/components/schemas/Currency"
          },
          "price_label": {
            "type": [
              "string",
              "null"
            ],
            "description": "The booking page's words for the price (\"Service Call\")."
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "PublicServiceListResponse": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicService"
            }
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "PublicSlot": {
        "type": "object",
        "required": [
          "start_local",
          "end_local",
          "timezone",
          "start",
          "end",
          "slot_token"
        ],
        "properties": {
          "start_local": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}$",
            "description": "The start on the company's wall clock in `timezone`."
          },
          "end_local": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}$"
          },
          "timezone": {
            "type": "string"
          },
          "start": {
            "$ref": "#/components/schemas/DateTime"
          },
          "end": {
            "$ref": "#/components/schemas/DateTime"
          },
          "slot_token": {
            "type": "string",
            "maxLength": 600,
            "description": "Opaque and signed; send it as it is to POST /jobs within 30 minutes."
          }
        }
      },
      "PublicSource": {
        "type": "object",
        "required": [
          "kind",
          "channel",
          "utm",
          "click",
          "landing_page",
          "referrer_host",
          "line",
          "lead_source"
        ],
        "description": "Where a client came from, read only, on every job and every client; each part null when unknown, the objects always present. The same facts the owner sees on a job in the app and on the web. A key with `jobs:read` (a job's) or `clients:read` (a client's) reads it: keys are made by the owner.",
        "properties": {
          "kind": {
            "type": [
              "string",
              "null"
            ],
            "x-extensible-enum": [
              "ai_call",
              "booking",
              "thumbtack",
              "google",
              "manual",
              "api",
              "import",
              "other"
            ],
            "description": "ai_call (the AI receptionist), booking (the online booking page or the website widget), thumbtack, google (Reserve with Google), manual (added in Nexfield by the owner, the office or a technician), api (made through this API, a booking with `slot_token` too), import (Housecall Pro), other (a way in this list does not name yet, a service plan's visit); null when nothing is on file (an old record). Accept values you do not know."
          },
          "channel": {
            "type": [
              "string",
              "null"
            ],
            "description": "For an online booking, the channel Nexfield counted the visit under, as in its booking analytics (paid_search, organic_search, paid_social, email, campaign, referral, direct, ...); else null."
          },
          "utm": {
            "$ref": "#/components/schemas/PublicSourceUtm"
          },
          "click": {
            "$ref": "#/components/schemas/PublicSourceClick"
          },
          "landing_page": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 500,
            "description": "The page of the company's own website the booking started on (the widget's page), without its query string; null for a booking on Nexfield's own booking page."
          },
          "referrer_host": {
            "type": [
              "string",
              "null"
            ],
            "description": "The site the visitor came from (\"google.com\"), without \"www.\"; null when none was sent."
          },
          "line": {
            "description": "For an AI call, the company's line the client called (its parts null otherwise).",
            "$ref": "#/components/schemas/PublicLine"
          },
          "lead_source": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 60,
            "description": "The lead source POST /jobs was sent (\"Website form\"); null for any other job."
          }
        }
      },
      "PublicSourceClick": {
        "type": "object",
        "required": [
          "type",
          "param",
          "id"
        ],
        "description": "The ad click the visit came from, the company's own data: what Google Ads and Meta take for an offline conversion. All three null without one.",
        "properties": {
          "type": {
            "type": [
              "string",
              "null"
            ],
            "x-extensible-enum": [
              "google_ads",
              "meta",
              "other"
            ],
            "description": "google_ads (gclid, gbraid, wbraid), meta (fbclid), other (msclkid, ttclid). Accept values you do not know."
          },
          "param": {
            "type": [
              "string",
              "null"
            ],
            "x-extensible-enum": [
              "gclid",
              "gbraid",
              "wbraid",
              "fbclid",
              "msclkid",
              "ttclid"
            ],
            "description": "The parameter the id came in. Google Ads takes gclid, gbraid and wbraid in fields of their own, so send the id in the field this names."
          },
          "id": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 255,
            "description": "The click id as it came; null when it had characters no ad platform uses."
          }
        }
      },
      "PublicSourceUtm": {
        "type": "object",
        "required": [
          "source",
          "medium",
          "campaign",
          "term",
          "content"
        ],
        "description": "The campaign tags (utm_*) the visit came with, each at most 150 characters; null when absent.",
        "properties": {
          "source": {
            "type": [
              "string",
              "null"
            ]
          },
          "medium": {
            "type": [
              "string",
              "null"
            ]
          },
          "campaign": {
            "type": [
              "string",
              "null"
            ]
          },
          "term": {
            "type": [
              "string",
              "null"
            ]
          },
          "content": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "PublicTechnician": {
        "type": "object",
        "required": [
          "id",
          "name",
          "phone",
          "phone_display",
          "email",
          "active",
          "created_at",
          "updated_at"
        ],
        "description": "What a schedule or a report needs to name the person; nothing of pay, permissions or sign-in.",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "description": "An opaque string, at most 64 characters.",
            "examples": [
              "tech_12"
            ]
          },
          "name": {
            "type": "string",
            "description": "First and last name."
          },
          "phone": {
            "type": [
              "string",
              "null"
            ],
            "description": "E.164 (+17145550123), or null."
          },
          "phone_display": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "active": {
            "type": "boolean",
            "description": "False for a technician who was turned off; the list holds those too."
          },
          "created_at": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DateTime"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "description": "When the technician last changed; its created_at until its first change.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/DateTime"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "PublicTechnicianListResponse": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/PublicTechnician"
            }
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "PublicTechnicianResponse": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/PublicTechnician"
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "PublicWebhook": {
        "type": "object",
        "required": [
          "id",
          "url",
          "events",
          "description",
          "enabled",
          "disabled_reason",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "description": "An opaque string, at most 64 characters.",
            "examples": [
              "wh_42"
            ]
          },
          "url": {
            "type": [
              "string",
              "null"
            ],
            "description": "The https address the events are POSTed to. Null when Nexfield cannot read the address it keeps (it is kept encrypted), and always in the object of a `webhook.test` event."
          },
          "events": {
            "type": "array",
            "description": "The event types the webhook takes, or `*` alone for every type (for a key's webhook, every type the key may read every record of).",
            "items": {
              "type": "string",
              "x-extensible-enum": [
                "client.created",
                "client.updated",
                "job.created",
                "job.updated",
                "job.scheduled",
                "job.started",
                "job.completed",
                "job.canceled",
                "call.finished",
                "estimate.created",
                "estimate.sent",
                "estimate.approved",
                "estimate.declined",
                "invoice.created",
                "invoice.sent",
                "invoice.paid",
                "payment.created",
                "payment.refunded",
                "*"
              ]
            }
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "enabled": {
            "type": "boolean",
            "description": "False while the webhook is off; nothing is sent to it then."
          },
          "disabled_reason": {
            "type": [
              "string",
              "null"
            ],
            "x-extensible-enum": [
              "user",
              "gone",
              "failing"
            ],
            "description": "Why it is off, null while it is on. user (turned off by its owner, PATCH `enabled` false), gone (the address answered 410), failing (three days without one accepted delivery)."
          },
          "created_at": {
            "$ref": "#/components/schemas/DateTime"
          },
          "updated_at": {
            "$ref": "#/components/schemas/DateTime"
          }
        }
      },
      "PublicWebhookEventName": {
        "type": "string",
        "description": "An event type a webhook may take (input; the list is closed here), or `*` for every type.",
        "enum": [
          "client.created",
          "client.updated",
          "job.created",
          "job.updated",
          "job.scheduled",
          "job.started",
          "job.completed",
          "job.canceled",
          "call.finished",
          "estimate.created",
          "estimate.sent",
          "estimate.approved",
          "estimate.declined",
          "invoice.created",
          "invoice.sent",
          "invoice.paid",
          "payment.created",
          "payment.refunded",
          "*"
        ]
      },
      "PublicWebhookInput": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "url",
          "events"
        ],
        "properties": {
          "url": {
            "type": "string",
            "maxLength": 500,
            "description": "An https address of the receiver's own server, by host name: port 443 (or none named), no IP address, no user or password, no `#` part, no space, never a Nexfield host. Else 422 on `url`."
          },
          "events": {
            "type": "array",
            "minItems": 1,
            "description": "Event types, or `[\"*\"]` alone for every type (for this key, every type it may read). Naming a type needs the read scope of every record its event holds (a job event `jobs:read` and `clients:read`, `call.finished` `calls:read`, `clients:read` and `jobs:read`).",
            "items": {
              "$ref": "#/components/schemas/PublicWebhookEventName"
            }
          },
          "description": {
            "type": "string",
            "maxLength": 200
          }
        }
      },
      "PublicWebhookListResponse": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/PublicWebhook"
            }
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "PublicWebhookPatch": {
        "type": "object",
        "additionalProperties": false,
        "description": "Only the fields to change. A field not sent stays; an empty string also stays; null clears `description`.",
        "properties": {
          "url": {
            "type": "string",
            "maxLength": 500,
            "description": "As in PublicWebhookInput. 422 on `url` when another webhook of this key already has the address."
          },
          "events": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/PublicWebhookEventName"
            }
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200
          },
          "enabled": {
            "type": "boolean",
            "description": "True turns the webhook on (its count of failing time starts over); false turns it off."
          }
        }
      },
      "PublicWebhookResponse": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/PublicWebhook"
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "PublicWebhookSecretResponse": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/PublicWebhookWithSecret"
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "PublicWebhookTest": {
        "type": "object",
        "required": [
          "delivered",
          "status",
          "event_id"
        ],
        "properties": {
          "delivered": {
            "type": "boolean",
            "description": "True when the address answered 2xx."
          },
          "status": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The HTTP status the address answered; null when no answer came (or the address was refused or has no host now)."
          },
          "event_id": {
            "type": "string",
            "maxLength": 64,
            "description": "The id of the `webhook.test` event that was sent (its `webhook-id`).",
            "examples": [
              "evt_81234"
            ]
          }
        }
      },
      "PublicWebhookTestResponse": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/PublicWebhookTest"
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "PublicWebhookWithSecret": {
        "type": "object",
        "required": [
          "id",
          "url",
          "events",
          "description",
          "enabled",
          "disabled_reason",
          "created_at",
          "updated_at",
          "secret"
        ],
        "description": "A webhook (PublicWebhook) in the answer that makes it or rotates its secret, with the secret.",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "examples": [
              "wh_42"
            ]
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "x-extensible-enum": [
                "client.created",
                "client.updated",
                "job.created",
                "job.updated",
                "job.scheduled",
                "job.started",
                "job.completed",
                "job.canceled",
                "call.finished",
                "estimate.created",
                "estimate.sent",
                "estimate.approved",
                "estimate.declined",
                "invoice.created",
                "invoice.sent",
                "invoice.paid",
                "payment.created",
                "payment.refunded",
                "*"
              ]
            }
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "enabled": {
            "type": "boolean"
          },
          "disabled_reason": {
            "type": [
              "string",
              "null"
            ],
            "x-extensible-enum": [
              "user",
              "gone",
              "failing"
            ]
          },
          "created_at": {
            "$ref": "#/components/schemas/DateTime"
          },
          "updated_at": {
            "$ref": "#/components/schemas/DateTime"
          },
          "secret": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^whsec_[A-Za-z0-9+/]{43}=$",
            "description": "The signing secret (Standard Webhooks: `whsec_` and the base64 of 32 random bytes), given once: in the answer that made the webhook (and a replay of that answer by its Idempotency-Key) and in the answer of a rotation. Null when POST /webhooks answers a webhook that was already there. Kept encrypted by Nexfield, never shown again."
          }
        }
      },
      "RequestId": {
        "type": "string",
        "pattern": "^[0-9a-f]{16}$"
      },
      "Token43": {
        "type": "string",
        "description": "32 random bytes, base64url without padding.",
        "pattern": "^[A-Za-z0-9_-]{43}$"
      }
    },
    "securitySchemes": {
      "companyKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "nfk_ API key",
        "description": "A company API key (`nfk_` and 36 letters and digits: 30 random, then a 6-character checksum) from Settings -> API. Only the routes of https://nexfield.pro/api/v1 take it. A key has scopes (calls:read jobs:read jobs:write clients:read clients:write technicians:read estimates:read invoices:read payments:read webhooks:write services:read availability:read; `*` is all of them and those added later, `*:read` every scope that ends in `:read`). Settings makes three kinds: Full access (`*`), Read only (`*:read`) and Website booking (`services:read availability:read jobs:write`). Each key may make 120 requests a minute, and all keys of one company 300 a minute together (then 429). Refused keys (none, unknown, revoked) count per client address, 600 a minute (then 429); a live key never counts there. A key ends when it is revoked or its lifetime ends, and every key of the company ends when the owner's password is changed or reset or the owner signs out everywhere else; the webhooks a key made end with it. A key that tries what it may not more than 200 times in 10 minutes (a 403 `scope_missing` or `ip_not_allowed`; no other refusal counts) is suspended (403 forbidden, `current.reason` `key_suspended`) until the owner resumes or revokes it in Settings -> API. A daily limit suspends no key."
      }
    }
  }
}
