{
  "openapi": "3.1.0",
  "info": {
    "title": "Chalk CRM API",
    "version": "1",
    "description": "Every command a Custom API key (`chk_live_...`) may call, with the permission it needs. The same commands the Chalk app runs: same records, same rules, same quiet hours. Queued sends (quotes, invoices, reminders) wait for the shop's texting hours; a reply through `POST /api/messages/send` goes at once, as one typed in the app does.\n\n**Keys.** An owner or admin makes a key in Settings, Connectors, Custom API (also under Settings, ChalkBot). AI plan only. Send it as `Authorization: Bearer chk_live_...`.\n\n**Who a key is.** A key acts as the person who made it, or as a lower role they picked, and never reaches past what that person can do today: a demotion shrinks the key with them. `GET /api/users/me` says who the key acts as, its areas and its end date.\n\n**Permissions.** A key holds one level per area (none, read or write) and one switch, Can message customers. Each operation's `security` names what it needs as `area:kind`:\n- `area:read`: that area at read or write.\n- `area:write`: that area at write.\n- `area:send`: that area at write and Can message customers.\n- `payments_money:money`: Payments and money at write (charges, refunds, saved cards, write-offs, payouts).\n- `crew_pay:read` and `crew_pay:write`: Crew pay at that level. A few pay commands list it as a second way in: reading pay, and adding, changing, removing, archiving or restoring a split that is owed and was added by hand. It never marks pay paid, holds it, overrides it or touches a paid row, and it moves no money. Read `GET /api/payouts?job_id=` before adding pay by hand: Chalk posts crew pay from the quote's lines by itself (`source_key` `measurement:` and the person's id).\n\nKeys made before areas existed keep their old `read`, `write`, `send` and `files` scopes and reach exactly what they reached before, until an owner or admin edits them. With `write` they also add and change owed pay through the Crew pay commands, with the same checks.\n\n**Idempotency-Key.** Any write (POST, PUT, PATCH, DELETE) may send an `Idempotency-Key` header. A repeat with the same key and the same body within 8 days gets the first answer back without the work being done again.\n\n**Pace.** 240 calls a minute per key. Over that is a 429 with `Retry-After`.\n\n**History.** A change made with a key shows in Settings, History as the person \"via API key\" with the key's name. Each key's last calls (method, path, status, time) are in Settings, Connectors, Custom API.\n\n**Never for keys.** These stay with a person who is signed in, whatever the key holds, and are not in this spec:\n- Signing in, sessions, devices and PINs\n- Home's day strip (a key reads the day with GET /api/schedule)\n- Home's own half-minute change check for an open page\n- The lines in Home's number cards (a key reads the figures from GET /api/dashboard)\n- Home's Do next list and each person's snoozes, kept for the person on screen\n- The Finish sheet's starting time for Finished at (a key finishes with POST complete and finished_at)\n- Checking a customer's bank payment with Stripe (the owner, in Chalk)\n- Marking a customer's bank payment as did not go through (the owner, in Chalk)\n- The quote editor's Discard this draft, for the draft it made a moment ago (a key deletes with DELETE /api/quotes/:id)\n- Sign-up, invites and password links\n- Paying Chalk\n- Chalk staff only\n- Making, changing and revoking API keys\n- Closing the account\n- Reopening an account the owner closed\n- Imports\n- Restoring a backup\n- Backups and the whole-account export\n- Pictures from photo links in notes, for the app's own pages (a key reads the note and can fetch the address itself)\n- Storage and the photos and files download (the owner or an admin, in Chalk)\n- Setting up a new account\n- Bulk fixes to saved records (the owner or an admin, in Chalk)\n- A town found by looking up the street, confirmed by a person in Chalk\n- The \"Chalk was updated\" bar, shown once to a person signed in to Chalk\n- Connecting Stripe, QuickBooks, the text number and email (secrets)\n- Crash reports from the app in a browser\n- Paying Chalk for texts\n- Sending a text during quiet hours is a person's call, in Chalk\n- Collect cash and checks from a quote or job, signed in (a key writes hand payments with POST /api/payments)\n- Seeing the app as somebody else is a signed-in session\n- A person's own pay and hours are for that person, signed in\n- Saying when your own forgotten clock stopped is the person, signed in\n- Approving when somebody's forgotten clock stopped is a person's call, signed in (a key reads the asks)\n- Payday (everybody marked paid at once) is the owner or an admin, signed in (a key marks one person with POST /api/payouts/pay-all)\n- The check screen before Send reminders, signed in (a key sends with POST /api/invoices/remind)\n- A customer's call transcripts and whole conversation, signed in\n- Making a login (its password comes back)\n- Invites carry a sign-in link\n- Password resets carry a sign-in link\n- A calendar feed link outlives the key\n- A push address would keep getting the maker's alerts after the key is revoked\n- Asking ChalkBot, approving for it, its leash and its wallet\n- Public webhook\n- Public page\n- The website estimator's own key\n- Changing stock, items, places and tools (in Chalk, for now)\n- Stock on a job (in Chalk, for now)\n- The stock version on a line's material (in Chalk, for now)\n\nPlain-words guide with examples: https://www.chalkcrm.com/dev",
    "contact": {
      "email": "info@chalkcrm.com"
    }
  },
  "externalDocs": {
    "description": "The developer page",
    "url": "https://www.chalkcrm.com/dev"
  },
  "servers": [
    {
      "url": "https://app.chalkcrm.com"
    }
  ],
  "security": [
    {
      "chalkKey": []
    }
  ],
  "tags": [
    {
      "name": "Key",
      "description": "Who the key acts as. Any key may call it."
    },
    {
      "name": "Clients",
      "description": "Customers, properties, notes, tags. Area `clients`."
    },
    {
      "name": "Sales",
      "description": "Requests, quotes, the funnel, the price book. Area `sales`."
    },
    {
      "name": "Schedule",
      "description": "Jobs, visits, checklists, timers. Area `schedule`."
    },
    {
      "name": "Invoices",
      "description": "Invoices, payments written down by hand, expenses. Area `invoices`."
    },
    {
      "name": "Payments and money",
      "description": "Card charges, refunds, saved cards, payouts, payroll, time cards. Area `payments_money`. Write here lets the key charge saved cards, give refunds and mark payouts paid."
    },
    {
      "name": "Messages",
      "description": "Text threads, the inbox, notifications. Area `messages`."
    },
    {
      "name": "Files",
      "description": "Photos and documents. Area `files`."
    },
    {
      "name": "Settings",
      "description": "Business settings, history, saved views, ChalkBot status. Area `settings`."
    },
    {
      "name": "Automations",
      "description": "Automatic texts and emails, tag rules. Area `automations`. With Can message customers, write here lets the key create, change and switch on automatic messages. Without it, the key can only pause every automation at once, or remove one."
    },
    {
      "name": "Team",
      "description": "Teammates, roles, what each role can reach, sign-ins. Area `team`. Write here lets the key invite and remove teammates, change role permissions and reset sign-ins. It can never touch an owner or admin."
    },
    {
      "name": "Reports",
      "description": "The Chalkboard, reports, the books, timesheets. Area `reports`."
    },
    {
      "name": "Inventory",
      "description": "Stock, versions, places, tools and equipment (read only for now). Area `inventory`."
    }
  ],
  "paths": {
    "/api/clients": {
      "get": {
        "operationId": "get_clients",
        "summary": "Clients: read",
        "description": "Optional `?q=` filters the book (name, company, email, phone digits, street). Omit `q` for the unfiltered list (capped). `?limit=` up to 500, `?tag=`, `?archived=1`.\n\n**Needs:** Clients at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/clients?q=harmon\n\n200\n[\n  {\n    \"id\": \"01M3JVF1K1XS5ZJKJG6RF2TBXE\",\n    \"first_name\": \"Dale\",\n    \"last_name\": \"Harmon\",\n    \"company_name\": null,\n    \"is_company\": 0,\n    \"is_lead\": 1,\n    \"lead_source\": null,\n    \"balance_cents\": 0,\n    ...\n  }\n]\n```",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "read",
          "scope": "clients:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#customers"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "post_clients",
        "summary": "Clients: create",
        "description": "Add a customer: `first_name` (or `company_name`), `last_name`, `phone`, `email`, and their first address as `property: { street1, city, province, postal_code }`. Answers `{ id, property_id }`, ready for a quote. With a key, any other field is a 400 that names it. Optional `line`: which of the business's Quo numbers texts them (its name, number or Quo id), else the number set on the key, else the main number. A line that is not theirs is never refused: it comes back in `warnings`.\n\n**Needs:** Clients at write.\n\n**Field limits (400 past them):** Names up to 200 characters, titles 300, notes, messages and instructions 20,000. Up to 20 emails (254 characters each) and 20 phones (40 each), sent as lists. Where they came from (100), the ad and campaign names (300) and the address parts are cut to fit, or left off when they are not text, and the answer's `warnings` says so: the customer is always saved.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#customers"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "first_name": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "last_name": {
                    "type": "string",
                    "maxLength": 200
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "first_name": "Old",
                "last_name": "Lead"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "property_id": {}
                  }
                },
                "example": {
                  "id": "01M3JVF2N07H3CTPDHMCMEJHPG",
                  "property_id": null
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/clients/lookup": {
      "get": {
        "operationId": "get_clients_lookup",
        "summary": "Clients: lookup",
        "description": "Query `q` (name, phone fragment, address). Examples: `?q=John` `?q=Ball` `?q=864`. Also still accepts `name` and `phone` for the in-app duplicate check. Returns `{ matches: [...] }`.\n\n**Needs:** Clients at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/clients/lookup?q=Harmon\n\n200\n{\n  \"matches\": [\n    {\n      \"id\": \"01M3JVF1K1XS5ZJKJG6RF2TBXE\",\n      \"name\": \"Dale Harmon\",\n      \"company_name\": null,\n      ...\n    },\n    ...\n  ]\n}\n```",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "read",
          "scope": "clients:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#customers"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/clients/bulk": {
      "post": {
        "operationId": "post_clients_bulk",
        "summary": "Clients: bulk",
        "description": "**Needs:** Clients at write.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/clients/{id}": {
      "get": {
        "operationId": "get_clients_by_id",
        "summary": "Clients: read one",
        "description": "One customer, with properties and recent work.\n\n**Needs:** Clients at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/clients/01M3JVF1K1XS5ZJKJG6RF2TBXE\n\n200\n{\n  \"client\": {\n    \"id\": \"01M3JVF1K1XS5ZJKJG6RF2TBXE\",\n    \"tenant_id\": \"ten_flow\",\n    \"first_name\": \"Dale\",\n    \"last_name\": \"Harmon\",\n    \"company_name\": null,\n    \"is_company\": 0,\n    \"is_lead\": 1,\n    ...\n  },\n  \"emails\": [\n    {\n      \"id\": \"01M3JVF1K11859HXQ44TEWA5Q5\",\n      \"tenant_id\": \"ten_flow\",\n      \"client_id\": \"01M3JVF1K1XS5ZJKJG6RF2TBXE\",\n      ...\n    },\n    ...\n  ],\n  \"phones\": [\n    {\n      \"id\": \"01M3JVF1K1Q0CSR7E9F1MQV9N1\",\n      \"tenant_id\": \"ten_flow\",\n      \"client_id\": \"01M3JVF1K1XS5ZJKJG6RF2TBXE\",\n      ...\n    },\n    ...\n  ],\n  \"properties\": [\n    {\n      \"id\": \"01M3JVF1K2NWZFDP2HE54E9D8J\",\n      \"tenant_id\": \"ten_flow\",\n      \"client_id\": \"01M3JVF1K1XS5ZJKJG6RF2TBXE\",\n      ...\n    },\n    ...\n  ],\n  \"archived_properties\": [],\n  \"requests\": [],\n  \"quotes\": [],\n  ...\n}\n```",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "read",
          "scope": "clients:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#customers"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "operationId": "patch_clients_by_id",
        "summary": "Clients: update",
        "description": "Update a name, notes, type or terms. `automations_paused_until` (a day, like `2026-11-05`) holds every automated text and email to them until that day, when they start again on their own; `\"\"` ends the pause, which needs the send permission like turning a reminder switch back on.\n\n**Needs:** Clients at write.\n\n**Field limits (400 past them):** Names up to 200 characters, titles 300, notes, messages and instructions 20,000. A customer keeps a first name or a company name.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#customers"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "company_name": {
                    "type": "string",
                    "maxLength": 200
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "company_name": "Harmon Rentals"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      },
      "delete": {
        "operationId": "delete_clients_by_id",
        "summary": "Clients: delete",
        "description": "**Needs:** Clients at write.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/clients/{id}/history": {
      "get": {
        "operationId": "get_clients_by_id_history",
        "summary": "Clients: history",
        "description": "**Needs:** Clients at read (or write).",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "read",
          "scope": "clients:read"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/clients/{id}/archive": {
      "post": {
        "operationId": "post_clients_by_id_archive",
        "summary": "Clients: archive",
        "description": "Put a customer away. Their history stays.\n\n**Needs:** Clients at write.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#customers"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/clients/{id}/unarchive": {
      "post": {
        "operationId": "post_clients_by_id_unarchive",
        "summary": "Clients: unarchive",
        "description": "Put them back.\n\n**Needs:** Clients at write.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#customers"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/clients/{id}/emails": {
      "post": {
        "operationId": "post_clients_by_id_emails",
        "summary": "Clients: emails",
        "description": "Add an email address: `address`.\n\n**Needs:** Clients at write.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#customers"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "address": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "address": "office@harmonrentals.example"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "01M3JVF1N27AFJFA6A0YVC6957"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/clients/{id}/emails/{emailId}": {
      "delete": {
        "operationId": "delete_clients_by_id_emails_by_emailId",
        "summary": "Clients: emails, delete",
        "description": "Take an address off.\n\n**Needs:** Clients at write.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#customers"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "emailId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/clients/{id}/emails/{emailId}/primary": {
      "post": {
        "operationId": "post_clients_by_id_emails_by_emailId_primary",
        "summary": "Clients: emails primary",
        "description": "**Needs:** Clients at write.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "emailId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/clients/{id}/phones": {
      "post": {
        "operationId": "post_clients_by_id_phones",
        "summary": "Clients: phones",
        "description": "Add a phone number: `number`, optional `label`.\n\n**Needs:** Clients at write.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#customers"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "number": {
                    "type": "string"
                  },
                  "label": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "number": "864-555-0120",
                "label": "Work"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "01M3JVF1N0GMJPB3HQ52MT475W"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/clients/{id}/phones/{phoneId}": {
      "delete": {
        "operationId": "delete_clients_by_id_phones_by_phoneId",
        "summary": "Clients: phones, delete",
        "description": "Take a number off.\n\n**Needs:** Clients at write.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#customers"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "phoneId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/clients/{id}/phones/{phoneId}/primary": {
      "post": {
        "operationId": "post_clients_by_id_phones_by_phoneId_primary",
        "summary": "Clients: phones primary",
        "description": "**Needs:** Clients at write.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "phoneId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/clients/{id}/phones/{phoneId}/resume-texts": {
      "post": {
        "operationId": "post_clients_by_id_phones_by_phoneId_resume_texts",
        "summary": "Clients: phones resume texts",
        "description": "**Needs:** Clients at write.\n\n**Limit for keys:** Only an owner or admin can turn texts back on for a customer.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "phoneId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/clients/{id}/phones/{phoneId}/texts": {
      "post": {
        "operationId": "post_clients_by_id_phones_by_phoneId_texts",
        "summary": "Clients: phones texts",
        "description": "Texts off for a number: `on` false. Every row of the shop's phone book with that number goes off, and nothing is texted to it until it is back on. Turning texts back on (`on` true, with `customer_asked` true) is the customer's consent, so only a person signed in can do it, never a key.\n\n**Needs:** Clients at write.\n\n**Limit for keys:** Only a person signed in can turn texts back on for a customer.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#customers"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "phoneId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "on": {
                    "type": "boolean"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "on": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "texts_on": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "texts_on": false
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/clients/{id}/phones/{phoneId}/wrong": {
      "post": {
        "operationId": "post_clients_by_id_phones_by_phoneId_wrong",
        "summary": "Clients: phones wrong",
        "description": "Mark a number wrong (`wrong` true) or right again (false). The number stays on file, marked for the next person. A call logged with the `wrong_number` outcome marks it too.\n\n**Needs:** Clients at write.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#customers"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "phoneId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "wrong": {
                    "type": "boolean"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "wrong": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "wrong": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "wrong": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/clients/{id}/portal-link": {
      "post": {
        "operationId": "post_clients_by_id_portal_link",
        "summary": "Clients: portal link",
        "description": "Hand them their portal without opening the app. Needs send: the link outlives the key.\n\n**Needs:** Clients at write, and Can message customers.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:send"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "send",
          "scope": "clients:send"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#customers"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "portal_url": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "portal_url": "https://app.chalkcrm.com/hub/01M3JVF1N5DQWVXTGYEF6VS5FK"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_send"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/clients/{id}/merge-preview": {
      "get": {
        "operationId": "get_clients_by_id_merge_preview",
        "summary": "Clients: merge preview",
        "description": "**Needs:** Clients at read (or write).",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "read",
          "scope": "clients:read"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/clients/{id}/details": {
      "get": {
        "operationId": "get_clients_by_id_details",
        "summary": "Clients: details",
        "description": "**Needs:** Clients at read (or write).",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "read",
          "scope": "clients:read"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/clients/{id}/merge": {
      "post": {
        "operationId": "post_clients_by_id_merge",
        "summary": "Clients: merge",
        "description": "**Needs:** Clients at write.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/clients/{id}/sms-line": {
      "put": {
        "operationId": "put_clients_by_id_sms_line",
        "summary": "Clients: sms line, set",
        "description": "Which of the business's Quo numbers texts this customer, for a business with more than one: `line` is the number's name, number or Quo id. Every text to them goes from it until it is changed again.\n\n**Needs:** Clients at write.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#customers"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "line": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "line": "Paint"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "sms_line": {
                      "type": "string"
                    },
                    "changed": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "sms_line": "PN2a8Kx01",
                  "changed": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/clients/{id}/timeline": {
      "get": {
        "operationId": "get_clients_by_id_timeline",
        "summary": "Clients: timeline",
        "description": "**Needs:** Clients at read (or write).\n\n**Limit for keys:** The client timeline is only available when signed in, not with an API key.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "read",
          "scope": "clients:read"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/properties": {
      "get": {
        "operationId": "get_properties",
        "summary": "Properties: read",
        "description": "Addresses on file for the shop.\n\n**Needs:** Clients at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/properties\n\n200\n[\n  {\n    \"id\": \"01M3JVF1K2NWZFDP2HE54E9D8J\",\n    \"tenant_id\": \"ten_flow\",\n    \"client_id\": \"01M3JVF1K1XS5ZJKJG6RF2TBXE\",\n    \"name\": null,\n    \"street1\": \"14 Pelham Rd\",\n    \"street2\": null,\n    \"city\": \"Greer\",\n    \"province\": \"SC\",\n    ...\n  },\n  ...\n]\n```",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "read",
          "scope": "clients:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#properties"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "post_properties",
        "summary": "Properties: create",
        "description": "Add a property to a customer: `client_id`, `street1`, `city`, `province`, `postal_code`.\n\n**Needs:** Clients at write.\n\n**Field limits (400 past them):** Street lines and names up to 200 characters, town and state 100, ZIP 40.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#properties"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string"
                  },
                  "street1": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "city": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "province": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "postal_code": {
                    "type": "string",
                    "maxLength": 40
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "client_id": "01M3JVF2N07H3CTPDHMCMEJHPG",
                "street1": "3 Old Rd",
                "city": "Greer",
                "province": "SC",
                "postal_code": "29650"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "01M3JVF2N94FESK489YH4S86H2"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/properties/place": {
      "get": {
        "operationId": "get_properties_place",
        "summary": "Properties: place",
        "description": "**Needs:** Clients at read (or write).",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "read",
          "scope": "clients:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/properties/suggest": {
      "get": {
        "operationId": "get_properties_suggest",
        "summary": "Properties: suggest",
        "description": "Address suggestions as you type: `?q=`.\n\n**Needs:** Clients at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/properties/suggest?q=14%20Pel\n\n200\n[\n  {\n    \"label\": \"14 Pel 99444-14, Duhok, Duhok 42001\",\n    \"street1\": \"14 Pel 99444-14\",\n    \"city\": \"Duhok\",\n    \"province\": \"Duhok\",\n    \"postal_code\": \"42001\",\n    \"lat\": null,\n    \"lng\": null\n  },\n  ...\n]\n```",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "read",
          "scope": "clients:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#properties"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/properties/{id}": {
      "patch": {
        "operationId": "patch_properties_by_id",
        "summary": "Properties: update",
        "description": "Fix an address, gate note or geo.\n\n**Needs:** Clients at write.\n\n**Field limits (400 past them):** Street lines and names up to 200 characters, town and state 100, ZIP 40.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#properties"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "gate_code": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "gate_code": "4411"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      },
      "delete": {
        "operationId": "delete_properties_by_id",
        "summary": "Properties: delete",
        "description": "Delete an address nothing hangs off. One with work on it archives instead.\n\n**Needs:** Clients at write.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#properties"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/properties/{id}/billing": {
      "post": {
        "operationId": "post_properties_by_id_billing",
        "summary": "Properties: billing",
        "description": "**Needs:** Clients at write.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/properties/{id}/archive": {
      "post": {
        "operationId": "post_properties_by_id_archive",
        "summary": "Properties: archive",
        "description": "Put an address away.\n\n**Needs:** Clients at write.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#properties"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/properties/{id}/unarchive": {
      "post": {
        "operationId": "post_properties_by_id_unarchive",
        "summary": "Properties: unarchive",
        "description": "Put it back.\n\n**Needs:** Clients at write.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#properties"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/client-types": {
      "get": {
        "operationId": "get_client_types",
        "summary": "Client types: read",
        "description": "Residential, commercial, and the rest of the labels.\n\n**Needs:** Clients at read (or write).",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "read",
          "scope": "clients:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array"
                },
                "example": []
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "post_client_types",
        "summary": "Client types: create",
        "description": "Add a label: `name`, optional `payment_terms_days`, deposit and terms. Owner or admin key.\n\n**Needs:** Clients at write.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "payment_terms_days": {
                    "type": "integer"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "name": "Property manager",
                "payment_terms_days": 30
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "01M3JVF2SN7PJXX8F6PYJP7QJ2"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/client-types/{id}": {
      "patch": {
        "operationId": "patch_client_types_by_id",
        "summary": "Client types: update",
        "description": "Change one. Owner or admin key.\n\n**Needs:** Clients at write.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "payment_terms_days": {
                    "type": "integer"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "payment_terms_days": 15
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      },
      "delete": {
        "operationId": "delete_client_types_by_id",
        "summary": "Client types: delete",
        "description": "**Needs:** Clients at write.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/tags": {
      "get": {
        "operationId": "get_tags",
        "summary": "Tags: read",
        "description": "Tags on customers and work.\n\n**Needs:** Clients at read (or write).",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "read",
          "scope": "clients:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array"
                },
                "example": []
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "post_tags",
        "summary": "Tags: create",
        "description": "Add a tag: `label`, optional `color`.\n\n**Needs:** Clients at write.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string"
                  },
                  "color": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "label": "Repeat customer",
                "color": "#2b8ba3"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "01M3JVF2S9NDVPTM0VYY7EFM7K"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/tags/assign": {
      "post": {
        "operationId": "post_tags_assign",
        "summary": "Tags: assign",
        "description": "Put a tag on something: `tag_id`, `entity_type`, `entity_id`.\n\n**Needs:** Clients at write.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "tag_id": {
                    "type": "string"
                  },
                  "entity_type": {
                    "type": "string"
                  },
                  "entity_id": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "tag_id": "01M3JVF2S9NDVPTM0VYY7EFM7K",
                "entity_type": "client",
                "entity_id": "01M3JVF1K1XS5ZJKJG6RF2TBXE"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/tags/{id}": {
      "delete": {
        "operationId": "delete_tags_by_id",
        "summary": "Tags: delete",
        "description": "**Needs:** Clients at write.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/notes/{entityType}/{entityId}": {
      "get": {
        "operationId": "get_notes_by_entityType_by_entityId",
        "summary": "Notes: read one",
        "description": "Notes on a job, quote, invoice or lead.\n\n**Needs:** Clients at read (or write).",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "read",
          "scope": "clients:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#notes"
        },
        "parameters": [
          {
            "name": "entityType",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entityId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array"
                },
                "example": []
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/notes/for-client/{clientId}": {
      "get": {
        "operationId": "get_notes_for_client_by_clientId",
        "summary": "Notes: for client, read one",
        "description": "Notes on a customer.\n\n**Needs:** Clients at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/notes/for-client/01M3JVF1K1XS5ZJKJG6RF2TBXE\n\n200\n[\n  {\n    \"id\": \"01M3JVF2K0ESQJZ6CTCVH0S0ZW\",\n    \"tenant_id\": \"ten_flow\",\n    \"entity_type\": \"client\",\n    \"entity_id\": \"01M3JVF1K1XS5ZJKJG6RF2TBXE\",\n    \"body\": \"Prefers texts after 5pm.\",\n    \"pinned\": 0,\n    \"created_by\": \"usr_owner\",\n    \"created_at\": \"2026-09-28T01:53:26.112Z\",\n    \"client_id\": \"01M3JVF1K1XS5ZJKJG6RF2TBXE\",\n    ...\n  }\n]\n```",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "read",
          "scope": "clients:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#notes"
        },
        "parameters": [
          {
            "name": "clientId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/notes": {
      "post": {
        "operationId": "post_notes",
        "summary": "Notes: create",
        "description": "Write a note on a customer, job or quote. Put the message in `body` (or `message`). Quote line descriptions stay on the quote.\n\n**Needs:** Clients at write.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#notes"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entity_type": {
                    "type": "string"
                  },
                  "entity_id": {
                    "type": "string"
                  },
                  "body": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "entity_type": "job",
                "entity_id": "01M3JVF2D4HZ9B61Q6VK4SG6SY",
                "body": "Wrong job"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "01M3JVF2S62VXCVVS4WW6ENHSB"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/notes/{id}": {
      "patch": {
        "operationId": "patch_notes_by_id",
        "summary": "Notes: update",
        "description": "Fix a note.\n\n**Needs:** Clients at write.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#notes"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "body": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "body": "Prefers texts after 5pm. Dog is friendly."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      },
      "delete": {
        "operationId": "delete_notes_by_id",
        "summary": "Notes: delete",
        "description": "Take a note off.\n\n**Needs:** Clients at write.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#notes"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/custom-fields": {
      "get": {
        "operationId": "get_custom_fields",
        "summary": "Custom fields: read",
        "description": "The shop's own fields on customers and work.\n\n**Needs:** Clients at read (or write).",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "read",
          "scope": "clients:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array"
                },
                "example": []
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "post_custom_fields",
        "summary": "Custom fields: create",
        "description": "Add a field: `entity_type`, `label`, `kind`. Owner or admin key.\n\n**Needs:** Settings at write.",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "write",
          "scope": "settings:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entity_type": {
                    "type": "string"
                  },
                  "label": {
                    "type": "string"
                  },
                  "kind": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "entity_type": "client",
                "label": "Gate code",
                "kind": "text"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "01M3JVF2SCNVQYFX8K9Z74D7RD"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/custom-fields/values/{entityType}/{entityId}": {
      "get": {
        "operationId": "get_custom_fields_values_by_entityType_by_entityId",
        "summary": "Custom fields: values, read one",
        "description": "One record's answers, by field id.\n\n**Needs:** Clients at read (or write).",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "read",
          "scope": "clients:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "parameters": [
          {
            "name": "entityType",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entityId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "01M3JVF2SCNVQYFX8K9Z74D7RD": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "01M3JVF2SCNVQYFX8K9Z74D7RD": "4411"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "put": {
        "operationId": "put_custom_fields_values_by_entityType_by_entityId",
        "summary": "Custom fields: values, set",
        "description": "Save answers: `{ \"field id\": \"value\" }`. Fields the shop never made are ignored.\n\n**Needs:** Clients at write.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "parameters": [
          {
            "name": "entityType",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entityId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "01M3JVF2SCNVQYFX8K9Z74D7RD": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "01M3JVF2SCNVQYFX8K9Z74D7RD": "4411"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/search": {
      "get": {
        "operationId": "get_search",
        "summary": "Search: read",
        "description": "Search customers, quotes, jobs and invoices: `?q=`.\n\n**Needs:** Clients at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/search?q=harmon\n\n200\n{\n  \"q\": \"harmon\",\n  \"kind\": null,\n  \"status\": null,\n  \"hits\": [\n    {\n      \"kind\": \"client\",\n      \"id\": \"01M3JVF1K1XS5ZJKJG6RF2TBXE\",\n      \"title\": \"Harmon Rentals\",\n      \"subtitle\": \"+18645550199 · 14 Pelham Rd, Greer\",\n      \"status\": null,\n      ...\n    },\n    ...\n  ]\n}\n```",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "read",
          "scope": "clients:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#board"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/dashboard/search": {
      "get": {
        "operationId": "get_dashboard_search",
        "summary": "Dashboard: search",
        "description": "The same hunt the header bar uses.\n\n**Needs:** Clients at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/dashboard/search?q=harmon\n\n200\n{\n  \"results\": [\n    {\n      \"id\": \"01M3JVF1K1XS5ZJKJG6RF2TBXE\",\n      \"title\": \"Dale Harmon\",\n      \"subtitle\": \"Harmon Rentals\",\n      \"type\": \"client\",\n      \"path\": \"/clients/01M3JVF1K1XS5ZJKJG6RF2TBXE\"\n    },\n    ...\n  ]\n}\n```",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "read",
          "scope": "clients:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#board"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/admin/geocode-missing": {
      "post": {
        "operationId": "post_admin_geocode_missing",
        "summary": "Admin: geocode missing",
        "description": "**Needs:** Clients at write.",
        "tags": [
          "Clients"
        ],
        "security": [
          {
            "chalkKey": [
              "clients:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "clients",
          "kind": "write",
          "scope": "clients:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_clients_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/requests": {
      "get": {
        "operationId": "get_requests",
        "summary": "Requests: read",
        "description": "Leads on the board. `?status=`, `?source=`, `?from=`/`?to=` (YYYY-MM-DD, the shop's own days in its time zone; `to` is the first day left out), `?archived=1`.\n\n**Needs:** Sales at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/requests\n\n200\n[\n  {\n    \"id\": \"01M3JVF27ZWWRNNSY20Y3G8DZX\",\n    \"tenant_id\": \"ten_flow\",\n    \"client_id\": \"01M3JVF1K1XS5ZJKJG6RF2TBXE\",\n    \"property_id\": \"01M3JVF27NYHM2G15CENR5J1SS\",\n    \"title\": \"Fence staining estimate\",\n    \"details\": \"About 200 ft of wood privacy fence, both sides.\",\n    \"source\": \"website\",\n    \"status\": \"new\",\n    ...\n  }\n]\n```",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "read",
          "scope": "sales:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#leads"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "post_requests",
        "summary": "Requests: create",
        "description": "File a new enquiry: `client_id`, optional `property_id`, `title`, `source`, `details`. From a Facebook lead form (Make, Zapier), also send what Meta hands over: `meta_lead_id` (Meta's lead id, 15 to 17 digits, as a string), and optionally `meta_form_id`, `meta_ad_id` (digits, as strings) and `meta_lead_created_at` (ISO 8601 or unix seconds). A malformed one never refuses the lead: it is saved without that field, and the answer carries a `warnings` list saying which and why. The lead ingest (`POST /api/ingest/lead`) takes the same four fields. They are what lets Meta Conversions tell Facebook how the lead got on; a lead with no Meta lead id is never sent. Optional `line`, as on `POST /api/clients`: it is set on the customer only when they have no number yet.\n\n**Needs:** Sales at write.\n\n**Field limits (400 past them):** Titles up to 300 characters, details 20,000, where it came from 100. Ids are text, as Chalk hands them back; a number where an id goes is refused. assessment_at and follow_up_at: Dates are real days from 2000 to ten years ahead.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#leads"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string",
                    "maxLength": 300
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "client_id": "01M3JVF2N07H3CTPDHMCMEJHPG",
                "title": "Porch, maybe"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "01M3JVF2NH3ZW4REBDWZG0H2X2"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/requests/marketing": {
      "get": {
        "operationId": "get_requests_marketing",
        "summary": "Requests: marketing",
        "description": "Where leads come from and how far they get: the funnel and each source.\n\n**Needs:** Sales at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/requests/marketing\n\n200\n{\n  \"funnel\": {\n    \"leads\": 3,\n    \"contacted\": 2,\n    \"quoted\": 2,\n    \"won\": 1,\n    \"lost\": 0\n  },\n  \"sources\": [\n    {\n      \"source\": \"website\",\n      \"leads\": 1,\n      \"won\": 1,\n      ...\n    },\n    ...\n  ],\n  \"weekly\": [\n    {\n      \"weeks_ago\": 7,\n      \"leads\": 0\n    },\n    ...\n  ],\n  \"speed\": {\n    \"avg_days_to_quote\": 1.7248094081878662e-06,\n    \"avg_days_to_win\": 1.851934939622879e-06\n  }\n}\n```",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "read",
          "scope": "sales:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#leads"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/requests/pipeline": {
      "get": {
        "operationId": "get_requests_pipeline",
        "summary": "Requests: pipeline",
        "description": "The funnel columns, with cards in each.\n\n**Needs:** Sales at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/requests/pipeline\n\n200\n{\n  \"stages\": [\n    {\n      \"id\": \"new_lead\",\n      \"label\": \"New lead\",\n      \"color\": \"#2b8ba3\",\n      \"kind\": \"open\",\n      \"cards\": ...\n    },\n    ...\n  ],\n  \"stats\": {\n    \"needs_action\": 0,\n    \"quotes_out_cents\": 0,\n    \"quotes_out_count\": 0,\n    \"won_this_month_cents\": 0,\n    \"new_this_week\": 1\n  },\n  \"next_up\": [\n    {\n      \"id\": \"01M3JVF27ZWWRNNSY20Y3G8DZX\",\n      \"tenant_id\": \"ten_flow\",\n      \"client_id\": \"01M3JVF1K1XS5ZJKJG6RF2TBXE\",\n      \"property_id\": \"01M3JVF27NYHM2G15CENR5J1SS\",\n      \"title\": \"Fence staining estimate\",\n      ...\n    },\n    ...\n  ]\n}\n```",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "read",
          "scope": "sales:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#leads"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/requests/bulk": {
      "post": {
        "operationId": "post_requests_bulk",
        "summary": "Requests: bulk",
        "description": "**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/requests/{id}": {
      "get": {
        "operationId": "get_requests_by_id",
        "summary": "Requests: read one",
        "description": "One lead, with the thread around it.\n\n**Needs:** Sales at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/requests/01M3JVF27ZWWRNNSY20Y3G8DZX\n\n200\n{\n  \"tags\": [],\n  \"request\": {\n    \"id\": \"01M3JVF27ZWWRNNSY20Y3G8DZX\",\n    \"tenant_id\": \"ten_flow\",\n    \"client_id\": \"01M3JVF1K1XS5ZJKJG6RF2TBXE\",\n    \"property_id\": \"01M3JVF27NYHM2G15CENR5J1SS\",\n    \"title\": \"Fence staining estimate\",\n    \"details\": \"About 200 ft of wood privacy fence, both sides.\",\n    ...\n  },\n  \"client\": {\n    \"id\": \"01M3JVF1K1XS5ZJKJG6RF2TBXE\",\n    \"tenant_id\": \"ten_flow\",\n    \"first_name\": \"Dale\",\n    \"last_name\": \"Harmon\",\n    \"company_name\": \"Harmon Rentals\",\n    \"is_company\": 0,\n    ...\n  },\n  \"property\": {\n    \"id\": \"01M3JVF27NYHM2G15CENR5J1SS\",\n    \"tenant_id\": \"ten_flow\",\n    \"client_id\": \"01M3JVF1K1XS5ZJKJG6RF2TBXE\",\n    \"name\": null,\n    \"street1\": \"22 Suber Rd\",\n    \"street2\": null,\n    ...\n  },\n  \"fallback_property\": null,\n  \"quotes\": [],\n  ...\n}\n```",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "read",
          "scope": "sales:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#leads"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "operationId": "patch_requests_by_id",
        "summary": "Requests: update",
        "description": "Move it, rename it, change the stage. Also takes the four `meta_` fields, so a Meta lead id can be added after the lead was filed.\n\n**Needs:** Sales at write.\n\n**Field limits (400 past them):** Titles up to 300 characters, details 20,000, where it came from 100. assessment_at and follow_up_at: Dates are real days from 2000 to ten years ahead.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#leads"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "maxLength": 300
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "title": "Fence staining, both sides"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      },
      "delete": {
        "operationId": "delete_requests_by_id",
        "summary": "Requests: delete",
        "description": "Delete a lead nothing hangs off.\n\n**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#leads"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/requests/{id}/history": {
      "get": {
        "operationId": "get_requests_by_id_history",
        "summary": "Requests: history",
        "description": "**Needs:** Sales at read (or write).",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "read",
          "scope": "sales:read"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/requests/{id}/archive": {
      "post": {
        "operationId": "post_requests_by_id_archive",
        "summary": "Requests: archive",
        "description": "Take it off the board.\n\n**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#leads"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/requests/{id}/unarchive": {
      "post": {
        "operationId": "post_requests_by_id_unarchive",
        "summary": "Requests: unarchive",
        "description": "Put it back on the board.\n\n**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#leads"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/requests/{id}/convert": {
      "post": {
        "operationId": "post_requests_by_id_convert",
        "summary": "Requests: convert",
        "description": "Turn a yes into a quote.\n\n**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#leads"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "quote_id": {
                      "type": "string"
                    },
                    "number": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "quote_id": "01M3JVF2N7SVS0KRM3JT64QTRK",
                  "number": 3
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/requests/{id}/tie": {
      "post": {
        "operationId": "post_requests_by_id_tie",
        "summary": "Requests: tie",
        "description": "Put one of the customer's quotes or jobs that is on no lead onto this lead. Send `quote_id` or `job_id`. A quote brings its jobs, a job brings its quote. Refused for another customer's record, one already on another lead, or anything archived. The card moves forward to match (Won for a job, an approval or a deposit paid in full), with no webhook.\n\n**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#leads"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "quote_id": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "quote_id": "01M3JVF2N7SVS0KRM3JT64QTRK"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "already": {
                      "type": "boolean"
                    },
                    "quote_ids": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "job_ids": {
                      "type": "array"
                    },
                    "moved": {
                      "type": "boolean"
                    },
                    "stage": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string"
                        },
                        "label": {
                          "type": "string"
                        }
                      }
                    },
                    "words": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "already": false,
                  "quote_ids": [
                    "01M3JVF2N7SVS0KRM3JT64QTRK"
                  ],
                  "job_ids": [],
                  "moved": true,
                  "stage": {
                    "key": "quoted",
                    "label": "Quoted"
                  },
                  "words": "Tied quote #3 to this lead, which moved to Quoted."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/quotes": {
      "get": {
        "operationId": "get_quotes",
        "summary": "Quotes: read",
        "description": "Estimates in the shop, newest first. `?status=`, `?client_id=`, `?from=`/`?to=` (a YYYY-MM-DD is the shop's own day in its time zone, `to` the first day left out; a full timestamp is used as is), `?limit=` (up to 300), `?before=` for the next page.\n\n**Needs:** Sales at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/quotes?limit=20\n\n200\n[\n  {\n    \"id\": \"01M3JVF2AVEKN7S8Q00X6G7E05\",\n    \"tenant_id\": \"ten_flow\",\n    \"client_id\": \"01M3JVF1K1XS5ZJKJG6RF2TBXE\",\n    \"property_id\": \"01M3JVF27NYHM2G15CENR5J1SS\",\n    \"request_id\": \"01M3JVF27ZWWRNNSY20Y3G8DZX\",\n    \"number\": 1,\n    \"title\": \"Fence staining - 200 ft\",\n    ...\n  }\n]\n```",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "read",
          "scope": "sales:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#quotes"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "post_quotes",
        "summary": "Quotes: create",
        "description": "Draft with `line_items[]`. Each line may include `product_id` and `measures[]` (`product_measure_id`, `label`, `unit`, `quantity`, optional `unit_price_cents`). Crew pay copies from the price book, or goes straight on the line: `measures[].pay_per_unit_cents`, `split_mode`, `unit_cost_cents`, or on a plain line `crew_pay_cents` or `pay_per_unit_cents` (owner or admin key). What the line costs you: `unit_cost_cents`, and/or `cost_breakdown[]` of named items (`name`, `quantity`, `unit`, `unit_cost_cents`; see What a line costs). Discounts as on PATCH, including a timed offer: `timed_discount_kind` (`\"amount\"` or `\"percent\"`), `timed_discount_cents` or `timed_discount_bp`, `timed_discount_hours` with `timed_discount_unit` (`\"hours\"`, `\"days\"`, `\"weeks\"`, `\"months\"`; up to 24 months) and `timed_discount_reason` (see A timed offer on a quote). A line may be one tier of a line the customer picks from: `choice_group`, with `recommended` on the default tier (see Tiers on one line). Or an add-on of the line above: `addon: true` (see Add-ons on a line). Options the customer picks one of: `options` (two to four `{ key, label }`) and `recommended_option`, with each line's `quote_option` and `link_key`; `options_pick: \"many\"` lets them take several (see Options inside one quote). `chosen_options` is refused here: a new quote is a draft, approved once it is made. Starts as a draft. Without `request_id` it stays on no lead as a draft; when it is first sent it joins the customer's lead, only when exactly one open lead fits (same property, came in before the quote).\n\n**Needs:** Sales at write.\n\n**Field limits (400 past them):** Names up to 200 characters, titles 300, notes, messages and instructions 20,000. Ids are text, as Chalk hands them back; a number where an id goes is refused. line_items, when sent, is a list of line objects. deposit_cents and discount_cents are whole cents, 0 or more, and a dollar discount is not more than the work. deposit_bp is 0 to 10000. expires_at is a real day from 2000 to ten years ahead.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#quotes"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string"
                  },
                  "property_id": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string",
                    "maxLength": 300
                  },
                  "line_items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string"
                        },
                        "measures": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "label": {
                                "type": "string"
                              },
                              "unit": {
                                "type": "string"
                              },
                              "quantity": {
                                "type": "integer"
                              },
                              "unit_price_cents": {
                                "type": "integer"
                              },
                              "pay_per_unit_cents": {
                                "type": "integer"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "client_id": "cli_...",
                "property_id": "prop_...",
                "title": "Fence staining - 200 ft",
                "line_items": [
                  {
                    "name": "Fence staining",
                    "description": "Clean, brighten and stain both sides",
                    "measures": [
                      {
                        "label": "Fence",
                        "unit": "ln ft",
                        "quantity": 200,
                        "unit_price_cents": 350,
                        "pay_per_unit_cents": 100
                      }
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "number": {
                      "type": "integer"
                    },
                    "subtotal_cents": {
                      "type": "integer"
                    },
                    "discount_cents": {
                      "type": "integer"
                    },
                    "tax_cents": {
                      "type": "integer"
                    },
                    "total_cents": {
                      "type": "integer"
                    },
                    "updated_at": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "01J...",
                  "number": 1,
                  "subtotal_cents": 70000,
                  "discount_cents": 0,
                  "tax_cents": 0,
                  "total_cents": 70000,
                  "updated_at": "..."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/quotes/send-wording": {
      "get": {
        "operationId": "get_quotes_send_wording",
        "summary": "Quotes: send wording",
        "description": "**Needs:** Sales at read (or write).",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "read",
          "scope": "sales:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/quotes/bulk": {
      "post": {
        "operationId": "post_quotes_bulk",
        "summary": "Quotes: bulk",
        "description": "**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/quotes/{id}": {
      "get": {
        "operationId": "get_quotes_by_id",
        "summary": "Quotes: read one",
        "description": "One quote. `line_items[]` each carry their own `measures[]` and crew pay nested under them, so you can send them straight back on PATCH. Each line also carries `unit_cost_cents`, `cost_breakdown[]` (its named cost items), `line_cost_cents` (what it adds to materials) and `materials_from` (`cost_breakdown`, `unit_cost`, or `price_book` when the price book's material rules buy for it). `line_item_measures` is the same measurements as one flat list. `cost_preview` is the shop's cost card (crew pay, materials, overhead): `materials_cents` is `price_book_materials_cents` plus `line_materials_cents`. `quote.timed_discount` is the timed offer (`active`, `off_cents`, `until`, `remaining_ms`, `countdown`, `portal_total_cents`), and `discounts[]` every discount, each with `active` and `off_cents`. A quote with options also returns `options` (each with its own totals and deposit), `recommended_option`, `options_pick` (`\"one\"`, or `\"many\"` when the customer may take several), `chosen_option` (one key, the first taken), `chosen_options` (every key taken, in option order; `[]` until a pick) and `shown_option`, and each line its `quote_option` and `link_key`; all `null` on a quote with none (see Options inside one quote). `opens` is every time the customer opened it, by kind of device: `{ count, phone, tablet, computer, capped, last_at, last_device, last_app, recent[] }`, where `recent` is the newest 50 as `{ at, device, app }`, `device` is `phone`, `tablet` or `computer`, and `app` names an in-app browser (`facebook`, `messenger`, `instagram`, `tiktok`, `linkedin`, `google`) or is `null`. Only opens after it was sent, never the office looking (Preview, See what they see, or any browser signed in to the shop), and a reload on the same kind of device within 30 minutes counts once. At most 200 are kept (`capped: true`). No address or browser details are stored. `null` before opens were tracked. Pay and cost are left out for a key whose person has Job prices off.\n\n**Needs:** Sales at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/quotes/01J...\n\n200\n{\n  \"quote\": { \"id\": \"01J...\", \"number\": 1, \"status\": \"draft\", \"total_cents\": 70000, ... },\n  \"line_items\": [\n    { \"id\": \"01J...\", \"name\": \"Fence staining\", \"quantity\": 1, \"unit_price_cents\": 70000, \"total_cents\": 70000,\n      \"measures\": [ { \"id\": \"01J...\", \"product_measure_id\": null, \"label\": \"Fence\", \"unit\": \"ln ft\", \"quantity\": 200,\n                     \"unit_price_cents\": 350, \"unit_cost_cents\": 0, \"pay_per_unit_cents\": 100, \"split_mode\": \"split\", \"pay_set\": 1 } ],\n      \"crew_pay_cents\": null, \"pay_per_unit_cents\": null, \"split_mode\": null }\n  ],\n  \"line_item_measures\": [ ... ],\n  \"cost_preview\": { \"revenue_cents\": 70000, \"measurement_pay_cents\": 20000, ... },\n  ...\n}\n```",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "read",
          "scope": "sales:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#quotes"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "operationId": "patch_quotes_by_id",
        "summary": "Quotes: update",
        "description": "Same nested lines, including `measures[]`. Send back what GET gave you: read-only keys (`id`, `total_cents`, `sort_order`) ride along. A line or measurement sent without its pay keeps the pay it had, and a line sent without `unit_cost_cents` or `cost_breakdown` keeps its cost (`cost_breakdown: []` clears the list), while it is the same line: sent with its `id` from GET, it is that line while it is the same price-book item (`product_id`) with the same name or one sharing a word. A line picked again from the price book, or retyped as other work, is not taken for that line by its id: it is matched the way a line sent without an id is (by its name and price-book item, or the same place with the same unit, price and quantity), and starts clean when nothing matches. Its `measures[]` are its own: send them, or a line known by its `id` gets back the measurements it had. Change extras, deposit or terms. Tiers and add-ons as on POST (`choice_group`, `addon`; see Tiers on one line and Add-ons on a line); each save tidies them. Options as on POST (`options`, `recommended_option`, `options_pick`, each line's `quote_option` and `link_key`); `options_pick` left out keeps what is stored, and it is fixed once the quote is decided; `line_items` replaces every line in every option, and lines where none says its option, on a quote with options, are a 409 with `stale: true` and nothing changed (see Options inside one quote). `option` (or `chosen_options`, a list, on a pick-many quote) goes with `status: \"approved\"`: the ones the customer chose. Without that status either is a 400. One discount: `discount_cents` and `discount_reason`. A timed offer: the `timed_discount_*` fields; `timed_discount_kind: null` takes it off, and a new kind, length or unit starts its clock again. Several: `discounts[]`, each with its own `reason`, and `\"timed\": true` with `hours` and `unit` for a timed one, or `\"unit\": \"date\"` with an `until` for one that ends on a set day. They stack: each percent is of the work before any discount. Not both in one call. A converted quote is sealed; the 400 names the job to edit instead. Any other field is a 400 that names it. To be sure you are not writing over somebody else's change, send `base_updated_at`: exactly the `updated_at` you read (from GET, or from your last save's answer). If the quote has changed since, or the stamp is not one this quote had, the answer is a 409 and nothing is written; read it again and resend.\n\n**Needs:** Sales at write.\n\n**Field limits (400 past them):** Names up to 200 characters, titles 300, notes, messages and instructions 20,000. line_items, when sent, is a list of line objects. deposit_cents and discount_cents are whole cents, 0 or more, and a dollar discount is not more than the work. deposit_bp is 0 to 10000. expires_at is a real day from 2000 to ten years ahead.\n\nExample from the developer page:\n\n```\nPATCH /api/quotes/01J...\n{\n  \"title\": \"Fence staining - 200 ft, both sides\",\n  \"line_items\": [ ...the line_items from GET, changed... ],\n  \"discounts\": [ { \"kind\": \"percent\", \"bp\": 500, \"reason\": \"Neighbor\" } ]\n}\n\n200\n{ \"ok\": true, \"subtotal_cents\": 77500, \"discount_cents\": 3875, \"tax_cents\": 0, \"total_cents\": 73625, \"updated_at\": \"...\" }\n```",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#quotes"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "subtotal_cents": {
                      "type": "integer"
                    },
                    "discount_cents": {
                      "type": "integer"
                    },
                    "tax_cents": {
                      "type": "integer"
                    },
                    "total_cents": {
                      "type": "integer"
                    },
                    "updated_at": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "subtotal_cents": 77500,
                  "discount_cents": 3875,
                  "tax_cents": 0,
                  "total_cents": 73625,
                  "updated_at": "..."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      },
      "delete": {
        "operationId": "delete_quotes_by_id",
        "summary": "Quotes: delete",
        "description": "Delete a quote nothing hangs off. A quote with a job or money on it archives instead.\n\n**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#quotes"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/quotes/{id}/history": {
      "get": {
        "operationId": "get_quotes_by_id_history",
        "summary": "Quotes: history",
        "description": "**Needs:** Sales at read (or write).",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "read",
          "scope": "sales:read"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/quotes/{id}/pdf": {
      "get": {
        "operationId": "get_quotes_by_id_pdf",
        "summary": "Quotes: pdf",
        "description": "The PDF the customer sees. No crew pay or cost on it. A quote with options prints one: the chosen one, else the recommended one, else the first, with its own lines, totals and deposit, and names the others with their totals.\n\n**Needs:** Sales at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/quotes/01M3JVF2AVEKN7S8Q00X6G7E05/pdf\n\n200\n(PDF, 2620 bytes)\n```",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "read",
          "scope": "sales:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#quotes"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file.",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "application/pdf"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/quotes/{id}/materials": {
      "get": {
        "operationId": "get_quotes_by_id_materials",
        "summary": "Quotes: materials",
        "description": "What the job will take: the price book's materials for measured lines (`source: \"price_book\"`, rounded to packs), then each other line's own cost items (`source: \"line\"`; the same item on several lines is one row, and `lines` names them; a line with only `unit_cost_cents` is one row named after it). Only lines that count (an extra once taken). `total_cost_cents` is the cost card's `materials_cents`. The prices are for the owner and admins; any other key gets the list without money.\n\n**Needs:** Sales at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/quotes/01J.../materials\n\n200\n{\n  \"materials\": [\n    { \"name\": \"EXPERT Stain & Seal\", \"unit_label\": \"5-gal pail\", \"used\": 3, \"buy\": 3, \"packs\": 0, \"pack_size\": 0,\n      \"cost_cents\": 35700, \"source\": \"line\", \"unit_cost_cents\": 11900, \"lines\": [ \"Fence staining\" ] },\n    { \"name\": \"Brushes and rollers\", \"unit_label\": \"kit\", \"used\": 1, \"buy\": 1, \"cost_cents\": 1800, \"source\": \"line\", ... },\n    { \"name\": \"Gate\", \"unit_label\": \"each\", \"used\": 2, \"buy\": 2, \"cost_cents\": 2400, \"source\": \"line\", \"unit_cost_cents\": 1200, ... }\n  ],\n  \"total_cost_cents\": 39900,\n  \"price_book_cost_cents\": 0,\n  \"line_cost_cents\": 39900\n}\n```",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "read",
          "scope": "sales:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#quotes"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/quotes/{id}/approve": {
      "post": {
        "operationId": "post_quotes_by_id_approve",
        "summary": "Quotes: approve",
        "description": "Mark it signed from the office. On a quote with options send `option`, the key of the one the customer chose, or on a pick-many quote `chosen_options`, every key they took (`[\"a\", \"c\"]`); with none chosen yet and none sent, the answer is a 409 with `choose_option: true`, `options_pick` and `options`. Several keys on a pick-one quote, a key that is not an option, an empty list, or both fields at once is a 400 naming the field. The quote then adds up as every option taken, the bill worked out once over all of them (see Options inside one quote).\n\n**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#quotes"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "chosen_options": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "chosen_options": [
                  "a",
                  "c"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/quotes/{id}/archive": {
      "post": {
        "operationId": "post_quotes_by_id_archive",
        "summary": "Quotes: archive",
        "description": "Take it off the live list.\n\n**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#quotes"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/quotes/{id}/unarchive": {
      "post": {
        "operationId": "post_quotes_by_id_unarchive",
        "summary": "Quotes: unarchive",
        "description": "Put it back.\n\n**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#quotes"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/quotes/{id}/convert": {
      "post": {
        "operationId": "post_quotes_by_id_convert",
        "summary": "Quotes: convert",
        "description": "Turn an approved quote into a job. The job keeps the lines, the measurements, the crew pay, and each line's cost and cost items it was sold with. `crew_pay_cents` is what the crew is owed, waiting as \"Crew\" until somebody is on a visit. The customer's lead goes to Won; a quote with no lead first joins the customer's one fitting open lead (same rule as creating a quote), and with none or several it is left alone. On a quote with options the job carries only the chosen option's lines (on a pick-many quote, every option taken, in option order); `option`, or `chosen_options` on a pick-many quote, chooses when none is chosen yet, and with neither the answer is the same 409 as approve.\n\n**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#quotes"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "job_id": {
                      "type": "string"
                    },
                    "crew_pay_cents": {
                      "type": "integer"
                    },
                    "expense_cents": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "job_id": "01M3JVF2D4HZ9B61Q6VK4SG6SY",
                  "crew_pay_cents": 23000,
                  "expense_cents": 0
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/quotes/{id}/duplicate": {
      "post": {
        "operationId": "post_quotes_by_id_duplicate",
        "summary": "Quotes: duplicate",
        "description": "Copy last year's deck job as a starting point. Crew pay and cost items set on the lines come too, and so do the options (and `options_pick`), each line in its own; the copy starts with none chosen.\n\n**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#quotes"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "number": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "id": "01M3JVF2CQ9FYR26B9EDAT0549",
                  "number": 2
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/quotes/{id}/options": {
      "post": {
        "operationId": "post_quotes_by_id_options",
        "summary": "Quotes: options",
        "description": "Add an option inside the quote: `{ label, copy_from }`, both optional. A quote with no options becomes one with two, its lines Option A. `copy_from` (an option's key, `\"a\"` on a quote that had none) fills the new one with a linked copy of that option's lines; left out, it starts empty. Up to four, while the quote is a draft, waiting on the customer, or with changes asked; `options_pick` stays as it was. Answers the new `key` and `label`, `copied_lines`, and every option with its totals (see Options inside one quote).\n\n**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#quotes"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string"
                  },
                  "copy_from": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "label": "Full restoration",
                "copy_from": "a"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "key": {
                      "type": "string"
                    },
                    "label": {
                      "type": "string"
                    },
                    "copied_lines": {
                      "type": "integer"
                    },
                    "options": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "key": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "shown": {
                            "type": "boolean"
                          },
                          "recommended": {
                            "type": "boolean"
                          },
                          "chosen": {
                            "type": "boolean"
                          },
                          "lines": {
                            "type": "integer"
                          },
                          "subtotal_cents": {
                            "type": "integer"
                          },
                          "discount_cents": {
                            "type": "integer"
                          },
                          "tax_cents": {
                            "type": "integer"
                          },
                          "total_cents": {
                            "type": "integer"
                          },
                          "deposit_cents": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "key": "b",
                  "label": "Full restoration",
                  "copied_lines": 2,
                  "options": [
                    {
                      "key": "a",
                      "label": "Option A",
                      "shown": true,
                      "recommended": true,
                      "chosen": false,
                      "lines": 2,
                      "subtotal_cents": 120000,
                      "discount_cents": 0,
                      "tax_cents": 0,
                      "total_cents": 120000,
                      "deposit_cents": 0
                    },
                    {
                      "key": "b",
                      "label": "Full restoration",
                      "shown": false,
                      "recommended": false,
                      "chosen": false,
                      "lines": 2,
                      "subtotal_cents": 120000,
                      "discount_cents": 0,
                      "tax_cents": 0,
                      "total_cents": 120000,
                      "deposit_cents": 0
                    }
                  ]
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/quotes/{id}/link": {
      "post": {
        "operationId": "post_quotes_by_id_link",
        "summary": "Quotes: link",
        "description": "Mint the public link without sending it. Returns `{ hub_url, app_url }`. `hub_url` is the customer portal. `app_url` is the office page `https://app.chalkcrm.com/quotes/:id`. Needs send: the link outlives the key.\n\n**Needs:** Sales at write, and Can message customers.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:send"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "send",
          "scope": "sales:send"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#quotes"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "hub_url": {
                      "type": "string"
                    },
                    "app_url": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "hub_url": "https://app.chalkcrm.com/hub/01M3JVF2CAC3VHWJMBFFXDGNNS",
                  "app_url": "https://app.chalkcrm.com/quotes/01M3JVF2AVEKN7S8Q00X6G7E05"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_send"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      },
      "delete": {
        "operationId": "delete_quotes_by_id_link",
        "summary": "Quotes: link, delete",
        "description": "Take the public link back: the customer's copy stops opening.\n\n**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#quotes"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "revoked": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "revoked": 1
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/quotes/{id}/lines/{lineId}/cost": {
      "put": {
        "operationId": "put_quotes_by_id_lines_by_lineId_cost",
        "summary": "Quotes: lines cost, set",
        "description": "What one line costs you, without sending every line back: `cost_breakdown` (the named items; `[]` clears it) and/or `unit_cost_cents`. Both sent must agree. Answers the line and the new `cost_preview`. The owner or an admin. A line the price book buys for, or a converted quote, is a 400 that says why.\n\n**Needs:** Payments and money at write.\n\nExample from the developer page:\n\n```\nPUT /api/quotes/01J.../lines/01J.../cost\n{\n  \"cost_breakdown\": [ { \"name\": \"Post caps\", \"quantity\": 2, \"unit\": \"each\", \"unit_cost_cents\": 1200 } ]\n}\n\n200\n{\n  \"ok\": true,\n  \"line_item_id\": \"01J...\",\n  \"name\": \"Gate\",\n  \"quantity\": 2,\n  \"unit\": \"each\",\n  \"unit_cost_cents\": 1200,\n  \"cost_breakdown\": [ { \"id\": \"01J...\", \"name\": \"Post caps\", \"quantity\": 2, \"unit\": \"each\", \"unit_cost_cents\": 1200, \"total_cost_cents\": 2400 } ],\n  \"line_cost_cents\": 2400,\n  \"materials_from\": \"cost_breakdown\",\n  \"summary\": \"Materials on Gate: Post caps, 2 x each at $12.00 = $24.00\",\n  \"cost_preview\": { \"materials_cents\": 39900, \"cost_cents\": 90900, \"profit_before_profit_splits_cents\": 119100, ... }\n}\n```",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "write",
          "scope": "payments_money:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#quotes"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lineId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "cost_breakdown": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "quantity": {
                          "type": "integer"
                        },
                        "unit": {
                          "type": "string"
                        },
                        "unit_cost_cents": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "cost_breakdown": [
                  {
                    "name": "Post caps",
                    "quantity": 2,
                    "unit": "each",
                    "unit_cost_cents": 1200
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/quotes/{id}/lines/{lineId}/crew-pay": {
      "put": {
        "operationId": "put_quotes_by_id_lines_by_lineId_crew_pay",
        "summary": "Quotes: lines crew pay, set",
        "description": "Crew pay on one line, without sending every line back. `pay_per_unit_cents` (per unit of the line or its measurement) or `crew_pay_cents` (flat, plain lines), optional `split_mode`, and `measure_id` on a line measured two ways. 0 takes it off. Owner or admin key. Line ids change on every full save: read them from GET first.\n\n**Needs:** Payments and money at write.",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "write",
          "scope": "payments_money:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#quotes"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lineId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "crew_pay_cents": {
                    "type": "integer"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "crew_pay_cents": 3000
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "line_item_id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "unit": {
                      "type": "string"
                    },
                    "quantity": {
                      "type": "integer"
                    },
                    "pay_per_unit_cents": {},
                    "crew_pay_cents": {
                      "type": "integer"
                    },
                    "split_mode": {
                      "type": "string"
                    },
                    "crew_pay_total_cents": {
                      "type": "integer"
                    },
                    "summary": {
                      "type": "string"
                    },
                    "measure_id": {}
                  }
                },
                "example": {
                  "ok": true,
                  "line_item_id": "01M3JVF2BHSS8QWFSJQFYE63DX",
                  "name": "Gate",
                  "unit": "each",
                  "quantity": 1,
                  "pay_per_unit_cents": null,
                  "crew_pay_cents": 3000,
                  "split_mode": "split",
                  "crew_pay_total_cents": 3000,
                  "summary": "Crew pay on Gate: $30.00 flat",
                  "measure_id": null
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/quotes/{id}/send-preview": {
      "post": {
        "operationId": "post_quotes_by_id_send_preview",
        "summary": "Quotes: send preview",
        "description": "**Needs:** Sales at write, and Can message customers.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:send"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "send",
          "scope": "sales:send"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_send"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/quotes/{id}/send": {
      "post": {
        "operationId": "post_quotes_by_id_send",
        "summary": "Quotes: send",
        "description": "Body `{ email: true, sms: true }` to send both. Empty body uses the shop default (email) and 400s if the client has no email. `{ email: false, sms: true }` is SMS-only. Office also accepts `{ channel, to, message }`, where `channel` is `\"sms\"`, `\"email\"` or `\"both\"`. With `\"both\"`, each channel takes its own optional `sms_to` / `email_to` (else the one on file) and its own optional `sms_message` / `email_message` (else the shop's text or email wording), with the same customer link, and the answer's `sent` lists each channel with `status` `sent`, `queued` or `failed` (a text that had to go by email instead is `failed`). `sms_to` must be a phone number and `email_to` an email address; both go with `\"both\"` only. With `\"both\"`, a single `to`, or a `message` without `message_channel`, is answered 400. Uses `tpl_quote_sms` for the body and `tpl_quote_email_subject` for the email subject. May also carry the discount fields, checked as on PATCH. A timed offer's clock starts now. Needs send. A text to a number marked wrong (a call logged as \"Phone number is incorrect\", or marked on the client page) is answered 409 and nothing is sent or changed, unless you send `confirm_wrong_number: true` with `wrong_number_seen` set to the 409's `wrong_number.seen`; the 409 carries `wrong_number` (the number, when it was marked, by whom, and `seen`) and `confirm_with`. The yes covers the marks it names and no more: a number marked again later, or another number, is asked again, so an integration that always sends the yes never texts a newly marked number by itself. Email is never held. Send a new `Idempotency-Key` with the yes (the body changed). With `{ email: true, sms: true }` the whole send waits, so it never goes half sent; send `sms: false` to send the email alone. The answer carries `saved_email` only when the send saved an address as the customer's email: an email typed for a customer with none on file, never the shop's or a team member's address, and never one that had failed or been blocked by the time the send answered. Only a person sending from the app saves one; a send made with an API key never saves an address, so its answer has no `saved_email`.\n\n**Needs:** Sales at write, and Can message customers.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:send"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "send",
          "scope": "sales:send"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#quotes"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "boolean"
                  },
                  "sms": {
                    "type": "boolean"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "email": true,
                "sms": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "hub_url": {
                      "type": "string"
                    },
                    "app_url": {
                      "type": "string"
                    },
                    "channel": {
                      "type": "string"
                    },
                    "to": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "hub_url": "https://app.chalkcrm.com/hub/01M3JVF2CAC3VHWJMBFFXDGNNS",
                  "app_url": "https://app.chalkcrm.com/quotes/01M3JVF2AVEKN7S8Q00X6G7E05",
                  "channel": "email",
                  "to": "dale@example.com"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_send"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/quotes/{id}/send-receipt": {
      "post": {
        "operationId": "post_quotes_by_id_send_receipt",
        "summary": "Quotes: send receipt",
        "description": "**Needs:** Sales at write, and Can message customers.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:send"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "send",
          "scope": "sales:send"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_send"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/quotes/{id}/ask-deposit": {
      "post": {
        "operationId": "post_quotes_by_id_ask_deposit",
        "summary": "Quotes: ask deposit",
        "description": "**Needs:** Sales at write, and Can message customers.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:send"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "send",
          "scope": "sales:send"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_send"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/quotes/{id}/mark-sent": {
      "post": {
        "operationId": "post_quotes_by_id_mark_sent",
        "summary": "Quotes: mark sent",
        "description": "Mark it sent when you handed it over some other way. Starts the follow-up clock, and a timed offer's clock.\n\n**Needs:** Sales at write, and Can message customers.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:send"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "send",
          "scope": "sales:send"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#quotes"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "hub_url": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "hub_url": "https://app.chalkcrm.com/hub/01M3JVF2NNPV6MJH6FXS0PTDA4"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_send"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/quotes/{id}/invoice": {
      "post": {
        "operationId": "post_quotes_by_id_invoice",
        "summary": "Quotes: invoice",
        "description": "Bill an approved quote straight away, with no job. Only for shops on the Simple workflow; others convert first. Owner or admin key. On a quote with options the invoice carries only the chosen option's lines (on a pick-many quote, every option taken, billed to the cent of the approved total); `option`, or `chosen_options` on a pick-many quote, chooses when none is chosen yet, and with neither the answer is the same 409 as approve.\n\n**Needs:** Invoices at write.",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "write",
          "scope": "invoices:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#quotes"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "invoice_id": {
                      "type": "string"
                    },
                    "reused": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "invoice_id": "01M3JVF2VNKDD0N2Q0926JRSRY",
                  "reused": false
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/leads/{id}/panel": {
      "get": {
        "operationId": "get_leads_by_id_panel",
        "summary": "Leads: panel",
        "description": "**Needs:** Sales at read (or write).",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "read",
          "scope": "sales:read"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/leads/{id}/follow-up": {
      "post": {
        "operationId": "post_leads_by_id_follow_up",
        "summary": "Leads: follow up",
        "description": "**Needs:** Sales at write, and Can message customers.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:send"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "send",
          "scope": "sales:send"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_send"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/quote-templates": {
      "get": {
        "operationId": "get_quote_templates",
        "summary": "Quote templates: read",
        "description": "Reuse \"deck refresh\" instead of rebuilding lines.\n\n**Needs:** Sales at read (or write).",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "read",
          "scope": "sales:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array"
                },
                "example": []
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "post_quote_templates",
        "summary": "Quote templates: create",
        "description": "Save a set of lines to start quotes from: `name`, `title`, `line_items[]`.\n\n**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "line_items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "quantity": {
                          "type": "integer"
                        },
                        "unit_price_cents": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "name": "Fence refresh",
                "title": "Fence staining",
                "line_items": [
                  {
                    "name": "Fence staining",
                    "quantity": 1,
                    "unit_price_cents": 70000
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "01M3JVF2SF7TX56SKWWT9GWK1T"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/quote-templates/{id}": {
      "patch": {
        "operationId": "patch_quote_templates_by_id",
        "summary": "Quote templates: update",
        "description": "Change one.\n\n**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "name": "Fence refresh, both sides"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      },
      "delete": {
        "operationId": "delete_quote_templates_by_id",
        "summary": "Quote templates: delete",
        "description": "Take one off.\n\n**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/products": {
      "get": {
        "operationId": "get_products",
        "summary": "Products: read",
        "description": "The price book.\n\n**Needs:** Sales at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/products\n\n200\n[\n  {\n    \"id\": \"01M3JVF2952CTWCVJEE4MYBNHW\",\n    \"tenant_id\": \"ten_flow\",\n    \"name\": \"Fence staining\",\n    \"description\": null,\n    \"category\": \"service\",\n    \"unit\": \"ln ft\",\n    \"unit_price_cents\": 350,\n    ...\n  }\n]\n```",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "read",
          "scope": "sales:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "post_products",
        "summary": "Products: create",
        "description": "Add a line the shop actually sells. May include nested `measures` (`measure_type_id`, `unit_price_cents` charge, `unit_cost_cents` costs you, `pay_per_unit_cents` crew pay, `split_mode`, `materials[]`) and `crew_minimum_cents`. Crew pay needs a key made by the owner or an admin; from anyone else it is a 403.\n\n**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "unit": {
                    "type": "string"
                  },
                  "unit_price_cents": {
                    "type": "integer"
                  },
                  "crew_minimum_cents": {
                    "type": "integer"
                  },
                  "measures": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "measure_type_id": {
                          "type": "string"
                        },
                        "unit_price_cents": {
                          "type": "integer"
                        },
                        "unit_cost_cents": {
                          "type": "integer"
                        },
                        "pay_per_unit_cents": {
                          "type": "integer"
                        },
                        "split_mode": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "name": "Fence staining",
                "unit": "ln ft",
                "unit_price_cents": 350,
                "crew_minimum_cents": 15000,
                "measures": [
                  {
                    "measure_type_id": "01M3JVF292GEWN4HWR0GREQQ28",
                    "unit_price_cents": 350,
                    "unit_cost_cents": 40,
                    "pay_per_unit_cents": 100,
                    "split_mode": "split"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "01M3JVF2952CTWCVJEE4MYBNHW"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/products/bulk": {
      "post": {
        "operationId": "post_products_bulk",
        "summary": "Products: bulk",
        "description": "Duplicate or delete. Delete retires (`active=0`). Duplicate copies name, price, cost, unit, description, measures and tiers, name suffixed \" (copy)\".\n\n**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "action": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "ids": [
                  "01M3JVF2952CTWCVJEE4MYBNHW"
                ],
                "action": "duplicate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "done": {
                      "type": "integer"
                    },
                    "skipped": {
                      "type": "array"
                    }
                  }
                },
                "example": {
                  "done": 1,
                  "skipped": []
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/products/{id}": {
      "get": {
        "operationId": "get_products_by_id",
        "summary": "Products: read one",
        "description": "One item with measurements, costs, crew pay, tiers. 404 if missing. `measures[].id` is the `product_measure_id` a quote line points at.\n\n**Needs:** Sales at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/products/01M3JVF2952CTWCVJEE4MYBNHW\n\n200\n{\n  \"id\": \"01M3JVF2952CTWCVJEE4MYBNHW\",\n  \"tenant_id\": \"ten_flow\",\n  \"name\": \"Fence staining\",\n  \"description\": null,\n  \"category\": \"service\",\n  \"unit\": \"ln ft\",\n  \"unit_price_cents\": 350,\n  ...\n}\n```",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "read",
          "scope": "sales:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "operationId": "patch_products_by_id",
        "summary": "Products: update",
        "description": "Change a price or a name. Same nested measures if present. Omit measures to leave them. Changing crew pay (`pay_per_unit_cents`, `split_mode`, `crew_minimum_cents`, or dropping a paid measurement) needs a key made by the owner or an admin. Other keys may send the pay unchanged or leave it out, and it stays as it is.\n\n**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "description": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "description": "Clean, brighten and stain both sides"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/product-tiers": {
      "get": {
        "operationId": "get_product_tiers",
        "summary": "Product tiers: read",
        "description": "Good / better / best prices for one item.\n\n**Needs:** Sales at read (or write).",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "read",
          "scope": "sales:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array"
                },
                "example": []
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/product-tiers/{productId}": {
      "put": {
        "operationId": "put_product_tiers_by_productId",
        "summary": "Product tiers: set",
        "description": "Replace those tiers. Owner or admin key.\n\n**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "parameters": [
          {
            "name": "productId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "tiers": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "unit_price_cents": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "tiers": [
                  {
                    "name": "Good",
                    "unit_price_cents": 325
                  },
                  {
                    "name": "Better",
                    "unit_price_cents": 350
                  },
                  {
                    "name": "Best",
                    "unit_price_cents": 395
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "count": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "count": 3
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/term-sets": {
      "get": {
        "operationId": "get_term_sets",
        "summary": "Term sets: read",
        "description": "The contract texts a quote can carry.\n\n**Needs:** Sales at read (or write).",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "read",
          "scope": "sales:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array"
                },
                "example": []
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "post_term_sets",
        "summary": "Term sets: create",
        "description": "Add one: `name`, `body`. Owner or admin key.\n\n**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "body": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "name": "Commercial",
                "body": "Net 30. Work guaranteed for two years."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "01M3JVF2ST847A61MQ99X1D97D"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/term-sets/{id}": {
      "patch": {
        "operationId": "patch_term_sets_by_id",
        "summary": "Term sets: update",
        "description": "Change one. Owner or admin key.\n\n**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "body": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "body": "Net 30. Work guaranteed for three years."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      },
      "delete": {
        "operationId": "delete_term_sets_by_id",
        "summary": "Term sets: delete",
        "description": "**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/pipeline-stages": {
      "get": {
        "operationId": "get_pipeline_stages",
        "summary": "Pipeline stages: read",
        "description": "Funnel columns. Do not make these up.\n\n**Needs:** Sales at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/pipeline-stages\n\n200\n{\n  \"stages\": [\n    {\n      \"id\": \"01M3JVF27ZNCZTSYV78D9JCXCW\",\n      \"key\": \"new_lead\",\n      \"label\": \"New lead\",\n      ...\n    },\n    ...\n  ],\n  \"events\": [\n    {\n      \"id\": \"lead_created\",\n      \"label\": \"A new lead arrives\"\n    },\n    ...\n  ]\n}\n```",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "read",
          "scope": "sales:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "post_pipeline_stages",
        "summary": "Pipeline stages: create",
        "description": "Add a column: `label`. Owner or admin key.\n\n**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "label": "Site walked"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "key": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "01M3JVF2T2YKDHKQZV5A6WYGG5",
                  "key": "site_walked"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/pipeline-stages/order": {
      "put": {
        "operationId": "put_pipeline_stages_order",
        "summary": "Pipeline stages: order, set",
        "description": "**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/pipeline-stages/{id}": {
      "patch": {
        "operationId": "patch_pipeline_stages_by_id",
        "summary": "Pipeline stages: update",
        "description": "Rename or recolor one. Owner or admin key.\n\n**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "label": "Site visited"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      },
      "delete": {
        "operationId": "delete_pipeline_stages_by_id",
        "summary": "Pipeline stages: delete",
        "description": "**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/measures/types": {
      "get": {
        "operationId": "get_measures_types",
        "summary": "Measures: types",
        "description": "Names of things you count (sq ft, ln ft).\n\n**Needs:** Sales at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/measures/types\n\n200\n[\n  {\n    \"id\": \"01M3JVF292GEWN4HWR0GREQQ28\",\n    \"tenant_id\": \"ten_flow\",\n    \"name\": \"Linear feet\",\n    \"unit\": \"ln ft\",\n    \"sort_order\": 0,\n    \"active\": 1,\n    \"created_at\": \"2026-09-28T01:53:25.794Z\"\n  },\n  ...\n]\n```",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "read",
          "scope": "sales:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#measures"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "post_measures_types",
        "summary": "Measures: types",
        "description": "Add a unit you count: `name`, `unit`.\n\n**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#measures"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "unit": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "name": "Linear feet",
                "unit": "ln ft"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "01M3JVF292GEWN4HWR0GREQQ28"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/measures/types/{id}": {
      "patch": {
        "operationId": "patch_measures_types_by_id",
        "summary": "Measures: types, update",
        "description": "Rename one. Owner or admin key.\n\n**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#measures"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "name": "Linear feet of fence"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      },
      "delete": {
        "operationId": "delete_measures_types_by_id",
        "summary": "Measures: types, delete",
        "description": "**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/measures/products": {
      "get": {
        "operationId": "get_measures_products",
        "summary": "Measures: products",
        "description": "Every measured item's rates.\n\n**Needs:** Sales at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/measures/products\n\n200\n[\n  {\n    \"id\": \"01M3JVF295J4AXJECSQWP36B7K\",\n    \"tenant_id\": \"ten_flow\",\n    \"product_id\": \"01M3JVF2952CTWCVJEE4MYBNHW\",\n    \"measure_type_id\": \"01M3JVF292GEWN4HWR0GREQQ28\",\n    \"unit_price_cents\": 350,\n    \"unit_cost_cents\": 40,\n    \"pay_per_unit_cents\": 100,\n    \"sort_order\": 0,\n    \"created_at\": \"2026-09-28T01:53:25.797Z\",\n    \"active\": 1,\n    ...\n  }\n]\n```",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "read",
          "scope": "sales:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#measures"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/measures/products/{productId}": {
      "get": {
        "operationId": "get_measures_products_by_productId",
        "summary": "Measures: products, read one",
        "description": "Rates, materials and crew floor for one item.\n\n**Needs:** Sales at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/measures/products/01M3JVF2952CTWCVJEE4MYBNHW\n\n200\n{\n  \"crew_minimum_cents\": 15000,\n  \"measures\": [\n    {\n      \"id\": \"01M3JVF295J4AXJECSQWP36B7K\",\n      \"tenant_id\": \"ten_flow\",\n      \"product_id\": \"01M3JVF2952CTWCVJEE4MYBNHW\",\n      ...\n    },\n    ...\n  ]\n}\n```",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "read",
          "scope": "sales:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#measures"
        },
        "parameters": [
          {
            "name": "productId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "put": {
        "operationId": "put_measures_products_by_productId",
        "summary": "Measures: products, set",
        "description": "Replace rates, materials, crew floor. Owner or admin keys only.\n\n**Needs:** Sales at write.",
        "tags": [
          "Sales"
        ],
        "security": [
          {
            "chalkKey": [
              "sales:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "sales",
          "kind": "write",
          "scope": "sales:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#measures"
        },
        "parameters": [
          {
            "name": "productId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "crew_minimum_cents": {
                    "type": "integer"
                  },
                  "measures": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "measure_type_id": {
                          "type": "string"
                        },
                        "unit_price_cents": {
                          "type": "integer"
                        },
                        "unit_cost_cents": {
                          "type": "integer"
                        },
                        "pay_per_unit_cents": {
                          "type": "integer"
                        },
                        "split_mode": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "crew_minimum_cents": 15000,
                "measures": [
                  {
                    "measure_type_id": "01M3JVF292GEWN4HWR0GREQQ28",
                    "unit_price_cents": 350,
                    "unit_cost_cents": 40,
                    "pay_per_unit_cents": 100,
                    "split_mode": "split"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "count": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "count": 1
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_sales_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/jobs": {
      "get": {
        "operationId": "get_jobs",
        "summary": "Jobs: read",
        "description": "Jobs on the books, newest first. `?status=`, `?client_id=`, `?archived=1`, `?limit=` (up to 300) and `?before=` for the next page.\n\n**Needs:** Schedule at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/jobs?limit=20\n\n200\n[\n  {\n    \"id\": \"01M3JVF2D4HZ9B61Q6VK4SG6SY\",\n    \"tenant_id\": \"ten_flow\",\n    \"client_id\": \"01M3JVF1K1XS5ZJKJG6RF2TBXE\",\n    \"property_id\": \"01M3JVF27NYHM2G15CENR5J1SS\",\n    \"quote_id\": \"01M3JVF2AVEKN7S8Q00X6G7E05\",\n    \"request_id\": \"01M3JVF27ZWWRNNSY20Y3G8DZX\",\n    \"number\": 1,\n    ...\n  }\n]\n```",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "read",
          "scope": "schedule:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#jobs"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "post_jobs",
        "summary": "Jobs: create",
        "description": "Open a job without a quote, if you need to. Same `line_items[]` as quotes, crew pay included. `starts_on` with `assignees` books its visits in the same call. Send `request_id` to put it on a lead (the lead goes to Won); with `quote_id` it takes the quote's lead. A job with neither is never put on a lead by guesswork.\n\n**Needs:** Schedule at write.\n\n**Field limits (400 past them):** Names up to 200 characters, titles 300, notes, messages and instructions 20,000. Ids are text, as Chalk hands them back; a number where an id goes is refused. line_items, when sent, is a list of line objects. starts_on and ends_on: Dates are real days from 2000 to ten years ahead.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#jobs"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string"
                  },
                  "property_id": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string",
                    "maxLength": 300
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "client_id": "01M3JVF1K1XS5ZJKJG6RF2TBXE",
                "property_id": "01M3JVF27NYHM2G15CENR5J1SS",
                "title": "Made by mistake"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "number": {
                      "type": "integer"
                    },
                    "visit_ids": {
                      "type": "array"
                    },
                    "hours": {}
                  }
                },
                "example": {
                  "id": "01M3JVF2RTAXSFAJZE6Q4REJZD",
                  "number": 3,
                  "visit_ids": [],
                  "hours": null
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/jobs/pick": {
      "get": {
        "operationId": "get_jobs_pick",
        "summary": "Jobs: pick",
        "description": "**Needs:** Schedule at read (or write).",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "read",
          "scope": "schedule:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/jobs/bulk": {
      "post": {
        "operationId": "post_jobs_bulk",
        "summary": "Jobs: bulk",
        "description": "**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/jobs/preview-recurrence": {
      "post": {
        "operationId": "post_jobs_preview_recurrence",
        "summary": "Jobs: preview recurrence",
        "description": "See the next visits before you lock a series: `recurrence_rule`, `starts_on`.\n\n**Needs:** Schedule at write.\n\nExample from the developer page:\n\n```\nPOST /api/jobs/preview-recurrence\n{\n  \"recurrence_rule\": \"FREQ=MONTHLY;COUNT=3\",\n  \"starts_on\": \"2026-10-03\"\n}\n\n200\n{\n  \"label\": \"Monthly, 3 times\",\n  \"dates\": [\n    \"2026-10-03\",\n    ...\n  ],\n  \"truncated\": false,\n  \"unsupported\": []\n}\n```",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#jobs"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "recurrence_rule": {
                    "type": "string"
                  },
                  "starts_on": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "recurrence_rule": "FREQ=MONTHLY;COUNT=3",
                "starts_on": "2026-10-03"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/jobs/{id}": {
      "get": {
        "operationId": "get_jobs_by_id",
        "summary": "Jobs: read one",
        "description": "One job, with visits, invoices, expenses, time, payouts and `costing` (the profit card: revenue, labor, technician pay, materials, fees, overhead, profit). `costing.estimated_materials_cents` is \"Estimated materials (from quote)\": the lines' own costs, counted while no materials receipt is logged. Once one is, `materials_receipts_cents` are the materials and `materials_vs_estimate_cents` says how they compare (above 0 is over). Never both. Lines nest their measurements, crew pay and cost items, as on quotes. A key whose person has Job prices off gets the crew's view: the work, no money.\n\n**Needs:** Schedule at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/jobs/01J...\n\n200\n{\n  \"job\": { \"id\": \"01J...\", \"number\": 1, \"status\": \"scheduled\", \"total_cents\": 70000, ... },\n  \"line_items\": [ { \"name\": \"Fence staining\", \"measures\": [ { \"quantity\": 200, \"pay_per_unit_cents\": 100, ... } ], ... } ],\n  \"visits\": [ ... ],\n  \"payouts\": [ { \"payee_name\": \"Pete Barnes\", \"amount_cents\": 20000, \"pay_kind\": \"measurement\", \"status\": \"pending\", ... } ],\n  \"costing\": { \"revenue_cents\": 70000, \"payout_cents\": 20000, \"pay_technician_cents\": 20000, \"profit_cents\": 50000, ... },\n  ...\n}\n```",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "read",
          "scope": "schedule:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#jobs"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "operationId": "patch_jobs_by_id",
        "summary": "Jobs: update",
        "description": "Change `title`, `instructions`, `status`, dates, `line_items[]` (same lines as quotes) or `discount_cents`. Charges can grow after billing but never drop below what is already invoiced. Lines sent back without their crew pay keep the pay the job was sold with; only an owner or admin key changes it. Lines sent back without their cost keep it too. A job keeps one discount amount: `discount_reason` goes in the job history. The crew is set on each visit. Any other field is a 400 that names it.\n\n**Needs:** Schedule at write.\n\n**Field limits (400 past them):** Names up to 200 characters, titles 300, notes, messages and instructions 20,000. line_items, when sent, is a list of line objects. starts_on and ends_on: Dates are real days from 2000 to ten years ahead.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#jobs"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "instructions": {
                    "type": "string",
                    "maxLength": 20000
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "instructions": "Gate code 4411. Dog in back yard."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      },
      "delete": {
        "operationId": "delete_jobs_by_id",
        "summary": "Jobs: delete",
        "description": "Delete a job made by mistake, with nothing billed or paid on it. Owner or admin key.\n\n**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#jobs"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/jobs/{id}/materials": {
      "get": {
        "operationId": "get_jobs_by_id_materials",
        "summary": "Jobs: materials",
        "description": "What to buy for the job: the same list as the quote's, from the job's own lines as sold. The prices are for the owner and admins; the rest of the office gets the list without money, and the field crew gets a 403.\n\n**Needs:** Schedule at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/jobs/01J.../materials\n\n200\n{\n  \"materials\": [ { \"name\": \"EXPERT Stain & Seal\", \"unit_label\": \"5-gal pail\", \"buy\": 3, \"cost_cents\": 35700, \"source\": \"line\", ... }, ... ],\n  \"total_cost_cents\": 39900,\n  \"price_book_cost_cents\": 0,\n  \"line_cost_cents\": 39900\n}\n```",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "read",
          "scope": "schedule:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#jobs"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/jobs/{id}/on-the-clock": {
      "get": {
        "operationId": "get_jobs_by_id_on_the_clock",
        "summary": "Jobs: on the clock",
        "description": "**Needs:** Schedule at read (or write).",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "read",
          "scope": "schedule:read"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/jobs/{id}/history": {
      "get": {
        "operationId": "get_jobs_by_id_history",
        "summary": "Jobs: history",
        "description": "**Needs:** Schedule at read (or write).",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "read",
          "scope": "schedule:read"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/jobs/{id}/archive": {
      "post": {
        "operationId": "post_jobs_by_id_archive",
        "summary": "Jobs: archive",
        "description": "Take it off the live list.\n\n**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#jobs"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/jobs/{id}/unarchive": {
      "post": {
        "operationId": "post_jobs_by_id_unarchive",
        "summary": "Jobs: unarchive",
        "description": "Put it back.\n\n**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#jobs"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/jobs/{id}/cancel-remaining": {
      "post": {
        "operationId": "post_jobs_by_id_cancel_remaining",
        "summary": "Jobs: cancel remaining",
        "description": "Cancel the visits still to come on a job.\n\n**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#jobs"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "cancelled": {
                      "type": "integer"
                    },
                    "ids": {
                      "type": "array"
                    }
                  }
                },
                "example": {
                  "cancelled": 0,
                  "ids": []
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/jobs/{id}/complete": {
      "post": {
        "operationId": "post_jobs_by_id_complete",
        "summary": "Jobs: complete",
        "description": "Mark the work done.\n\n**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#jobs"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "revisit_at": {}
                  }
                },
                "example": {
                  "ok": true,
                  "revisit_at": null
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/jobs/{id}/materials-final": {
      "post": {
        "operationId": "post_jobs_by_id_materials_final",
        "summary": "Jobs: materials final",
        "description": "**Needs:** Payments and money at write.",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "write",
          "scope": "payments_money:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/jobs/{id}/reopen": {
      "post": {
        "operationId": "post_jobs_by_id_reopen",
        "summary": "Jobs: reopen",
        "description": "Reopen a finished job.\n\n**Needs:** Schedule at write.\n\nExample from the developer page:\n\n```\nPOST /api/jobs/01M3JVF2D4HZ9B61Q6VK4SG6SY/reopen\n\n200\n{\n  \"ok\": true,\n  \"job\": {\n    \"id\": \"01M3JVF2D4HZ9B61Q6VK4SG6SY\",\n    \"tenant_id\": \"ten_flow\",\n    \"client_id\": \"01M3JVF1K1XS5ZJKJG6RF2TBXE\",\n    \"property_id\": \"01M3JVF27NYHM2G15CENR5J1SS\",\n    \"quote_id\": \"01M3JVF2AVEKN7S8Q00X6G7E05\",\n    \"request_id\": \"01M3JVF27ZWWRNNSY20Y3G8DZX\",\n    \"number\": 1,\n    \"title\": \"Fence staining - 200 ft, both sides\",\n    \"instructions\": \"Gate code 4411. Dog in back yard.\",\n    ...\n  }\n}\n```",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#jobs"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/jobs/{id}/lines/{lineId}/cost": {
      "put": {
        "operationId": "put_jobs_by_id_lines_by_lineId_cost",
        "summary": "Jobs: lines cost, set",
        "description": "What one line of a job costs you. Same body as the quote one. The profit card and any unpaid profit share follow right away. The owner or an admin.\n\n**Needs:** Payments and money at write.\n\nExample from the developer page:\n\n```\nPUT /api/jobs/01J.../lines/6bf8.../cost\n{\n  \"unit_cost_cents\": 38000,\n  \"cost_breakdown\": [\n    { \"name\": \"EXPERT Stain & Seal\", \"quantity\": 3, \"unit\": \"5-gal pail\", \"unit_cost_cents\": 12000 },\n    { \"name\": \"Brushes and rollers\", \"quantity\": 1, \"unit\": \"kit\", \"unit_cost_cents\": 2000 }\n  ]\n}\n\n200\n{\n  \"ok\": true,\n  \"name\": \"Fence staining\",\n  \"unit_cost_cents\": 38000,\n  \"cost_breakdown\": [ ... ],\n  \"line_cost_cents\": 38000,\n  \"materials_from\": \"cost_breakdown\",\n  \"summary\": \"Materials on Fence staining: EXPERT Stain & Seal, 3 x 5-gal pail at $120.00; Brushes and rollers, 1 x kit at $20.00 = $380.00\",\n  ...\n}\n```",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "write",
          "scope": "payments_money:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#jobs"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lineId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "unit_cost_cents": {
                    "type": "integer"
                  },
                  "cost_breakdown": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "quantity": {
                          "type": "integer"
                        },
                        "unit": {
                          "type": "string"
                        },
                        "unit_cost_cents": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "unit_cost_cents": 38000,
                "cost_breakdown": [
                  {
                    "name": "EXPERT Stain & Seal",
                    "quantity": 3,
                    "unit": "5-gal pail",
                    "unit_cost_cents": 12000
                  },
                  {
                    "name": "Brushes and rollers",
                    "quantity": 1,
                    "unit": "kit",
                    "unit_cost_cents": 2000
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/jobs/{id}/lines/{lineId}/crew-pay": {
      "put": {
        "operationId": "put_jobs_by_id_lines_by_lineId_crew_pay",
        "summary": "Jobs: lines crew pay, set",
        "description": "Crew pay on one line of a sold job. Same body as the quote one. What the crew is owed is worked out again right away: paid and held money stays as it is, and anything more is owed as its own row. Owner or admin key.\n\n**Needs:** Payments and money at write.",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "write",
          "scope": "payments_money:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#jobs"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lineId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pay_per_unit_cents": {
                    "type": "integer"
                  },
                  "split_mode": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "pay_per_unit_cents": 110,
                "split_mode": "split"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "line_item_id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "unit": {
                      "type": "string"
                    },
                    "quantity": {
                      "type": "integer"
                    },
                    "pay_per_unit_cents": {
                      "type": "integer"
                    },
                    "crew_pay_cents": {},
                    "split_mode": {
                      "type": "string"
                    },
                    "crew_pay_total_cents": {
                      "type": "integer"
                    },
                    "summary": {
                      "type": "string"
                    },
                    "measure_id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "line_item_id": "f9925d5f09c7632f25670d57a709da9a",
                  "name": "Fence staining",
                  "unit": "ln ft",
                  "quantity": 200,
                  "pay_per_unit_cents": 110,
                  "crew_pay_cents": null,
                  "split_mode": "split",
                  "crew_pay_total_cents": 22000,
                  "summary": "Crew pay on Fence staining: $1.10/ln ft x 200 = $220.00",
                  "measure_id": "d35d13ebd17b8099255784115ea36b94"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/jobs/{id}/invoice": {
      "post": {
        "operationId": "post_jobs_by_id_invoice",
        "summary": "Jobs: invoice",
        "description": "Turn the finished job into an invoice. Owner or admin key.\n\n**Needs:** Invoices at write.",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "write",
          "scope": "invoices:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#jobs"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "invoice_id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "invoice_id": "01M3JVF2GN2TGWK1TZH91F8DZY"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/jobs/{id}/expenses": {
      "post": {
        "operationId": "post_jobs_by_id_expenses",
        "summary": "Jobs: expenses",
        "description": "What was really bought for the job: `items` (up to 20), each `name`, `quantity`, `unit`, `unit_cost_cents` and optional `category` (\"materials\" when left out), plus `incurred_on`, `note`, `reimbursable`. One expense row per item. Materials rows replace the quote's estimate on the profit. An item may name a common expense (`preset_id`) and a stock version (`inventory_variant_id`); for a role with Inventory on, it takes that stock out, and with no `unit` the common expense's own unit is used. For a role that can't see job profit, a line that takes stock is priced from the common expense or the stock, whatever cost was sent, and its money is left out of the answer (`priced_from_stock: true`, no `total_cents`). With Inventory off, stock is left alone and the answer says so (`stock_left`, `stock_note`). Anyone who may log an expense; the `materials` summary in the answer is for the owner and admins.\n\n**Needs:** Invoices at write.\n\nExample from the developer page:\n\n```\nPOST /api/jobs/01J.../expenses\n{\n  \"items\": [\n    { \"name\": \"EXPERT Stain & Seal\", \"quantity\": 3, \"unit\": \"5-gal pail\", \"unit_cost_cents\": 18900 },\n    { \"name\": \"Gas\", \"quantity\": 1, \"unit_cost_cents\": 4000, \"category\": \"fuel\" }\n  ],\n  \"incurred_on\": \"2026-09-29\"\n}\n\n201\n{\n  \"ok\": true,\n  \"expenses\": [\n    { \"id\": \"01J...\", \"description\": \"EXPERT Stain & Seal, 3 x 5-gal pail at $189.00\", \"amount_cents\": 56700, \"category\": \"materials\", ... },\n    { \"id\": \"01J...\", \"description\": \"Gas\", \"amount_cents\": 4000, \"category\": \"fuel\", ... }\n  ],\n  \"total_cents\": 60700,\n  \"materials\": { \"quote_estimate_cents\": 39900, \"receipts_cents\": 56700, \"vs_estimate_cents\": 16800, \"estimated_materials_cents\": 0 }\n}\n```",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "write",
          "scope": "invoices:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#jobs"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "quantity": {
                          "type": "integer"
                        },
                        "unit": {
                          "type": "string"
                        },
                        "unit_cost_cents": {
                          "type": "integer"
                        }
                      }
                    }
                  },
                  "incurred_on": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "items": [
                  {
                    "name": "EXPERT Stain & Seal",
                    "quantity": 3,
                    "unit": "5-gal pail",
                    "unit_cost_cents": 18900
                  },
                  {
                    "name": "Gas",
                    "quantity": 1,
                    "unit_cost_cents": 4000,
                    "category": "fuel"
                  }
                ],
                "incurred_on": "2026-09-29"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/schedule": {
      "get": {
        "operationId": "get_schedule",
        "summary": "Schedule: read",
        "description": "The calendar for a range: `?from=` and `?to=` (ISO). Left out, it is the shop's today and the six days after.\n\n**Needs:** Schedule at read (or write).\n\n**Field limits (400 past them):** from and to, when sent, are dates or ISO times; the range is at most 93 days.\n\nExample from the developer page:\n\n```\nGET /api/schedule?from=2026-09-28T00:00:00.000Z&to=2026-10-05T00:00:00.000Z\n\n200\n{\n  \"visits\": [\n    {\n      \"id\": \"775ad5006416134b1a0c674ff7fa2706\",\n      \"tenant_id\": \"ten_flow\",\n      \"job_id\": \"01M3JVF2D4HZ9B61Q6VK4SG6SY\",\n      ...\n    },\n    ...\n  ],\n  \"unscheduled\": [],\n  \"unscheduled_total\": 0,\n  \"blackouts\": [],\n  \"users\": [\n    {\n      \"id\": \"usr_admin\",\n      \"name\": \"Jess Rowe\",\n      \"color\": \"#111\",\n      ...\n    },\n    ...\n  ],\n  \"range\": {\n    \"from\": \"2026-09-28T00:00:00.000Z\",\n    \"to\": \"2026-10-05T00:00:00.000Z\"\n  },\n  ...\n}\n```",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "read",
          "scope": "schedule:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#schedule"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/schedule/free": {
      "get": {
        "operationId": "get_schedule_free",
        "summary": "Schedule: free",
        "description": "Who is free on a day and half-day window.\n\n**Needs:** Schedule at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/schedule/free\n\n200\n{\n  \"day\": \"2026-09-27\",\n  \"window\": \"afternoon\",\n  \"people\": [\n    {\n      \"id\": \"usr_admin\",\n      \"name\": \"Jess Rowe\"\n    },\n    ...\n  ]\n}\n```",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "read",
          "scope": "schedule:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#schedule"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/schedule/my-day": {
      "get": {
        "operationId": "get_schedule_my_day",
        "summary": "Schedule: my day",
        "description": "What the key's person is running today.\n\n**Needs:** Schedule at read (or write).",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "read",
          "scope": "schedule:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#schedule"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "date": {
                      "type": "string"
                    },
                    "visits": {
                      "type": "array"
                    },
                    "running_timer": {},
                    "last_lat": {},
                    "last_lng": {},
                    "last_geo_at": {}
                  }
                },
                "example": {
                  "date": "2026-09-27",
                  "visits": [],
                  "running_timer": null,
                  "last_lat": null,
                  "last_lng": null,
                  "last_geo_at": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/schedule/weather": {
      "get": {
        "operationId": "get_schedule_weather",
        "summary": "Schedule: weather",
        "description": "The forecast for the shop's area, for the days on the board.\n\n**Needs:** Schedule at read (or write).",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "read",
          "scope": "schedule:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#schedule"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "place": {
                      "type": "string"
                    },
                    "days": {
                      "type": "array"
                    }
                  }
                },
                "example": {
                  "place": "",
                  "days": []
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/schedule/check": {
      "post": {
        "operationId": "post_schedule_check",
        "summary": "Schedule: check",
        "description": "See if a time collides before you book it.\n\n**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#schedule"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "starts_at": {
                    "type": "string"
                  },
                  "ends_at": {
                    "type": "string"
                  },
                  "assignees": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "starts_at": "2026-09-30T13:00:00.000Z",
                "ends_at": "2026-09-30T21:00:00.000Z",
                "assignees": [
                  "usr_pete"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "conflicts": {
                      "type": "array"
                    },
                    "ok": {
                      "type": "boolean"
                    },
                    "capacity": {
                      "type": "array"
                    },
                    "hours": {}
                  }
                },
                "example": {
                  "conflicts": [],
                  "ok": true,
                  "capacity": [],
                  "hours": null
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/schedule/find-time": {
      "post": {
        "operationId": "post_schedule_find_time",
        "summary": "Schedule: find time",
        "description": "Ask for the next open slot that fits: `duration_minutes`, optional `assignees`.\n\n**Needs:** Schedule at write.\n\nExample from the developer page:\n\n```\nPOST /api/schedule/find-time\n{\n  \"duration_minutes\": 480,\n  \"assignees\": [\n    \"usr_pete\"\n  ]\n}\n\n200\n{\n  \"slots\": [\n    {\n      \"starts_at\": \"2026-09-28T10:00:00.000Z\",\n      \"ends_at\": \"2026-09-28T18:00:00.000Z\"\n    },\n    ...\n  ],\n  \"duration_minutes\": 480\n}\n```",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#schedule"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "duration_minutes": {
                    "type": "integer"
                  },
                  "assignees": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "duration_minutes": 480,
                "assignees": [
                  "usr_pete"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/schedule/optimize": {
      "post": {
        "operationId": "post_schedule_optimize",
        "summary": "Schedule: optimize",
        "description": "Reorder the day's stops: `date`, optional `user_id`.\n\n**Needs:** Schedule at write.\n\nExample from the developer page:\n\n```\nPOST /api/schedule/optimize\n{\n  \"date\": \"2026-09-30\",\n  \"user_id\": \"usr_pete\"\n}\n\n200\n{\n  \"ordered\": [\n    \"775ad5006416134b1a0c674ff7fa2706\",\n    ...\n  ],\n  \"without_coordinates\": 1,\n  \"note\": \"Stops without coordinates were placed last\"\n}\n```",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#schedule"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "date": {
                    "type": "string"
                  },
                  "user_id": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "date": "2026-09-30",
                "user_id": "usr_pete"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/schedule/series": {
      "post": {
        "operationId": "post_schedule_series",
        "summary": "Schedule: series",
        "description": "Book a repeating visit: `job_id`, `starts_on`, `recurrence_rule`.\n\n**Needs:** Schedule at write.\n\nExample from the developer page:\n\n```\nPOST /api/schedule/series\n{\n  \"job_id\": \"01M3JVF2NW8SGJN2WFQF0WJ6R2\",\n  \"starts_on\": \"2026-10-04\",\n  \"recurrence_rule\": \"FREQ=WEEKLY;COUNT=3\",\n  \"assignees\": [\n    \"usr_pete\"\n  ],\n  \"force\": true\n}\n\n201\n{\n  \"visit_ids\": [\n    \"01M3JVF2P9NGF6RZ44GX5YMJMV\",\n    ...\n  ],\n  \"count\": 3,\n  \"label\": \"Weekly, 3 times\",\n  \"pattern\": \"Weekly, 3 times\",\n  \"truncated\": false,\n  \"hours\": null\n}\n```",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#schedule"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "job_id": {
                    "type": "string"
                  },
                  "starts_on": {
                    "type": "string"
                  },
                  "recurrence_rule": {
                    "type": "string"
                  },
                  "assignees": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "force": {
                    "type": "boolean"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "job_id": "01M3JVF2NW8SGJN2WFQF0WJ6R2",
                "starts_on": "2026-10-04",
                "recurrence_rule": "FREQ=WEEKLY;COUNT=3",
                "assignees": [
                  "usr_pete"
                ],
                "force": true
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/schedule/rain-day/preview": {
      "post": {
        "operationId": "post_schedule_rain_day_preview",
        "summary": "Schedule: rain day preview",
        "description": "**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/schedule/rain-day": {
      "post": {
        "operationId": "post_schedule_rain_day",
        "summary": "Schedule: rain day",
        "description": "**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/schedule/blackouts": {
      "get": {
        "operationId": "get_schedule_blackouts",
        "summary": "Schedule: blackouts",
        "description": "Days the shop is closed. Do not book over them.\n\n**Needs:** Schedule at read (or write).",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "read",
          "scope": "schedule:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#schedule"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array"
                },
                "example": []
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "post_schedule_blackouts",
        "summary": "Schedule: blackouts",
        "description": "Close the shop for a stretch: `starts_at`, `ends_at`, `reason`.\n\n**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#schedule"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "starts_at": {
                    "type": "string"
                  },
                  "ends_at": {
                    "type": "string"
                  },
                  "reason": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "starts_at": "2026-10-18T04:00:00.000Z",
                "ends_at": "2026-10-19T03:00:00.000Z",
                "reason": "Shop closed"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "01M3JVF2FJ6ZA0F950F3MG25GK"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/schedule/blackouts/{id}": {
      "delete": {
        "operationId": "delete_schedule_blackouts_by_id",
        "summary": "Schedule: blackouts, delete",
        "description": "**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/schedule/blackouts/{id}/remove": {
      "post": {
        "operationId": "post_schedule_blackouts_by_id_remove",
        "summary": "Schedule: blackouts remove",
        "description": "Open a closed day again.\n\n**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#schedule"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/schedule/events": {
      "get": {
        "operationId": "get_schedule_events",
        "summary": "Schedule: events",
        "description": "**Needs:** Schedule at read (or write).",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "read",
          "scope": "schedule:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "post_schedule_events",
        "summary": "Schedule: events",
        "description": "**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/schedule/events/{id}": {
      "get": {
        "operationId": "get_schedule_events_by_id",
        "summary": "Schedule: events, read one",
        "description": "**Needs:** Schedule at read (or write).",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "read",
          "scope": "schedule:read"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "operationId": "patch_schedule_events_by_id",
        "summary": "Schedule: events, update",
        "description": "**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      },
      "delete": {
        "operationId": "delete_schedule_events_by_id",
        "summary": "Schedule: events, delete",
        "description": "**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/schedule/events/{id}/remove": {
      "post": {
        "operationId": "post_schedule_events_by_id_remove",
        "summary": "Schedule: events remove",
        "description": "**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/schedule/visits": {
      "post": {
        "operationId": "post_schedule_visits",
        "summary": "Schedule: visits",
        "description": "Put a visit on the board: `client_id`, `property_id`, optional `job_id` or `request_id`, `starts_at`, `ends_at`, `assignees`, `kind` (`assessment` for an estimate visit). A clash answers 409 with the conflicts; send `force: true` to book anyway.\n\n**Needs:** Schedule at write.\n\n**Field limits (400 past them):** Names up to 200 characters, titles 300, notes, messages and instructions 20,000. Ids are text, as Chalk hands them back; a number where an id goes is refused. starts_at is from 2000 to ten years ahead; an ends_at needs a starts_at. routing_order is a whole number.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#schedule"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string"
                  },
                  "property_id": {
                    "type": "string"
                  },
                  "job_id": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string",
                    "maxLength": 300
                  },
                  "starts_at": {
                    "type": "string"
                  },
                  "ends_at": {
                    "type": "string"
                  },
                  "assignees": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "force": {
                    "type": "boolean"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "client_id": "01M3JVF1K1XS5ZJKJG6RF2TBXE",
                "property_id": "01M3JVF27NYHM2G15CENR5J1SS",
                "job_id": "01M3JVF2D4HZ9B61Q6VK4SG6SY",
                "title": "Second coat",
                "starts_at": "2026-10-01T13:00:00.000Z",
                "ends_at": "2026-10-01T17:00:00.000Z",
                "assignees": [
                  "usr_pete"
                ],
                "force": true
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "capacity": {
                      "type": "array"
                    },
                    "hours": {}
                  }
                },
                "example": {
                  "id": "01M3JVF2F24D97CZWC96JNQSBA",
                  "capacity": [],
                  "hours": null
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/schedule/visits/bulk": {
      "post": {
        "operationId": "post_schedule_visits_bulk",
        "summary": "Schedule: visits bulk",
        "description": "Unschedule or cancel several at once: `action` (`unschedule` or `cancel`) with `visit_ids`, or a `day` (and `assignee_id`, `outdoor`).\n\n**Needs:** Schedule at write.\n\nExample from the developer page:\n\n```\nPOST /api/schedule/visits/bulk\n{\n  \"action\": \"unschedule\",\n  \"visit_ids\": [\n    \"01M3JVF2P9NGF6RZ44GX5YMJMV\"\n  ]\n}\n\n200\n{\n  \"ok\": true,\n  \"action\": \"unschedule\",\n  \"did\": [\n    \"01M3JVF2P9NGF6RZ44GX5YMJMV\",\n    ...\n  ],\n  \"skipped\": []\n}\n```",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#schedule"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string"
                  },
                  "visit_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "action": "unschedule",
                "visit_ids": [
                  "01M3JVF2P9NGF6RZ44GX5YMJMV"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/schedule/visits/{id}": {
      "patch": {
        "operationId": "patch_schedule_visits_by_id",
        "summary": "Schedule: visits, update",
        "description": "Move it, reassign it (`assignees`), change the window. The crew's pay follows the crew.\n\n**Needs:** Schedule at write.\n\n**Field limits (400 past them):** Names up to 200 characters, titles 300, notes, messages and instructions 20,000. starts_at is from 2000 to ten years ahead; an ends_at needs a starts_at. routing_order is a whole number.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#schedule"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "starts_at": {
                    "type": "string"
                  },
                  "ends_at": {
                    "type": "string"
                  },
                  "assignees": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "force": {
                    "type": "boolean"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "starts_at": "2026-09-30T13:00:00.000Z",
                "ends_at": "2026-09-30T21:00:00.000Z",
                "assignees": [
                  "usr_pete"
                ],
                "force": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "capacity": {
                      "type": "array"
                    },
                    "hours": {}
                  }
                },
                "example": {
                  "ok": true,
                  "capacity": [],
                  "hours": null
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      },
      "delete": {
        "operationId": "delete_schedule_visits_by_id",
        "summary": "Schedule: visits, delete",
        "description": "Take a visit off for good.\n\n**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#schedule"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/schedule/visits/{id}/brief": {
      "get": {
        "operationId": "get_schedule_visits_by_id_brief",
        "summary": "Schedule: visits brief",
        "description": "**Needs:** Schedule at read (or write).",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "read",
          "scope": "schedule:read"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/schedule/visits/{id}/complete": {
      "post": {
        "operationId": "post_schedule_visits_by_id_complete",
        "summary": "Schedule: visits complete",
        "description": "The stop is done.\n\n**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#schedule"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/schedule/visits/{id}/uncomplete": {
      "post": {
        "operationId": "post_schedule_visits_by_id_uncomplete",
        "summary": "Schedule: visits uncomplete",
        "description": "Undo a stop marked done by mistake.\n\n**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#schedule"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/schedule/visits/{id}/cancel-future": {
      "post": {
        "operationId": "post_schedule_visits_by_id_cancel_future",
        "summary": "Schedule: visits cancel future",
        "description": "Cancel this visit and the rest of its series.\n\n**Needs:** Schedule at write.\n\nExample from the developer page:\n\n```\nPOST /api/schedule/visits/01M3JVF2P9VVCR45F7F6N17ZSR/cancel-future\n\n200\n{\n  \"cancelled\": 2,\n  \"ids\": [\n    \"01M3JVF2P9VVCR45F7F6N17ZSR\",\n    ...\n  ]\n}\n```",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#schedule"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/schedule/visits/{id}/shift-future": {
      "post": {
        "operationId": "post_schedule_visits_by_id_shift_future",
        "summary": "Schedule: visits shift future",
        "description": "Move this visit and the rest of its series by `delta_ms` (an hour is 3600000).\n\n**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#schedule"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "delta_ms": {
                    "type": "integer"
                  },
                  "force": {
                    "type": "boolean"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "delta_ms": 3600000,
                "force": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "updated": {
                      "type": "integer"
                    },
                    "notified": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "updated": 3,
                  "notified": false
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/schedule/visits/{id}/confirm": {
      "post": {
        "operationId": "post_schedule_visits_by_id_confirm",
        "summary": "Schedule: visits confirm",
        "description": "Tell the customer they are on the board. Needs send. A text to a number marked wrong (a call logged as \"Phone number is incorrect\", or marked on the client page) is answered 409 and nothing is sent, unless you send `confirm_wrong_number: true` with `wrong_number_seen` set to the 409's `wrong_number.seen`; the 409 carries `wrong_number` (the number, when it was marked, by whom, and `seen`) and `confirm_with`. The yes covers the marks it names and no more: a number marked again later, or another number, is asked again, so an integration that always sends the yes never texts a newly marked number by itself. Email is never held. Send a new `Idempotency-Key` with the yes (the body changed).\n\n**Needs:** Schedule at write, and Can message customers.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:send"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "send",
          "scope": "schedule:send"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#schedule"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "channel": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "channel": "sms"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "channel": {
                      "type": "string"
                    },
                    "to": {
                      "type": "string"
                    },
                    "body": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "channel": "sms",
                  "to": "+18645550199",
                  "body": "Hi Dale, you are booked in with Upstate Painting Co on Wednesday, September 30 at 9:00 AM for..."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_send"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/schedule/visits/{id}/on-my-way": {
      "post": {
        "operationId": "post_schedule_visits_by_id_on_my_way",
        "summary": "Schedule: visits on my way",
        "description": "Text that the crew is rolling. Needs send.\n\n**Needs:** Schedule at write, and Can message customers.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:send"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "send",
          "scope": "schedule:send"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#schedule"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "minutes": {
                    "type": "integer"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "minutes": 20
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "already_sent": {
                      "type": "boolean"
                    },
                    "minutes": {
                      "type": "integer"
                    },
                    "sent_at": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "already_sent": false,
                  "minutes": 20,
                  "sent_at": "2026-09-28T01:53:26.225Z"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_send"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/job-types": {
      "get": {
        "operationId": "get_job_types",
        "summary": "Job types: read",
        "description": "The kinds of work this shop does.\n\n**Needs:** Schedule at read (or write).",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "read",
          "scope": "schedule:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array"
                },
                "example": []
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "post_job_types",
        "summary": "Job types: create",
        "description": "Add a kind of work: `name`. Owner or admin key.\n\n**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "name": "Fence staining"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "01M3JVF2SJ1VK2T3K334GBET31"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/job-types/{id}": {
      "patch": {
        "operationId": "patch_job_types_by_id",
        "summary": "Job types: update",
        "description": "Change one. Owner or admin key.\n\n**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "name": "Fence staining and sealing"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      },
      "delete": {
        "operationId": "delete_job_types_by_id",
        "summary": "Job types: delete",
        "description": "**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/forms/templates": {
      "get": {
        "operationId": "get_forms_templates",
        "summary": "Forms: templates",
        "description": "The shop's checklists.\n\n**Needs:** Schedule at read (or write).",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "read",
          "scope": "schedule:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#checklists"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array"
                },
                "example": []
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "post_forms_templates",
        "summary": "Forms: templates",
        "description": "Add one: `name`, `fields[]` (`label`, `kind`).\n\n**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#checklists"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "fields": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "label": {
                          "type": "string"
                        },
                        "kind": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "name": "Fence walkthrough",
                "fields": [
                  {
                    "label": "Gate latched",
                    "kind": "check"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "01M3JVF2FRCAK14ZWGN9785K0W"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/forms/templates/{id}": {
      "patch": {
        "operationId": "patch_forms_templates_by_id",
        "summary": "Forms: templates, update",
        "description": "Rename one or change its fields.\n\n**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#checklists"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "name": "Fence walkthrough, final"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      },
      "delete": {
        "operationId": "delete_forms_templates_by_id",
        "summary": "Forms: templates, delete",
        "description": "**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/forms/submissions": {
      "get": {
        "operationId": "get_forms_submissions",
        "summary": "Forms: submissions",
        "description": "Filled-in checklists, newest first. `?visit_id=`.\n\n**Needs:** Schedule at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/forms/submissions?visit_id=775ad5006416134b1a0c674ff7fa2706\n\n200\n[\n  {\n    \"id\": \"01M3JVF2FV5J3MGNMS12SJPJ67\",\n    \"tenant_id\": \"ten_flow\",\n    \"template_id\": \"01M3JVF2FRCAK14ZWGN9785K0W\",\n    \"visit_id\": \"775ad5006416134b1a0c674ff7fa2706\",\n    \"job_id\": null,\n    \"answers\": {\n      \"Gate latched\": true\n    },\n    \"completed_at\": \"2026-09-28T01:53:26.011Z\",\n    \"completed_by\": \"usr_owner\",\n    ...\n  }\n]\n```",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "read",
          "scope": "schedule:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#checklists"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "post_forms_submissions",
        "summary": "Forms: submissions",
        "description": "Fill one in: `template_id`, `visit_id` or `job_id`, `answers`, `completed`.\n\n**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#checklists"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "template_id": {
                    "type": "string"
                  },
                  "visit_id": {
                    "type": "string"
                  },
                  "answers": {
                    "type": "object",
                    "properties": {
                      "Gate latched": {
                        "type": "boolean"
                      }
                    }
                  },
                  "completed": {
                    "type": "boolean"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "template_id": "01M3JVF2FRCAK14ZWGN9785K0W",
                "visit_id": "775ad5006416134b1a0c674ff7fa2706",
                "answers": {
                  "Gate latched": true
                },
                "completed": true
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "01M3JVF2FV5J3MGNMS12SJPJ67"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/forms/visits/{visitId}/checklists": {
      "get": {
        "operationId": "get_forms_visits_by_visitId_checklists",
        "summary": "Forms: visits checklists",
        "description": "The checklists on one visit.\n\n**Needs:** Schedule at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/forms/visits/775ad5006416134b1a0c674ff7fa2706/checklists\n\n200\n[\n  {\n    \"id\": \"01M3JVF2FSSKTWZRMD7FM4WAT1\",\n    \"template_id\": \"01M3JVF2FRCAK14ZWGN9785K0W\",\n    \"name\": \"Fence walkthrough\",\n    \"fields\": [\n      {\n        \"label\": \"Gate latched\",\n        \"kind\": \"check\"\n      },\n      ...\n    ],\n    \"active\": 1,\n    \"default_for\": null\n  }\n]\n```",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "read",
          "scope": "schedule:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#checklists"
        },
        "parameters": [
          {
            "name": "visitId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "post_forms_visits_by_visitId_checklists",
        "summary": "Forms: visits checklists",
        "description": "Put a checklist on a visit: `template_id`. The office, or somebody on the visit.\n\n**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#checklists"
        },
        "parameters": [
          {
            "name": "visitId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "template_id": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "template_id": "01M3JVF2FRCAK14ZWGN9785K0W"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/forms/visits/{visitId}/checklists/{id}": {
      "delete": {
        "operationId": "delete_forms_visits_by_visitId_checklists_by_id",
        "summary": "Forms: visits checklists, delete",
        "description": "Take a checklist off a visit. The office only.\n\n**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#checklists"
        },
        "parameters": [
          {
            "name": "visitId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/timers": {
      "get": {
        "operationId": "get_timers",
        "summary": "Timers: read",
        "description": "**Needs:** Schedule at read (or write).",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "read",
          "scope": "schedule:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/timers/start": {
      "post": {
        "operationId": "post_timers_start",
        "summary": "Timers: start",
        "description": "**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/timers/{id}/stop": {
      "post": {
        "operationId": "post_timers_by_id_stop",
        "summary": "Timers: stop",
        "description": "Clock a running punch out now. Your own, or anybody's for the owner or Spending on Full. Send `\"expect_running\": true` to get a 409 when it had already ended (somebody else clocked them out first) instead of a quiet `already_stopped`. A clock that has run for more than a day is a 400: it needs the time they really left, set on Pay in the app. A punch in a locked pay week is a 400. The answer carries `ended_at`, which Undo sends back. When the owner or somebody with Spending on Full clocks somebody else's punch out, its history says who, and Undo can take it back. Their own clock-out writes that line only with `\"undoable\": true`.\n\n**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#schedule"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expect_running": {
                    "type": "boolean"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "expect_running": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "seconds": {
                      "type": "integer"
                    },
                    "ended_at": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "seconds": 33000,
                  "ended_at": "2026-10-29T20:12:00.000Z"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/timers/running": {
      "get": {
        "operationId": "get_timers_running",
        "summary": "Timers: running",
        "description": "Everyone on the clock right now, across the shop and whatever week their clock started in, oldest first: the punch `id`, the person, `kind` (`work`, `drive` or `break`), `started_at` and the job. No rates. Only when the person the key acts as is the owner or has Spending on Full, the people who may clock others out; anyone else gets a 403.\n\n**Needs:** Schedule at read (or write).",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "read",
          "scope": "schedule:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#schedule"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "running": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "user_id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "color": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "started_at": {
                            "type": "string"
                          },
                          "job_id": {
                            "type": "string"
                          },
                          "visit_id": {},
                          "job_number": {
                            "type": "integer"
                          },
                          "number_label": {},
                          "job_title": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "now": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "running": [
                    {
                      "id": "01M3JVF2G9NP39GEZNQ3MG54A6",
                      "user_id": "usr_dee",
                      "name": "Dee Whitfield",
                      "color": "#2f7d5b",
                      "kind": "work",
                      "started_at": "2026-10-29T11:02:00.000Z",
                      "job_id": "01M3JVF2CQ9FYR26B9EDAT0549",
                      "visit_id": null,
                      "job_number": 1042,
                      "number_label": null,
                      "job_title": "Smith exterior"
                    }
                  ],
                  "now": "2026-10-29T20:12:00.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/timers/{id}/undo-stop": {
      "post": {
        "operationId": "post_timers_by_id_undo_stop",
        "summary": "Timers: undo stop",
        "description": "Undo a clock-out within a minute of it: the punch runs again from the same start with no end, and its hours and pay are worked out again. Send `ended_at`, the end the clock-out answered with. The owner or Spending on Full, or a person who set when their own punch ended. A clock-out can be undone when it was made by the owner or somebody with Spending on Full, or was a person setting when their own punch ended; a crew member's own plain clock-out leaves nothing to undo (409). Also a 409 once anything else has happened to the punch (an edit, a different end, the person pressing clock out themselves), when the clock-out changed more than the end, once they are on the clock again or have a newer punch, once their hour or day pay was marked paid, or after the minute. A 400 when its pay week is locked. The clock-out and the undo both stay in the punch's history.\n\n**Needs:** Schedule at write.",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "write",
          "scope": "schedule:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#schedule"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ended_at": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "ended_at": "2026-10-29T20:12:00.000Z"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "id": {
                      "type": "string"
                    },
                    "running": {
                      "type": "boolean"
                    },
                    "user_id": {
                      "type": "string"
                    },
                    "started_at": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string"
                    },
                    "job_id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "id": "01M3JVF2G9NP39GEZNQ3MG54A6",
                  "running": true,
                  "user_id": "usr_dee",
                  "started_at": "2026-10-29T11:02:00.000Z",
                  "kind": "work",
                  "job_id": "01M3JVF2CQ9FYR26B9EDAT0549"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/desk": {
      "get": {
        "operationId": "get_desk",
        "summary": "Desk: read",
        "description": "**Needs:** Schedule at read (or write).",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "read",
          "scope": "schedule:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/map-tiles/{z}/{x}/{y}": {
      "get": {
        "operationId": "get_map_tiles_by_z_by_x_by_y",
        "summary": "Map tiles: read one",
        "description": "**Needs:** Schedule at read (or write).",
        "tags": [
          "Schedule"
        ],
        "security": [
          {
            "chalkKey": [
              "schedule:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "schedule",
          "kind": "read",
          "scope": "schedule:read"
        },
        "parameters": [
          {
            "name": "z",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "y",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file.",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "image/png"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_schedule_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/invoices": {
      "get": {
        "operationId": "get_invoices",
        "summary": "Invoices: read",
        "description": "Invoices, newest first. `?status=` (`unpaid` is everything still owed, including a draft that has taken a payment: its `status` stays `draft`, it was never sent, so never chase it), `?archived=1`, `?limit=` and `?before=`.\n\n**Needs:** Invoices at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/invoices?limit=20\n\n200\n[\n  {\n    \"id\": \"01M3JVF2GN2TGWK1TZH91F8DZY\",\n    \"tenant_id\": \"ten_flow\",\n    \"client_id\": \"01M3JVF1K1XS5ZJKJG6RF2TBXE\",\n    \"property_id\": \"01M3JVF27NYHM2G15CENR5J1SS\",\n    \"job_id\": \"01M3JVF2D4HZ9B61Q6VK4SG6SY\",\n    \"number\": 1,\n    \"subject\": \"Fence staining - 200 ft, both sides\",\n    ...\n  }\n]\n```",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "read",
          "scope": "invoices:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#invoices"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "post_invoices",
        "summary": "Invoices: create",
        "description": "Write an invoice by hand: `client_id`, `property_id`, `line_items[]`.\n\n**Needs:** Invoices at write.\n\n**Field limits (400 past them):** Names up to 200 characters, titles 300, notes, messages and instructions 20,000. Ids are text, as Chalk hands them back; a number where an id goes is refused. line_items, when sent, is a list of line objects.",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "write",
          "scope": "invoices:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#invoices"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string"
                  },
                  "property_id": {
                    "type": "string"
                  },
                  "line_items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "quantity": {
                          "type": "integer"
                        },
                        "unit_price_cents": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "client_id": "01M3JVF1K1XS5ZJKJG6RF2TBXE",
                "property_id": "01M3JVF27NYHM2G15CENR5J1SS",
                "line_items": [
                  {
                    "name": "Deck",
                    "quantity": 1,
                    "unit_price_cents": 300000
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "number": {
                      "type": "integer"
                    },
                    "subtotal_cents": {
                      "type": "integer"
                    },
                    "discount_cents": {
                      "type": "integer"
                    },
                    "tax_cents": {
                      "type": "integer"
                    },
                    "total_cents": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "id": "01M3JVF2TDTY7ACMRAJM7TSJMN",
                  "number": 3,
                  "subtotal_cents": 300000,
                  "discount_cents": 0,
                  "tax_cents": 0,
                  "total_cents": 300000
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/invoices/aging": {
      "get": {
        "operationId": "get_invoices_aging",
        "summary": "Invoices: aging",
        "description": "Who is late, for chase copy. `not_sent` is what is left on drafts that have taken a payment: owed, never sent, so never late and never chased. It is in `total_cents`, and those drafts are in `invoices` with `status` `draft`.\n\n**Needs:** Invoices at read (or write).",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "read",
          "scope": "invoices:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#invoices"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "buckets": {
                      "type": "object",
                      "properties": {
                        "current": {
                          "type": "integer"
                        },
                        "d1_30": {
                          "type": "integer"
                        },
                        "d31_60": {
                          "type": "integer"
                        },
                        "d61_90": {
                          "type": "integer"
                        },
                        "d90_plus": {
                          "type": "integer"
                        },
                        "not_sent": {
                          "type": "integer"
                        }
                      }
                    },
                    "total_cents": {
                      "type": "integer"
                    },
                    "invoices": {
                      "type": "array"
                    }
                  }
                },
                "example": {
                  "buckets": {
                    "current": 0,
                    "d1_30": 0,
                    "d31_60": 0,
                    "d61_90": 0,
                    "d90_plus": 0,
                    "not_sent": 0
                  },
                  "total_cents": 0,
                  "invoices": []
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/invoices/send-wording": {
      "get": {
        "operationId": "get_invoices_send_wording",
        "summary": "Invoices: send wording",
        "description": "**Needs:** Invoices at read (or write).",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "read",
          "scope": "invoices:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/invoices/bulk": {
      "post": {
        "operationId": "post_invoices_bulk",
        "summary": "Invoices: bulk",
        "description": "**Needs:** Invoices at write.",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "write",
          "scope": "invoices:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/invoices/remind": {
      "post": {
        "operationId": "post_invoices_remind",
        "summary": "Invoices: remind",
        "description": "Nudge the slow ones: `ids`. Needs send. Every reminder is worked out first: if any would be texted to a number marked wrong, the answer is 409, no reminder goes, and its `wrong_number.invoices` names them; send `confirm_wrong_number: true` with `wrong_number_seen` set to its `wrong_number.seen` to send them all anyway, or leave those ids out. Email is never held.\n\n**Needs:** Invoices at write, and Can message customers.",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:send"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "send",
          "scope": "invoices:send"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#invoices"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "ids": [
                  "01M3JVF2GN2TGWK1TZH91F8DZY"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "queued": {
                      "type": "integer"
                    },
                    "skipped": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "queued": 1,
                  "skipped": 0
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_send"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/invoices/{id}": {
      "get": {
        "operationId": "get_invoices_by_id",
        "summary": "Invoices: read one",
        "description": "One invoice, with payments. Lines nest their measurements as on quotes. An invoice never carries crew pay of its own: the crew is paid from the job. `opens` is every time the customer opened it, as on a quote, by kind of device: `{ count, phone, tablet, computer, capped, last_at, last_device, last_app, recent[] }`, where `recent` is the newest 50 as `{ at, device, app }`, `device` is `phone`, `tablet` or `computer`, and `app` names an in-app browser (`facebook`, `messenger`, `instagram`, `tiktok`, `linkedin`, `google`) or is `null`. Only opens after it was sent, never the office looking (Preview, See what they see, or any browser signed in to the shop), and a reload on the same kind of device within 30 minutes counts once. At most 200 are kept (`capped: true`). No address or browser details are stored. `null` before opens were tracked.\n\n**Needs:** Invoices at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/invoices/01M3JVF2GN2TGWK1TZH91F8DZY\n\n200\n{\n  \"invoice\": {\n    \"id\": \"01M3JVF2GN2TGWK1TZH91F8DZY\",\n    \"tenant_id\": \"ten_flow\",\n    \"client_id\": \"01M3JVF1K1XS5ZJKJG6RF2TBXE\",\n    \"property_id\": \"01M3JVF27NYHM2G15CENR5J1SS\",\n    \"job_id\": \"01M3JVF2D4HZ9B61Q6VK4SG6SY\",\n    \"number\": 1,\n    \"subject\": \"Fence staining - 200 ft, both sides\",\n    ...\n  },\n  \"line_items\": [\n    {\n      \"id\": \"5d3c608e201069bd3ccb322ecb88c589\",\n      \"tenant_id\": \"ten_flow\",\n      \"parent_type\": \"invoice\",\n      ...\n    },\n    ...\n  ],\n  \"line_item_measures\": [\n    {\n      \"id\": \"964c50b4680d215a53aaadb13c08b45d\",\n      \"tenant_id\": \"ten_flow\",\n      \"line_item_id\": \"5d3c608e201069bd3ccb322ecb88c589\",\n      ...\n    },\n    ...\n  ],\n  \"payments\": [],\n  \"notes\": [],\n  \"property\": {\n    \"id\": \"01M3JVF27NYHM2G15CENR5J1SS\",\n    \"tenant_id\": \"ten_flow\",\n    \"client_id\": \"01M3JVF1K1XS5ZJKJG6RF2TBXE\",\n    \"name\": null,\n    \"street1\": \"22 Suber Rd\",\n    \"street2\": null,\n    \"city\": \"Greer\",\n    ...\n  },\n  \"attachments\": [],\n  ...\n}\n```",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "read",
          "scope": "invoices:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#invoices"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "operationId": "patch_invoices_by_id",
        "summary": "Invoices: update",
        "description": "Change lines or due date while it is unpaid.\n\n**Needs:** Invoices at write.\n\n**Field limits (400 past them):** Names up to 200 characters, titles 300, notes, messages and instructions 20,000. line_items, when sent, is a list of line objects. issued_on and due_on are real days from 2000 to ten years ahead.",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "write",
          "scope": "invoices:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#invoices"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "due_on": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "due_on": "2026-10-16"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "subtotal_cents": {
                      "type": "integer"
                    },
                    "discount_cents": {
                      "type": "integer"
                    },
                    "tax_cents": {
                      "type": "integer"
                    },
                    "total_cents": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "subtotal_cents": 15000,
                  "discount_cents": 0,
                  "tax_cents": 0,
                  "total_cents": 15000
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      },
      "delete": {
        "operationId": "delete_invoices_by_id",
        "summary": "Invoices: delete",
        "description": "Delete an unpaid invoice with no payments. If money landed, archive it instead.\n\n**Needs:** Invoices at write.",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "write",
          "scope": "invoices:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#invoices"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/invoices/{id}/history": {
      "get": {
        "operationId": "get_invoices_by_id_history",
        "summary": "Invoices: history",
        "description": "**Needs:** Invoices at read (or write).",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "read",
          "scope": "invoices:read"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/invoices/{id}/pdf": {
      "get": {
        "operationId": "get_invoices_by_id_pdf",
        "summary": "Invoices: pdf",
        "description": "The bill as a PDF.\n\n**Needs:** Invoices at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/invoices/01M3JVF2GN2TGWK1TZH91F8DZY/pdf\n\n200\n(PDF, 2989 bytes)\n```",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "read",
          "scope": "invoices:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#invoices"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file.",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "application/pdf"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/invoices/{id}/receipt.pdf": {
      "get": {
        "operationId": "get_invoices_by_id_receipt_pdf",
        "summary": "Invoices: receipt pdf",
        "description": "The receipt after it is paid.\n\n**Needs:** Invoices at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/invoices/01M3JVF2GN2TGWK1TZH91F8DZY/receipt.pdf\n\n200\n(PDF, 3691 bytes)\n```",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "read",
          "scope": "invoices:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#invoices"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file.",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "application/pdf"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/invoices/{id}/archive": {
      "post": {
        "operationId": "post_invoices_by_id_archive",
        "summary": "Invoices: archive",
        "description": "Take it off the live list. Paid invoices archive. They do not delete.\n\n**Needs:** Invoices at write.",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "write",
          "scope": "invoices:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#invoices"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/invoices/{id}/unarchive": {
      "post": {
        "operationId": "post_invoices_by_id_unarchive",
        "summary": "Invoices: unarchive",
        "description": "Put it back.\n\n**Needs:** Invoices at write.",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "write",
          "scope": "invoices:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#invoices"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/invoices/{id}/card-fee": {
      "post": {
        "operationId": "post_invoices_by_id_card_fee",
        "summary": "Invoices: card fee",
        "description": "**Needs:** Invoices at write.",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "write",
          "scope": "invoices:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      },
      "delete": {
        "operationId": "delete_invoices_by_id_card_fee",
        "summary": "Invoices: card fee, delete",
        "description": "**Needs:** Invoices at write.",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "write",
          "scope": "invoices:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/invoices/{id}/link": {
      "post": {
        "operationId": "post_invoices_by_id_link",
        "summary": "Invoices: link",
        "description": "Mint the pay link without sending it. Needs send: the link outlives the key.\n\n**Needs:** Invoices at write, and Can message customers.",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:send"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "send",
          "scope": "invoices:send"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#invoices"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "hub_url": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "hub_url": "https://app.chalkcrm.com/hub/01M3JVF2H3MMB1RCD27CQM75AR"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_send"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/invoices/{id}/send-preview": {
      "post": {
        "operationId": "post_invoices_by_id_send_preview",
        "summary": "Invoices: send preview",
        "description": "**Needs:** Invoices at write, and Can message customers.",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:send"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "send",
          "scope": "invoices:send"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_send"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/invoices/{id}/send": {
      "post": {
        "operationId": "post_invoices_by_id_send",
        "summary": "Invoices: send",
        "description": "Send the pay link: `channel` `\"sms\"`, `\"email\"` (the default) or `\"both\"`, optional `to` and `message`. With `\"both\"`, each channel takes its own optional `sms_to` / `email_to` and `sms_message` / `email_message`, with the same pay link, and the answer's `sent` lists each channel with `status` `sent`, `queued` or `failed` (a text that had to go by email instead is `failed`). `sms_to` must be a phone number and `email_to` an email address; both go with `\"both\"` only. With `\"both\"`, a single `to`, or a `message` without `message_channel`, is answered 400. Needs send. A text to a number marked wrong (a call logged as \"Phone number is incorrect\", or marked on the client page) is answered 409 and nothing is sent, unless you send `confirm_wrong_number: true` with `wrong_number_seen` set to the 409's `wrong_number.seen`; the 409 carries `wrong_number` (the number, when it was marked, by whom, and `seen`) and `confirm_with`. The yes covers the marks it names and no more: a number marked again later, or another number, is asked again, so an integration that always sends the yes never texts a newly marked number by itself. Email is never held. Send a new `Idempotency-Key` with the yes (the body changed). The answer carries `saved_email` only when the send saved an address as the customer's email: an email typed for a customer with none on file, never the shop's or a team member's address, and never one that had failed or been blocked by the time the send answered. Only a person sending from the app saves one; a send made with an API key never saves an address, so its answer has no `saved_email`.\n\n**Needs:** Invoices at write, and Can message customers.",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:send"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "send",
          "scope": "invoices:send"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#invoices"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "boolean"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "email": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "hub_url": {
                      "type": "string"
                    },
                    "channel": {
                      "type": "string"
                    },
                    "to": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "hub_url": "https://app.chalkcrm.com/hub/01M3JVF2H3MMB1RCD27CQM75AR",
                  "channel": "email",
                  "to": "dale@example.com"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_send"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/invoices/{id}/send-receipt": {
      "post": {
        "operationId": "post_invoices_by_id_send_receipt",
        "summary": "Invoices: send receipt",
        "description": "Send the receipt for a paid invoice: `channel`. Needs send. A text to a number marked wrong (a call logged as \"Phone number is incorrect\", or marked on the client page) is answered 409 and nothing is sent, unless you send `confirm_wrong_number: true` with `wrong_number_seen` set to the 409's `wrong_number.seen`; the 409 carries `wrong_number` (the number, when it was marked, by whom, and `seen`) and `confirm_with`. The yes covers the marks it names and no more: a number marked again later, or another number, is asked again, so an integration that always sends the yes never texts a newly marked number by itself. Email is never held. Send a new `Idempotency-Key` with the yes (the body changed). An invoice paid in full whose receipt already went, or the same receipt to the same address a moment ago, is also answered 409 and nothing is sent: `error` says which, with the day the receipt went.\n\n**Needs:** Invoices at write, and Can message customers.",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:send"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "send",
          "scope": "invoices:send"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#invoices"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "channel": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "channel": "email"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "receipt_url": {
                      "type": "string"
                    },
                    "channel": {
                      "type": "string"
                    },
                    "to": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "receipt_url": "https://app.chalkcrm.com/hub/01M3JVF2H3MMB1RCD27CQM75AR/receipt",
                  "channel": "email",
                  "to": "dale@example.com"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_send"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/invoices/{id}/receipt-preview": {
      "post": {
        "operationId": "post_invoices_by_id_receipt_preview",
        "summary": "Invoices: receipt preview",
        "description": "**Needs:** Invoices at write, and Can message customers.",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:send"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "send",
          "scope": "invoices:send"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_send"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/installments/{invoiceId}": {
      "get": {
        "operationId": "get_installments_by_invoiceId",
        "summary": "Installments: read one",
        "description": "The payment plan on an invoice, if it has one.\n\n**Needs:** Invoices at read (or write).",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "read",
          "scope": "invoices:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#invoices"
        },
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array"
                },
                "example": []
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "put": {
        "operationId": "put_installments_by_invoiceId",
        "summary": "Installments: set",
        "description": "Set a payment plan: `installments[]` of `label`, `amount_cents`, `due_on`. Owner or admin key.\n\n**Needs:** Invoices at write.",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "write",
          "scope": "invoices:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#invoices"
        },
        "parameters": [
          {
            "name": "invoiceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "installments": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "label": {
                          "type": "string"
                        },
                        "amount_cents": {
                          "type": "integer"
                        },
                        "due_on": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "installments": [
                  {
                    "label": "Deposit",
                    "amount_cents": 100000,
                    "due_on": "2026-09-29"
                  },
                  {
                    "label": "On completion",
                    "amount_cents": 200000,
                    "due_on": "2026-10-28"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "count": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "count": 2
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/payments": {
      "get": {
        "operationId": "get_payments",
        "summary": "Payments: read",
        "description": "Money that has come in, newest first. `?limit=` and `?before=` (a `received_at`).\n\n**Needs:** Invoices at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/payments?limit=20\n\n200\n[\n  {\n    \"id\": \"01M3JVF2HK94KKFQW5GBG02A0T\",\n    \"tenant_id\": \"ten_flow\",\n    \"client_id\": \"01M3JVF1K1XS5ZJKJG6RF2TBXE\",\n    \"invoice_id\": \"01M3JVF2GN2TGWK1TZH91F8DZY\",\n    \"quote_id\": null,\n    \"amount_cents\": 25000,\n    \"tip_cents\": 0,\n    \"fee_cents\": 0,\n    ...\n  }\n]\n```",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "read",
          "scope": "invoices:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#invoices"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "post_payments",
        "summary": "Payments: create",
        "description": "Write down money that came in by hand: `invoice_id` (or `quote_id` for a deposit), `amount_cents`, `method` (`cash`, `check` or `other`), optional `received_at` (a real date, `2026-10-02`, or a full ISO time; anything else is refused), `note`, `tip_cents`. A key never records a card or sets processor fields. `send_receipt: true` needs send; that receipt is never texted to a number marked wrong (it goes by email when they have one, or not at all). Without send, no receipt or review request goes, whatever the date. While a bank payment from the customer is still clearing on it, the answer is 409 unless you send `confirm_pending: true`, so the bill is not paid twice by mistake. For a check, send its number as `check_number` (it goes into the note as \"Check #1041\"). The same check number for the same amount already on the same job is answered 409 and nothing is recorded, unless you send `confirm_duplicate_check: true` (one check split across two bills of one job is the real case), so a retry never writes the same check twice by itself. That 409's `duplicate_check.seen` is how many copies are on the job, and its words name it; send it back as `duplicate_check_seen` with the yes and the yes covers those copies only, so if there are more by then you are asked again instead. A yes sent without `duplicate_check_seen` covers no copy on the job: it records nothing there, so an integration that sends the yes on every call never writes the same check twice on a retry. The same number on file elsewhere is unaffected (its count is 0). Send a new `Idempotency-Key` with the yes (the body changed), so a retry of it is never recorded twice either. The same number already on file for this customer for another amount or another job is recorded, and the answer carries a `warning` that says where; send `confirm_duplicate_check: true` to say you know.\n\n**Needs:** Invoices at write.\n\n**Field limits (400 past them):** amount_cents is whole cents, more than zero. method is card, ach, bank, cash, check or other (any case). received_at is a real day from 2000 to a year ahead. A note is up to 20,000 characters.",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "write",
          "scope": "invoices:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#invoices"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "invoice_id": {
                    "type": "string"
                  },
                  "amount_cents": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000000000
                  },
                  "method": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "invoice_id": "01M3JVF2GN2TGWK1TZH91F8DZY",
                "amount_cents": 48625,
                "method": "cash"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "fee_cents": {
                      "type": "integer"
                    },
                    "net_cents": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "id": "01M3JVF2Q06CENQX5XT5XBYNW5",
                  "fee_cents": 0,
                  "net_cents": 48625
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/expenses": {
      "get": {
        "operationId": "get_expenses",
        "summary": "Expenses: read",
        "description": "Spend, newest first: `?job_id=`, `?category=`, `?from=`/`?to=`, `?limit=`.\n\n**Needs:** Invoices at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/expenses?limit=20\n\n200\n{\n  \"expenses\": [\n    {\n      \"id\": \"01M3JVF2G9NP39GEZNQ3MG54A6\",\n      \"tenant_id\": \"ten_flow\",\n      \"job_id\": \"01M3JVF2D4HZ9B61Q6VK4SG6SY\",\n      \"user_id\": \"usr_owner\",\n      ...\n    },\n    ...\n  ],\n  \"total_cents\": 18000,\n  \"count\": 1,\n  \"more\": false\n}\n```",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "read",
          "scope": "invoices:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#pay"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "post_expenses",
        "summary": "Expenses: create",
        "description": "Log a spend, the way the receipt camera does: `amount_cents`, `description`, `category`, `incurred_on`, optional `job_id`. Anyone on the crew may log one. To log items by name, quantity and unit cost on a job, use `POST /api/jobs/:id/expenses`.\n\n**Needs:** Invoices at write.\n\n**Field limits (400 past them):** amount_cents is whole cents, from 1 to 100000000 ($1,000,000). incurred_on is a real day, not after today. category is the shop's own word, up to 60 characters. A note is up to 20,000 characters.",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "write",
          "scope": "invoices:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#pay"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amount_cents": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100000000
                  },
                  "category": {
                    "type": "string",
                    "maxLength": 60
                  },
                  "description": {
                    "type": "string"
                  },
                  "incurred_on": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "amount_cents": 2500,
                "category": "fuel",
                "description": "Gas",
                "incurred_on": "2026-09-28"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "amount_cents": {
                      "type": "integer"
                    },
                    "description": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "01M3JVF2T5CN6HCNPZ91ZCZV9T",
                  "amount_cents": 2500,
                  "description": "Gas"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/expenses/summary": {
      "get": {
        "operationId": "get_expenses_summary",
        "summary": "Expenses: summary",
        "description": "This month and last, by category.\n\n**Needs:** Invoices at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/expenses/summary\n\n200\n{\n  \"this_month\": {\n    \"v\": 18000,\n    \"n\": 1\n  },\n  \"last_month\": {\n    \"v\": 0,\n    \"n\": 0\n  },\n  \"this_month_by_category\": [\n    {\n      \"category\": \"materials\",\n      \"v\": 18000,\n      \"n\": 1\n    },\n    ...\n  ],\n  \"this_month_materials_cents\": 18000,\n  \"by_category_90d\": [],\n  \"reimbursable\": [],\n  \"reimbursable_total_cents\": 0\n}\n```",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "read",
          "scope": "invoices:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#pay"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/expenses/{id}": {
      "patch": {
        "operationId": "patch_expenses_by_id",
        "summary": "Expenses: update",
        "description": "Fix one. The office, or the person who logged it.\n\n**Needs:** Invoices at write.\n\n**Field limits (400 past them):** amount_cents is whole cents, from 1 to 100000000 ($1,000,000). incurred_on is a real day, not after today. category up to 60 characters.",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "write",
          "scope": "invoices:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#pay"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amount_cents": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100000000
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "amount_cents": 17500
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "amount_cents": {
                      "type": "integer"
                    },
                    "description": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "amount_cents": 17500,
                  "description": "Stain, 5 gal"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      },
      "delete": {
        "operationId": "delete_expenses_by_id",
        "summary": "Expenses: delete",
        "description": "Take one off. Owner or admin key. It can be put back.\n\n**Needs:** Invoices at write.",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "write",
          "scope": "invoices:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#pay"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/expenses/{id}/restore": {
      "post": {
        "operationId": "post_expenses_by_id_restore",
        "summary": "Expenses: restore",
        "description": "Put it back. Owner or admin key.\n\n**Needs:** Invoices at write.",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "write",
          "scope": "invoices:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#pay"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/expense-presets": {
      "get": {
        "operationId": "get_expense_presets",
        "summary": "Expense presets: read",
        "description": "Saved spends: five gallons of stain, a dump run.\n\n**Needs:** Invoices at read (or write).",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "read",
          "scope": "invoices:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array"
                },
                "example": []
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "post_expense_presets",
        "summary": "Expense presets: create",
        "description": "Save one: `name`, `unit_amount_cents`, `category`. Owner or admin key.\n\n**Needs:** Invoices at write.",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "write",
          "scope": "invoices:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "unit_amount_cents": {
                    "type": "integer"
                  },
                  "category": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "name": "Stain, 5 gal",
                "unit_amount_cents": 18000,
                "category": "materials"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "01M3JVF2SQNJAX8PHKTHE4MQGD"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/expense-presets/{id}": {
      "patch": {
        "operationId": "patch_expense_presets_by_id",
        "summary": "Expense presets: update",
        "description": "Change one. Owner or admin key.\n\n**Needs:** Invoices at write.",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "write",
          "scope": "invoices:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "unit_amount_cents": {
                    "type": "integer"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "unit_amount_cents": 18500
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      },
      "delete": {
        "operationId": "delete_expense_presets_by_id",
        "summary": "Expense presets: delete",
        "description": "**Needs:** Invoices at write.",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "write",
          "scope": "invoices:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/payments/in-transit": {
      "get": {
        "operationId": "get_payments_in_transit",
        "summary": "Payments: in transit",
        "description": "Money on its way to the bank, after fees. With Stripe connected it is Stripe's own balance and payouts (`source: \"stripe\"`); otherwise an estimate from recent payments (`source: \"estimate\"`). Bank payments the bank has not cleared yet are under `clearing`, never in the total (Stripe's own `stripe.balance_cents` does hold them). `fallback_reason` says why an estimate was used; `next_payout`, `stripe` and dates can be null. `on_its_way_cents` and its older name `in_transit_net_cents` are after fees. `in_transit_cents` is the same money before fees, as it always was: on the estimate what the customers paid, and with Stripe, Stripe's figure plus the fee Stripe took on each payment still pending in it (a payout already started counts as it pays).\n\n**Needs:** Payments and money at read (or write).",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "read",
          "scope": "payments_money:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#invoices"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "source": {
                      "type": "string"
                    },
                    "estimated": {
                      "type": "boolean"
                    },
                    "on_its_way_cents": {
                      "type": "integer"
                    },
                    "in_transit_cents": {
                      "type": "integer"
                    },
                    "in_transit_net_cents": {
                      "type": "integer"
                    },
                    "next_payout": {
                      "type": "object",
                      "properties": {
                        "amount_cents": {
                          "type": "integer"
                        },
                        "arrival_date": {
                          "type": "string"
                        },
                        "from": {
                          "type": "string"
                        }
                      }
                    },
                    "stripe": {
                      "type": "object",
                      "properties": {
                        "balance_cents": {
                          "type": "integer"
                        },
                        "available_cents": {
                          "type": "integer"
                        },
                        "pending_cents": {
                          "type": "integer"
                        },
                        "payouts": {
                          "type": "array"
                        }
                      }
                    },
                    "clearing": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "integer"
                        },
                        "cents": {
                          "type": "integer"
                        },
                        "net_cents": {
                          "type": "integer"
                        },
                        "in_stripe_balance_cents": {
                          "type": "integer"
                        },
                        "expected_date": {
                          "type": "string"
                        },
                        "payments": {
                          "type": "array"
                        }
                      }
                    },
                    "payments": {
                      "type": "array"
                    }
                  }
                },
                "example": {
                  "source": "stripe",
                  "estimated": false,
                  "on_its_way_cents": 322982,
                  "in_transit_cents": 332744,
                  "in_transit_net_cents": 322982,
                  "next_payout": {
                    "amount_cents": 322982,
                    "arrival_date": "2026-10-27",
                    "from": "stripe_balance"
                  },
                  "stripe": {
                    "balance_cents": 504572,
                    "available_cents": 0,
                    "pending_cents": 504572,
                    "payouts": []
                  },
                  "clearing": {
                    "count": 1,
                    "cents": 182090,
                    "net_cents": 181590,
                    "in_stripe_balance_cents": 181590,
                    "expected_date": "2026-10-27",
                    "payments": []
                  },
                  "payments": []
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/payments/cards/{clientId}": {
      "get": {
        "operationId": "get_payments_cards_by_clientId",
        "summary": "Payments: cards, read one",
        "description": "See that a card is on file. Charging it is a person in the loop.\n\n**Needs:** Payments and money at read (or write).",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "read",
          "scope": "payments_money:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#invoices"
        },
        "parameters": [
          {
            "name": "clientId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "available": {
                      "type": "boolean"
                    },
                    "cards": {
                      "type": "array"
                    }
                  }
                },
                "example": {
                  "available": false,
                  "cards": []
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/payments/{id}/refund-split": {
      "get": {
        "operationId": "get_payments_by_id_refund_split",
        "summary": "Payments: refund split",
        "description": "**Needs:** Payments and money at read (or write).",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "read",
          "scope": "payments_money:read"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/payments/cards/{clientId}/{pmId}": {
      "delete": {
        "operationId": "delete_payments_cards_by_clientId_by_pmId",
        "summary": "Payments: cards, delete",
        "description": "**Needs:** Payments and money at write (the money permission).",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:money"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "money",
          "scope": "payments_money:money"
        },
        "parameters": [
          {
            "name": "clientId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "pmId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_money"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/payments/charge-card": {
      "post": {
        "operationId": "post_payments_charge_card",
        "summary": "Payments: charge card",
        "description": "**Needs:** Payments and money at write (the money permission).",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:money"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "money",
          "scope": "payments_money:money"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_money"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/payments/checkout-link": {
      "post": {
        "operationId": "post_payments_checkout_link",
        "summary": "Payments: checkout link",
        "description": "**Needs:** Payments and money at write, and Can message customers.",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:send"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "send",
          "scope": "payments_money:send"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_send"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/payments/{id}/refund": {
      "post": {
        "operationId": "post_payments_by_id_refund",
        "summary": "Payments: refund",
        "description": "**Needs:** Payments and money at write (the money permission).",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:money"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "money",
          "scope": "payments_money:money"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_money"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/payments/{id}/bounce": {
      "post": {
        "operationId": "post_payments_by_id_bounce",
        "summary": "Payments: bounce",
        "description": "**Needs:** Payments and money at write (the money permission).",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:money"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "money",
          "scope": "payments_money:money"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_money"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/payments/{id}/unbounce": {
      "post": {
        "operationId": "post_payments_by_id_unbounce",
        "summary": "Payments: unbounce",
        "description": "**Needs:** Payments and money at write (the money permission).",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:money"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "money",
          "scope": "payments_money:money"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_money"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/invoices/{id}/bad-debt": {
      "post": {
        "operationId": "post_invoices_by_id_bad_debt",
        "summary": "Invoices: bad debt",
        "description": "**Needs:** Payments and money at write (the money permission).",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:money"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "money",
          "scope": "payments_money:money"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_money"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/invoices/{id}/undo-bad-debt": {
      "post": {
        "operationId": "post_invoices_by_id_undo_bad_debt",
        "summary": "Invoices: undo bad debt",
        "description": "**Needs:** Payments and money at write (the money permission).",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:money"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "money",
          "scope": "payments_money:money"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_money"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/payouts": {
      "get": {
        "operationId": "get_payouts",
        "summary": "Payouts: read",
        "description": "Every pay row: `?status=` (`pending`, `paid`, `held`), `?payee_user_id=`, `?job_id=` (every pay row on one job, and the owed totals for just that job). Each row carries `source_key` and `pay_kind`. A row added by hand has `source_key` null. A row from Chalk's own pay rules has one, and `pay_kind` says which: `measurement` (crew pay from the quote's lines), `revenue`, `salesperson`, `profit`, `hour`, `day`. Chalk posts crew pay by itself: when a quote's lines carry crew pay, each tech paid per project who is on the job's visits gets a row with `source_key` `measurement:` and their user id, and the pay waits as `Crew` (`measurement:crew`) until somebody is on a visit. It is raised to the shop's crew pay minimum per job (Pay setup), for each tech; a tech already paid on the job is not topped up to a minimum set since. It shows as in progress (`in_progress` 1) until the job is finished, or until what the tech's pay timing waits on; the same goes for a flat or percent split added by hand for a tech paid per project (not on a recurring or archived job, which never finishes). A split added by hand for the work (role `subcontractor`, `crew` or `technician`, more than $0, not archived; several add up) for a tech paid per project replaces Chalk's row for them when it is at least half of what Chalk works out for them on that job, whichever came first: Chalk posts none, or takes off its own row if it is still open (owed, not on hold, not paid, its amount not set by hand), with a line in History. Under half (gas money, say), both stay. The half is judged for a tech when their own split for the work is added, changed, moved, removed or restored; after that a crew change, a new price or a teammate's split keeps what is there, except that Chalk's open row is taken off whenever the split covers all of it. Chalk's row that is already paid, on hold or set by hand is never touched, so the split is extra and the answer warns; released from hold, marked unpaid, restored or given back its worked-out amount, it is taken off again if a split covers it (that answer says so with `removed` and a `warning`), and when it stays next to a split of at least half of it the answer warns that it is owed on top. When the split is removed, archived, moved to somebody else or cut under half, the tech gets Chalk's row back. A split with another role is never crew pay: `other` and `referral` are extra and owed at once, and `salesperson` follows sales pay. A bulk archive or delete of such rows is refused past 20 jobs at a time. Before a script adds pay by hand, read `GET /api/payouts?job_id=` so the same pay is not added twice. `owed[]` groups what is open by person, most owed now first: `owed_now_cents` is what Mark all paid would pay them, with pay on hold (`held_cents`) left out; `total_cents` is everything open, on hold included. `owed_now_total_cents` adds up `owed_now_cents`.\n\n**Needs:** Payments and money at read (or write), or Crew pay at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/payouts?status=pending\n\n200\n{\n  \"payouts\": [\n    {\n      \"id\": \"01M3JVF2EYA5XCAJ9QAR3C6SY8\",\n      \"tenant_id\": \"ten_flow\",\n      \"job_id\": \"01M3JVF2D4HZ9B61Q6VK4SG6SY\",\n      \"payee_user_id\": \"usr_pete\",\n      ...\n    },\n    ...\n  ],\n  \"owed\": [\n    {\n      \"payee_user_id\": \"usr_pete\",\n      \"payee_name\": \"Pete Barnes\",\n      \"payee_role\": \"crew\",\n      \"total_cents\": 25000,\n      \"owed_now_cents\": 25000,\n      \"held_cents\": 0,\n      ...\n    },\n    ...\n  ],\n  \"pending_total_cents\": 25000,\n  \"owed_now_total_cents\": 25000\n}\n```",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:read"
            ]
          },
          {
            "chalkKey": [
              "crew_pay:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "read",
          "scope": "payments_money:read",
          "crew_pay": {
            "kind": "read",
            "scope": "crew_pay:read",
            "guards": []
          }
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#pay"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_read_or_crew_pay_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "post_payouts",
        "summary": "Payouts: create",
        "description": "Add pay owed to somebody on a job, the way Add split on the job does. `job_id`, `basis` (`flat` with `amount_cents`, `percent` of the job or `profit` share with `rate_bp`), and either `payee_user_id` (a teammate) or `payee_name` (somebody with no login). Optional `payee_role` (default `subcontractor`) and `note`. It is always added as owed, never as paid. Needs write on Crew pay, or on Payments and money. Without Payments and money, a flat row for the Crew with the role `crew` is refused: Chalk keeps that for crew pay worked out from measurements, so name the person or use another role. Nobody but the owner adds pay for themselves, and a key acting as a role never adds pay for the person who made it. Read `GET /api/payouts?job_id=` first. A split for the work for a tech paid per project (role `subcontractor`, `crew` or `technician`) that is at least half of their crew pay from the quote's lines on that job replaces Chalk's row for them: the answer carries `counts_as_crew_pay`, `replaced_crew_pay_cents` when it took Chalk's open row off, and a `warning` in words. When Chalk's row stays (it is already paid, on hold or its amount was set by hand, or the split is under half of it), the split is still added, on top, and the answer carries a `warning` and `auto_crew_pay` (`id`, `amount_cents`, `source_key`).\n\n**Needs:** Payments and money at write (the money permission), or Crew pay at write.\n\nWith Crew pay: the split is always added, and stays, owed. A body with `status` other than `pending`, or with `paid`, `paid_at` or `paid_method`, is refused.",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:money"
            ]
          },
          {
            "chalkKey": [
              "crew_pay:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "money",
          "scope": "payments_money:money",
          "crew_pay": {
            "kind": "write",
            "scope": "crew_pay:write",
            "guards": [
              "crew_pay_new"
            ]
          }
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#pay"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "job_id": {
                    "type": "string"
                  },
                  "basis": {
                    "type": "string"
                  },
                  "amount_cents": {
                    "type": "integer"
                  },
                  "payee_user_id": {
                    "type": "string"
                  },
                  "payee_role": {
                    "type": "string"
                  },
                  "note": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "job_id": "01M3JVF2D4HZ9B61Q6VK4SG6SY",
                "basis": "flat",
                "amount_cents": 45000,
                "payee_user_id": "usr_pete",
                "payee_role": "subcontractor",
                "note": "Fence, two coats"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "amount_cents": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "id": "01M3JVF2EYA5XCAJ9QAR3C6SY8",
                  "amount_cents": 45000
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_money_or_crew_pay_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/payouts/{id}": {
      "get": {
        "operationId": "get_payouts_by_id",
        "summary": "Payouts: read one",
        "description": "One pay row, with the same fields as a row of the list, archived ones too (`archived_at` set). A person who sees only their own pay gets 404 for anybody else's. Needs read on Crew pay, or on Payments and money.\n\n**Needs:** Payments and money at read (or write), or Crew pay at read (or write).",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:read"
            ]
          },
          {
            "chalkKey": [
              "crew_pay:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "read",
          "scope": "payments_money:read",
          "crew_pay": {
            "kind": "read",
            "scope": "crew_pay:read",
            "guards": []
          }
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#pay"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "job_id": {
                      "type": "string"
                    },
                    "payee_user_id": {
                      "type": "string"
                    },
                    "payee_name": {
                      "type": "string"
                    },
                    "payee_role": {
                      "type": "string"
                    },
                    "basis": {
                      "type": "string"
                    },
                    "rate_bp": {},
                    "amount_cents": {
                      "type": "integer"
                    },
                    "note": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "source_key": {},
                    "pay_kind": {},
                    "overridden": {
                      "type": "integer"
                    },
                    "archived_at": {},
                    "job_number": {
                      "type": "integer"
                    },
                    "job_title": {
                      "type": "string"
                    },
                    "client_name": {
                      "type": "string"
                    },
                    "payable_now": {
                      "type": "integer"
                    },
                    "in_progress": {
                      "type": "integer"
                    },
                    "in_progress_why": {}
                  }
                },
                "example": {
                  "id": "01M3JVF2EYA5XCAJ9QAR3C6SY8",
                  "job_id": "01M3JVF2D4HZ9B61Q6VK4SG6SY",
                  "payee_user_id": "usr_pete",
                  "payee_name": "Pete Barnes",
                  "payee_role": "subcontractor",
                  "basis": "flat",
                  "rate_bp": null,
                  "amount_cents": 45000,
                  "note": "Fence, two coats",
                  "status": "pending",
                  "source_key": null,
                  "pay_kind": null,
                  "overridden": 0,
                  "archived_at": null,
                  "job_number": 29,
                  "job_title": "Fence and deck",
                  "client_name": "Dana Whitfield",
                  "payable_now": 1,
                  "in_progress": 0,
                  "in_progress_why": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_read_or_crew_pay_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "operationId": "patch_payouts_by_id",
        "summary": "Payouts: update",
        "description": "Change a split that is still owed: `amount_cents`, `note`, the payee (`payee_user_id` or `payee_name`), `payee_role`, or `basis` with `rate_bp`. The amount is worked out again the way adding a split works it out: a percent or profit split takes a new `rate_bp`, and to set dollars on one send `basis` `flat` with `amount_cents`. It never marks pay paid or unpaid, holds it, archives it or moves it to another job: `status`, `paid`, `paid_at`, `paid_method`, `archived_at`, `job_id` and other fields are refused. A paid row stays put (409, or 403 for a Crew pay key) and an archived one is restored first. `amount_cents` and `rate_bp` are whole numbers. Pay from Chalk's own rules takes only `amount_cents`, as a hand-set amount beside what Chalk worked out, and needs Payments and money. With Crew pay only a split that is still owed, was added by hand and has no amount set by a person in Chalk. Answers the row as `GET /api/payouts/:id` does (with the same `warning`, `auto_crew_pay`, `counts_as_crew_pay` or `replaced_crew_pay_cents` as adding a split, when they apply), and History names the key. Moving a split for the work to somebody else gives the first tech Chalk's crew pay back and replaces the new one's.\n\n**Needs:** Payments and money at write (the money permission), or Crew pay at write.\n\nWith Crew pay: only a split that is owed (not paid, not on hold), was added by hand (not from Chalk's own pay rules, and not the flat Crew row the ledger keeps for crew pay from measurements) and has no amount a person set by hand. Anything else is refused.\n\nWith Crew pay: the split is always added, and stays, owed. A body with `status` other than `pending`, or with `paid`, `paid_at` or `paid_method`, is refused.",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:money"
            ]
          },
          {
            "chalkKey": [
              "crew_pay:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "money",
          "scope": "payments_money:money",
          "crew_pay": {
            "kind": "write",
            "scope": "crew_pay:write",
            "guards": [
              "crew_pay_row",
              "crew_pay_new"
            ]
          }
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#pay"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amount_cents": {
                    "type": "integer"
                  },
                  "note": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "amount_cents": 48000,
                "note": "Fence, two coats and the gate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "job_id": {
                      "type": "string"
                    },
                    "payee_user_id": {
                      "type": "string"
                    },
                    "payee_name": {
                      "type": "string"
                    },
                    "basis": {
                      "type": "string"
                    },
                    "amount_cents": {
                      "type": "integer"
                    },
                    "note": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "source_key": {}
                  }
                },
                "example": {
                  "id": "01M3JVF2EYA5XCAJ9QAR3C6SY8",
                  "job_id": "01M3JVF2D4HZ9B61Q6VK4SG6SY",
                  "payee_user_id": "usr_pete",
                  "payee_name": "Pete Barnes",
                  "basis": "flat",
                  "amount_cents": 48000,
                  "note": "Fence, two coats and the gate",
                  "status": "pending",
                  "source_key": null
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_money_or_crew_pay_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      },
      "delete": {
        "operationId": "delete_payouts_by_id",
        "summary": "Payouts: delete",
        "description": "Remove a split. With Crew pay only a split that is still owed, was added by hand and has no amount set by a person in Chalk. A paid or held row, one from Chalk's own pay rules, or the Crew's pay from measurements is refused.\n\n**Needs:** Payments and money at write (the money permission), or Crew pay at write.\n\nWith Crew pay: only a split that is owed (not paid, not on hold), was added by hand (not from Chalk's own pay rules, and not the flat Crew row the ledger keeps for crew pay from measurements) and has no amount a person set by hand. Anything else is refused.",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:money"
            ]
          },
          {
            "chalkKey": [
              "crew_pay:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "money",
          "scope": "payments_money:money",
          "crew_pay": {
            "kind": "write",
            "scope": "crew_pay:write",
            "guards": [
              "crew_pay_row"
            ]
          }
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#pay"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_money_or_crew_pay_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/jobs/{id}/payouts": {
      "post": {
        "operationId": "post_jobs_by_id_payouts",
        "summary": "Jobs: payouts",
        "description": "The same as `POST /api/payouts`, with the job in the address. Same body without `job_id` (a `job_id` naming another job is refused), same checks, same answer. Needs write on Crew pay, or on Payments and money.\n\n**Needs:** Payments and money at write (the money permission), or Crew pay at write.\n\nWith Crew pay: the split is always added, and stays, owed. A body with `status` other than `pending`, or with `paid`, `paid_at` or `paid_method`, is refused.",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:money"
            ]
          },
          {
            "chalkKey": [
              "crew_pay:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "money",
          "scope": "payments_money:money",
          "crew_pay": {
            "kind": "write",
            "scope": "crew_pay:write",
            "guards": [
              "crew_pay_new"
            ]
          }
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#pay"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "basis": {
                    "type": "string"
                  },
                  "amount_cents": {
                    "type": "integer"
                  },
                  "payee_user_id": {
                    "type": "string"
                  },
                  "note": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "basis": "flat",
                "amount_cents": 18000,
                "payee_user_id": "usr_juan",
                "note": "Gate, extra coat"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "amount_cents": {
                      "type": "integer"
                    },
                    "warning": {
                      "type": "string"
                    },
                    "auto_crew_pay": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "amount_cents": {
                          "type": "integer"
                        },
                        "source_key": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "id": "01M3JVF2FQ0B7W9T2Z5C8KX4ND",
                  "amount_cents": 18000,
                  "warning": "Chalk already has $180.00 of crew pay for Juan Ortiz on this job from the quote's lines, and $180.00 of it is already paid, so it stays and this adds more on top. Remove one if it is the same pay.",
                  "auto_crew_pay": {
                    "id": "01M3JVF2E3J8M6P1V4R7T0WQ5S",
                    "amount_cents": 18000,
                    "source_key": "measurement:usr_juan"
                  }
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_money_or_crew_pay_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/payouts/bulk": {
      "post": {
        "operationId": "post_payouts_bulk",
        "summary": "Payouts: bulk",
        "description": "**Needs:** Payments and money at write (the money permission).",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:money"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "money",
          "scope": "payments_money:money"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_money"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/payouts/pay-all": {
      "post": {
        "operationId": "post_payouts_pay_all",
        "summary": "Payouts: pay all",
        "description": "**Needs:** Payments and money at write (the money permission).",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:money"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "money",
          "scope": "payments_money:money"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_money"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/payouts/{id}/paid": {
      "post": {
        "operationId": "post_payouts_by_id_paid",
        "summary": "Payouts: paid",
        "description": "**Needs:** Payments and money at write (the money permission).",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:money"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "money",
          "scope": "payments_money:money"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_money"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/payouts/{id}/unpaid": {
      "post": {
        "operationId": "post_payouts_by_id_unpaid",
        "summary": "Payouts: unpaid",
        "description": "**Needs:** Payments and money at write (the money permission).",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:money"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "money",
          "scope": "payments_money:money"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_money"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/payouts/{id}/hold": {
      "post": {
        "operationId": "post_payouts_by_id_hold",
        "summary": "Payouts: hold",
        "description": "**Needs:** Payments and money at write (the money permission).",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:money"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "money",
          "scope": "payments_money:money"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_money"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/payouts/{id}/unhold": {
      "post": {
        "operationId": "post_payouts_by_id_unhold",
        "summary": "Payouts: unhold",
        "description": "**Needs:** Payments and money at write (the money permission).",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:money"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "money",
          "scope": "payments_money:money"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_money"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/payouts/{id}/override": {
      "post": {
        "operationId": "post_payouts_by_id_override",
        "summary": "Payouts: override",
        "description": "**Needs:** Payments and money at write (the money permission).",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:money"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "money",
          "scope": "payments_money:money"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_money"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/payouts/{id}/clear-override": {
      "post": {
        "operationId": "post_payouts_by_id_clear_override",
        "summary": "Payouts: clear override",
        "description": "**Needs:** Payments and money at write (the money permission).",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:money"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "money",
          "scope": "payments_money:money"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_money"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/payouts/{id}/archive": {
      "post": {
        "operationId": "post_payouts_by_id_archive",
        "summary": "Payouts: archive",
        "description": "Archive a split so it is no longer owed. Answers `{ \"ok\": true, \"changed\": 1 }`, or `changed: 0` when nothing moved. Crew pay has the same limits as removing one.\n\n**Needs:** Payments and money at write, or Crew pay at write.\n\nWith Crew pay: only a split that is owed (not paid, not on hold), was added by hand (not from Chalk's own pay rules, and not the flat Crew row the ledger keeps for crew pay from measurements) and has no amount a person set by hand. Anything else is refused.",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:write"
            ]
          },
          {
            "chalkKey": [
              "crew_pay:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "write",
          "scope": "payments_money:write",
          "crew_pay": {
            "kind": "write",
            "scope": "crew_pay:write",
            "guards": [
              "crew_pay_row"
            ]
          }
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#pay"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_write_or_crew_pay_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/payouts/{id}/unarchive": {
      "post": {
        "operationId": "post_payouts_by_id_unarchive",
        "summary": "Payouts: unarchive",
        "description": "Put an archived split back. Crew pay has the same limits as removing one.\n\n**Needs:** Payments and money at write, or Crew pay at write.\n\nWith Crew pay: only a split that is owed (not paid, not on hold), was added by hand (not from Chalk's own pay rules, and not the flat Crew row the ledger keeps for crew pay from measurements) and has no amount a person set by hand. Anything else is refused.",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:write"
            ]
          },
          {
            "chalkKey": [
              "crew_pay:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "write",
          "scope": "payments_money:write",
          "crew_pay": {
            "kind": "write",
            "scope": "crew_pay:write",
            "guards": [
              "crew_pay_row"
            ]
          }
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#pay"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_write_or_crew_pay_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/payroll": {
      "get": {
        "operationId": "get_payroll",
        "summary": "Payroll: read",
        "description": "Pay > Owed: each person and what they are owed now (`owed[]`: pending, held, payable), plus pay setup totals. `owed_now_cents` is the figure Who is owed shows: what Mark all paid would pay, with pay on hold (`held_cents`) left out. `total_cents` is everything open, on hold included. `owed[]` comes most owed now first, and `owed_now_total_cents` adds up `owed_now_cents`.\n\n**Needs:** Payments and money at read (or write), or Crew pay at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/payroll\n\n200\n{\n  \"setup\": {\n    \"overhead_bp\": 0,\n    \"fixed_job_cost_cents\": 0,\n    \"pay_timing\": \"week_end\",\n    \"early_pay_enabled\": \"0\",\n    \"wages_since\": \"2026-09-27T04:00:00.000Z\",\n    \"commission_scope_ready\": true\n  },\n  \"no_job_time\": [],\n  \"people\": [\n    {\n      \"id\": \"usr_admin\",\n      \"name\": \"Jess Rowe\",\n      \"color\": \"#111\",\n      ...\n    },\n    ...\n  ],\n  \"owed\": [\n    {\n      \"payee_user_id\": \"usr_pete\",\n      \"payee_name\": \"Pete Barnes\",\n      \"payee_role\": \"crew\",\n      \"total_cents\": 25000,\n      \"owed_now_cents\": 25000,\n      \"held_cents\": 0,\n      ...\n    },\n    ...\n  ],\n  \"recent_paid\": [],\n  \"pending_total_cents\": 25000,\n  \"owed_now_total_cents\": 25000,\n  \"stats\": {\n    \"paid_30d_cents\": 0,\n    \"paid_prev_30d_cents\": 0,\n    \"paid_30d_delta_cents\": 0,\n    \"paid_30d_delta_pct\": null,\n    \"held_cents\": 0,\n    \"due_this_week_cents\": 25000\n  }\n}\n```",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:read"
            ]
          },
          {
            "chalkKey": [
              "crew_pay:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "read",
          "scope": "payments_money:read",
          "crew_pay": {
            "kind": "read",
            "scope": "crew_pay:read",
            "guards": []
          }
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#pay"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_read_or_crew_pay_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/payroll/setup": {
      "put": {
        "operationId": "put_payroll_setup",
        "summary": "Payroll: setup, set",
        "description": "**Needs:** Payments and money at write.",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "write",
          "scope": "payments_money:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/payroll/people/{id}": {
      "get": {
        "operationId": "get_payroll_people_by_id",
        "summary": "Payroll: people, read one",
        "description": "One person's pay: their setup and every owed or paid row, with the job each came from.\n\n**Needs:** Payments and money at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/payroll/people/usr_pete\n\n200\n{\n  \"person\": {\n    \"id\": \"usr_pete\",\n    \"name\": \"Pete Barnes\",\n    \"color\": \"#224\",\n    \"role\": \"field\",\n    \"active\": 1,\n    \"pay_type\": \"per_project\",\n    ...\n  },\n  \"payouts\": [\n    {\n      \"id\": \"01M3JVF2EYA5XCAJ9QAR3C6SY8\",\n      \"tenant_id\": \"ten_flow\",\n      \"job_id\": \"01M3JVF2D4HZ9B61Q6VK4SG6SY\",\n      ...\n    },\n    ...\n  ]\n}\n```",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "read",
          "scope": "payments_money:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#pay"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "operationId": "patch_payroll_people_by_id",
        "summary": "Payroll: people, update",
        "description": "**Needs:** Payments and money at write.",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "write",
          "scope": "payments_money:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/payroll/quotes/{id}/cost": {
      "get": {
        "operationId": "get_payroll_quotes_by_id_cost",
        "summary": "Payroll: quotes cost",
        "description": "The shop's cost card for a quote: crew pay, materials, overhead, what is left. Needs a key whose person sees pay (owner, admin, office).\n\n**Needs:** Payments and money at read (or write).",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "read",
          "scope": "payments_money:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#quotes"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "revenue_cents": {
                      "type": "integer"
                    },
                    "materials_cents": {
                      "type": "integer"
                    },
                    "linked_expenses_cents": {
                      "type": "integer"
                    },
                    "measurement_pay_cents": {
                      "type": "integer"
                    },
                    "salesperson_cents": {
                      "type": "integer"
                    },
                    "revenue_split_cents": {
                      "type": "integer"
                    },
                    "overhead_cents": {
                      "type": "integer"
                    },
                    "fixed_job_cost_cents": {
                      "type": "integer"
                    },
                    "cost_cents": {
                      "type": "integer"
                    },
                    "profit_before_profit_splits_cents": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "revenue_cents": 73625,
                  "materials_cents": 0,
                  "linked_expenses_cents": 0,
                  "measurement_pay_cents": 23000,
                  "salesperson_cents": 0,
                  "revenue_split_cents": 0,
                  "overhead_cents": 0,
                  "fixed_job_cost_cents": 0,
                  "cost_cents": 23000,
                  "profit_before_profit_splits_cents": 50625
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/payroll/jobs/{id}/costs": {
      "patch": {
        "operationId": "patch_payroll_jobs_by_id_costs",
        "summary": "Payroll: jobs costs, update",
        "description": "**Needs:** Payments and money at write.",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "write",
          "scope": "payments_money:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/payroll/payouts/{id}/override": {
      "post": {
        "operationId": "post_payroll_payouts_by_id_override",
        "summary": "Payroll: payouts override",
        "description": "**Needs:** Payments and money at write (the money permission).",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:money"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "money",
          "scope": "payments_money:money"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_money"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/payroll/payouts/{id}/clear-override": {
      "post": {
        "operationId": "post_payroll_payouts_by_id_clear_override",
        "summary": "Payroll: payouts clear override",
        "description": "**Needs:** Payments and money at write (the money permission).",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:money"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "money",
          "scope": "payments_money:money"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_money"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/timeclock": {
      "post": {
        "operationId": "post_timeclock",
        "summary": "Timeclock: create",
        "description": "**Needs:** Payments and money at write.",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "write",
          "scope": "payments_money:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/timeclock/{id}": {
      "patch": {
        "operationId": "patch_timeclock_by_id",
        "summary": "Timeclock: update",
        "description": "**Needs:** Payments and money at write.",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "write",
          "scope": "payments_money:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      },
      "delete": {
        "operationId": "delete_timeclock_by_id",
        "summary": "Timeclock: delete",
        "description": "**Needs:** Payments and money at write.",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "write",
          "scope": "payments_money:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/timeclock/weeks/{week}": {
      "get": {
        "operationId": "get_timeclock_weeks_by_week",
        "summary": "Timeclock: weeks, read one",
        "description": "Whether a pay week is locked.\n\n**Needs:** Payments and money at read (or write).",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "read",
          "scope": "payments_money:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#pay"
        },
        "parameters": [
          {
            "name": "week",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "locked": {
                      "type": "boolean"
                    },
                    "locked_at": {},
                    "locked_by_name": {}
                  }
                },
                "example": {
                  "locked": false,
                  "locked_at": null,
                  "locked_by_name": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/timeclock/end-asks": {
      "get": {
        "operationId": "get_timeclock_end_asks",
        "summary": "Timeclock: end asks",
        "description": "**Needs:** Payments and money at read (or write).",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "read",
          "scope": "payments_money:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/timeclock/weeks/{week}/lock": {
      "post": {
        "operationId": "post_timeclock_weeks_by_week_lock",
        "summary": "Timeclock: weeks lock",
        "description": "**Needs:** Payments and money at write.",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "write",
          "scope": "payments_money:write"
        },
        "parameters": [
          {
            "name": "week",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      },
      "delete": {
        "operationId": "delete_timeclock_weeks_by_week_lock",
        "summary": "Timeclock: weeks lock, delete",
        "description": "**Needs:** Payments and money at write.",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "write",
          "scope": "payments_money:write"
        },
        "parameters": [
          {
            "name": "week",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/clock-nudge": {
      "get": {
        "operationId": "get_clock_nudge",
        "summary": "Clock nudge: read",
        "description": "**Needs:** Payments and money at read (or write).",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "read",
          "scope": "payments_money:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/clock-nudge/clock-out": {
      "post": {
        "operationId": "post_clock_nudge_clock_out",
        "summary": "Clock nudge: clock out",
        "description": "**Needs:** Payments and money at write.",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "write",
          "scope": "payments_money:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/clock-nudge/still-working": {
      "post": {
        "operationId": "post_clock_nudge_still_working",
        "summary": "Clock nudge: still working",
        "description": "**Needs:** Payments and money at write.",
        "tags": [
          "Payments and money"
        ],
        "security": [
          {
            "chalkKey": [
              "payments_money:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "payments_money",
          "kind": "write",
          "scope": "payments_money:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_payments_money_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/messages": {
      "get": {
        "operationId": "get_messages",
        "summary": "Messages: read",
        "description": "Threads in the inbox.\n\n**Needs:** Messages at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/messages\n\n200\n{\n  \"threads\": [],\n  \"bot_working\": [],\n  \"bot_working_addresses\": [],\n  \"held_overnight\": 0,\n  \"unread_total\": 0,\n  \"ready\": true,\n  ...\n}\n```",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "chalkKey": [
              "messages:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "messages",
          "kind": "read",
          "scope": "messages:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#messages"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_messages_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/messages/search": {
      "get": {
        "operationId": "get_messages_search",
        "summary": "Messages: search",
        "description": "**Needs:** Messages at read (or write).",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "chalkKey": [
              "messages:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "messages",
          "kind": "read",
          "scope": "messages:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_messages_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/messages/recipients": {
      "get": {
        "operationId": "get_messages_recipients",
        "summary": "Messages: recipients",
        "description": "Who you can text from here.\n\n**Needs:** Messages at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/messages/recipients?q=harmon\n\n200\n{\n  \"matches\": [\n    {\n      \"id\": \"01M3JVF1K1XS5ZJKJG6RF2TBXE\",\n      \"name\": \"Dale Harmon\",\n      \"phone\": \"+18645550199\"\n    },\n    ...\n  ],\n  \"suggested\": false\n}\n```",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "chalkKey": [
              "messages:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "messages",
          "kind": "read",
          "scope": "messages:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#messages"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_messages_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/messages/thread": {
      "get": {
        "operationId": "get_messages_thread",
        "summary": "Messages: thread",
        "description": "The back and forth with one number or address: `?address=` (+18645550199 or an email).\n\n**Needs:** Messages at read (or write).",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "chalkKey": [
              "messages:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "messages",
          "kind": "read",
          "scope": "messages:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#messages"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "address": {
                      "type": "string"
                    },
                    "bot_working": {
                      "type": "boolean"
                    },
                    "messages": {
                      "type": "array"
                    }
                  }
                },
                "example": {
                  "address": "+18645550199",
                  "bot_working": false,
                  "messages": []
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_messages_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/messages/text-threads": {
      "get": {
        "operationId": "get_messages_text_threads",
        "summary": "Messages: text threads",
        "description": "**Needs:** Messages at read (or write).",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "chalkKey": [
              "messages:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "messages",
          "kind": "read",
          "scope": "messages:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_messages_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/messages/unread": {
      "get": {
        "operationId": "get_messages_unread",
        "summary": "Messages: unread",
        "description": "What has not been opened yet.\n\n**Needs:** Messages at read (or write).",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "chalkKey": [
              "messages:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "messages",
          "kind": "read",
          "scope": "messages:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#messages"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "n": {
                      "type": "integer"
                    },
                    "ready": {
                      "type": "boolean"
                    },
                    "state": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "n": 0,
                  "ready": true,
                  "state": "in_app"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_messages_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/messages/usage": {
      "get": {
        "operationId": "get_messages_usage",
        "summary": "Messages: usage",
        "description": "The texting meter: used, included, the bank. Buying packs stays in the app.\n\n**Needs:** Messages at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/messages/usage\n\n200\n{\n  \"mode\": \"stop\",\n  \"included\": 1500,\n  \"included_used\": 0,\n  \"used\": 0,\n  \"bank\": 0,\n  \"payg_used\": 0,\n  \"payg_month\": null,\n  \"rate_cents_per_unit\": 2,\n  \"pack_min\": 250,\n  ...\n}\n```",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "chalkKey": [
              "messages:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "messages",
          "kind": "read",
          "scope": "messages:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#messages"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_messages_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/messages/quo-showcase": {
      "get": {
        "operationId": "get_messages_quo_showcase",
        "summary": "Messages: quo showcase",
        "description": "**Needs:** Messages at read (or write).",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "chalkKey": [
              "messages:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "messages",
          "kind": "read",
          "scope": "messages:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_messages_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/messages/thread-key/{id}": {
      "get": {
        "operationId": "get_messages_thread_key_by_id",
        "summary": "Messages: thread key, read one",
        "description": "**Needs:** Messages at read (or write).",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "chalkKey": [
              "messages:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "messages",
          "kind": "read",
          "scope": "messages:read"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_messages_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/messages/media/{id}": {
      "get": {
        "operationId": "get_messages_media_by_id",
        "summary": "Messages: media, read one",
        "description": "**Needs:** Messages at read (or write).",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "chalkKey": [
              "messages:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "messages",
          "kind": "read",
          "scope": "messages:read"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file.",
            "content": {
              "*/*": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "application/octet-stream"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_messages_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/messages/thread-key": {
      "post": {
        "operationId": "post_messages_thread_key",
        "summary": "Messages: thread key",
        "description": "**Needs:** Messages at write.",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "chalkKey": [
              "messages:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "messages",
          "kind": "write",
          "scope": "messages:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_messages_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/messages/read": {
      "post": {
        "operationId": "post_messages_read",
        "summary": "Messages: read",
        "description": "Mark a thread read: `address`. Needs send.\n\n**Needs:** Messages at write.",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "chalkKey": [
              "messages:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "messages",
          "kind": "write",
          "scope": "messages:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#messages"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "address": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "address": "+18645550199"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_messages_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/messages/text-threads/read": {
      "post": {
        "operationId": "post_messages_text_threads_read",
        "summary": "Messages: text threads read",
        "description": "**Needs:** Messages at write.",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "chalkKey": [
              "messages:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "messages",
          "kind": "write",
          "scope": "messages:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_messages_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/messages/media": {
      "post": {
        "operationId": "post_messages_media",
        "summary": "Messages: media",
        "description": "**Needs:** Messages at write.",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "chalkKey": [
              "messages:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "messages",
          "kind": "write",
          "scope": "messages:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "The file's raw bytes, with its own Content-Type.",
          "content": {
            "*/*": {
              "schema": {
                "type": "string",
                "contentMediaType": "application/octet-stream"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_messages_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      },
      "put": {
        "operationId": "put_messages_media",
        "summary": "Messages: media, set",
        "description": "**Needs:** Messages at write.",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "chalkKey": [
              "messages:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "messages",
          "kind": "write",
          "scope": "messages:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "The file's raw bytes, with its own Content-Type.",
          "content": {
            "*/*": {
              "schema": {
                "type": "string",
                "contentMediaType": "application/octet-stream"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_messages_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/messages/send": {
      "post": {
        "operationId": "post_messages_send",
        "summary": "Messages: send",
        "description": "Reply from the business number: `address` (their number or email), `body`, optional `client_id`. Needs send. It goes out at once, like a reply typed in the app: quiet hours do not hold it, so check the time before an automation calls it. A number that texted STOP is still refused.\n\n**Needs:** Messages at write, and Can message customers.",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "chalkKey": [
              "messages:send"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "messages",
          "kind": "send",
          "scope": "messages:send"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#messages"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string"
                  },
                  "address": {
                    "type": "string"
                  },
                  "body": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "client_id": "01M3JVF1K1XS5ZJKJG6RF2TBXE",
                "address": "+18645550199",
                "body": "We can do Tuesday at 9."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "simulated": {
                      "type": "boolean"
                    },
                    "media": {
                      "type": "array"
                    }
                  }
                },
                "example": {
                  "id": "01M3JVF2QJZYHTJN5E8EDEGS5B",
                  "simulated": true,
                  "media": []
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_messages_send"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/admin/outbox": {
      "get": {
        "operationId": "get_admin_outbox",
        "summary": "Admin: outbox",
        "description": "**Needs:** Messages at read (or write).",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "chalkKey": [
              "messages:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "messages",
          "kind": "read",
          "scope": "messages:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_messages_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/admin/outbox/kinds": {
      "get": {
        "operationId": "get_admin_outbox_kinds",
        "summary": "Admin: outbox kinds",
        "description": "**Needs:** Messages at read (or write).",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "chalkKey": [
              "messages:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "messages",
          "kind": "read",
          "scope": "messages:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_messages_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/admin/outbox/{id}/retry": {
      "post": {
        "operationId": "post_admin_outbox_by_id_retry",
        "summary": "Admin: outbox retry",
        "description": "**Needs:** Messages at write, and Can message customers.",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "chalkKey": [
              "messages:send"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "messages",
          "kind": "send",
          "scope": "messages:send"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_messages_send"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/notifications": {
      "get": {
        "operationId": "get_notifications",
        "summary": "Notifications: read",
        "description": "What the office bell is holding.\n\n**Needs:** Messages at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/notifications\n\n200\n{\n  \"notifications\": [\n    {\n      \"id\": \"01M3JVF2GJPCD7BZHDQJ06SQEM\",\n      \"tenant_id\": \"ten_flow\",\n      \"user_id\": null,\n      \"kind\": \"job_ready_to_invoice\",\n      \"title\": \"Dale Harmon is ready to invoice\",\n      ...\n    },\n    ...\n  ],\n  \"unread\": 3\n}\n```",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "chalkKey": [
              "messages:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "messages",
          "kind": "read",
          "scope": "messages:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#board"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_messages_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/notifications/latest": {
      "get": {
        "operationId": "get_notifications_latest",
        "summary": "Notifications: latest",
        "description": "**Needs:** Messages at read (or write).",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "chalkKey": [
              "messages:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "messages",
          "kind": "read",
          "scope": "messages:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_messages_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/notifications/mine": {
      "get": {
        "operationId": "get_notifications_mine",
        "summary": "Notifications: mine",
        "description": "**Needs:** Messages at read (or write).",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "chalkKey": [
              "messages:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "messages",
          "kind": "read",
          "scope": "messages:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_messages_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/notifications/prefs": {
      "get": {
        "operationId": "get_notifications_prefs",
        "summary": "Notifications: prefs",
        "description": "Which bells this person wants: leads, approvals, ChalkBot, and the rest of the catalog.\n\n**Needs:** Messages at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/notifications/prefs\n\n200\n{\n  \"types\": {\n    \"lead_created\": true,\n    \"quote_approved\": true,\n    \"quote_changes_requested\": true,\n    \"job_needs_schedule\": true,\n    \"job_ready_to_invoice\": true,\n    \"payment_received\": true,\n    \"money_to_sort\": true,\n    \"text_from_new_number\": true,\n    \"texts_switched_off\": true,\n    ...\n  },\n  \"catalog\": [\n    {\n      \"key\": \"lead_created\",\n      \"group\": \"Work\",\n      \"label\": \"New leads\",\n      \"hint\": \"Someone asked for a quote or booked an estimate.\"\n    },\n    ...\n  ],\n  \"role_defaults\": {\n    \"job_ready_to_invoice\": {\n      \"office\": true,\n      \"crew\": false\n    }\n  },\n  \"can_edit_role_defaults\": true,\n  \"push\": {\n    \"configured\": false,\n    \"secret_names\": [\n      \"VAPID_PUBLIC_KEY\",\n      ...\n    ]\n  }\n}\n```",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "chalkKey": [
              "messages:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "messages",
          "kind": "read",
          "scope": "messages:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#board"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_messages_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "put": {
        "operationId": "put_notifications_prefs",
        "summary": "Notifications: prefs, set",
        "description": "Turn those types on or off: `{ \"types\": { \"quote_approved\": false } }`.\n\n**Needs:** Messages at write.\n\nExample from the developer page:\n\n```\nPUT /api/notifications/prefs\n{\n  \"types\": {\n    \"quote_approved\": false\n  }\n}\n\n200\n{\n  \"types\": {\n    \"lead_created\": true,\n    \"quote_approved\": false,\n    \"quote_changes_requested\": true,\n    \"job_needs_schedule\": true,\n    \"job_ready_to_invoice\": true,\n    \"payment_received\": true,\n    \"money_to_sort\": true,\n    \"text_from_new_number\": true,\n    \"texts_switched_off\": true,\n    ...\n  },\n  \"catalog\": [\n    {\n      \"key\": \"lead_created\",\n      \"group\": \"Work\",\n      \"label\": \"New leads\",\n      \"hint\": \"Someone asked for a quote or booked an estimate.\"\n    },\n    ...\n  ],\n  \"role_defaults\": {\n    \"job_ready_to_invoice\": {\n      \"office\": true,\n      \"crew\": false\n    }\n  }\n}\n```",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "chalkKey": [
              "messages:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "messages",
          "kind": "write",
          "scope": "messages:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#board"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "types": {
                    "type": "object",
                    "properties": {
                      "quote_approved": {
                        "type": "boolean"
                      }
                    }
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "types": {
                  "quote_approved": false
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_messages_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/notifications/vapid-key": {
      "get": {
        "operationId": "get_notifications_vapid_key",
        "summary": "Notifications: vapid key",
        "description": "**Needs:** Messages at read (or write).",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "chalkKey": [
              "messages:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "messages",
          "kind": "read",
          "scope": "messages:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_messages_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/notifications/{id}/read": {
      "post": {
        "operationId": "post_notifications_by_id_read",
        "summary": "Notifications: read",
        "description": "**Needs:** Messages at write.",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "chalkKey": [
              "messages:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "messages",
          "kind": "write",
          "scope": "messages:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_messages_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/notifications/read-all": {
      "post": {
        "operationId": "post_notifications_read_all",
        "summary": "Notifications: read all",
        "description": "**Needs:** Messages at write.",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "chalkKey": [
              "messages:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "messages",
          "kind": "write",
          "scope": "messages:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_messages_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/notifications/unsubscribe": {
      "post": {
        "operationId": "post_notifications_unsubscribe",
        "summary": "Notifications: unsubscribe",
        "description": "**Needs:** Messages at write.",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "chalkKey": [
              "messages:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "messages",
          "kind": "write",
          "scope": "messages:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_messages_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/files": {
      "put": {
        "operationId": "put_files",
        "summary": "Files: set",
        "description": "Query `entity_type`, `entity_id`, optional `filename`. Body is raw bytes, `Content-Type: image/jpeg` (not JSON). JSON `{entity_type, entity_id}` is wrong. There is no GET `/api/files` index (404). List is GET `/api/files/list/:type/:id`. Fetch one is GET `/api/files/:id`. Needs files.\n\n**Needs:** Files at write.\n\nExample from the developer page:\n\n```\nPUT /api/files?entity_type=job&entity_id=01M3JVF2D4HZ9B61Q6VK4SG6SY&filename=after.jpg\n(raw image bytes)\n\n201\n{\n  \"id\": \"01M3JVF2K69VABZ8KCJFRR6XD9\",\n  \"key\": \"ten_flow/job/01M3JVF2D4HZ9B61Q6VK4SG6SY/01M3JVF2K69VABZ8KCJFRR6XD9-after.jpg\",\n  \"size_bytes\": 14\n}\n```",
        "tags": [
          "Files"
        ],
        "security": [
          {
            "chalkKey": [
              "files:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "files",
          "kind": "write",
          "scope": "files:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#notes"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "The file's raw bytes, with its own Content-Type.",
          "content": {
            "*/*": {
              "schema": {
                "type": "string",
                "contentMediaType": "application/octet-stream"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "key": {
                      "type": "string"
                    },
                    "size_bytes": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "id": "01M3JVF2K69VABZ8KCJFRR6XD9",
                  "key": "ten_flow/job/01M3JVF2D4HZ9B61Q6VK4SG6SY/01M3JVF2K69VABZ8KCJFRR6XD9-after.jpg",
                  "size_bytes": 14
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_files_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/files/gallery": {
      "get": {
        "operationId": "get_files_gallery",
        "summary": "Files: gallery",
        "description": "The shop gallery, searchable. Needs files.\n\n**Needs:** Files at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/files/gallery\n\n200\n{\n  \"images\": [\n    {\n      \"id\": \"01M3JVF2K69VABZ8KCJFRR6XD9\",\n      \"entity_type\": \"job\",\n      \"entity_id\": \"01M3JVF2D4HZ9B61Q6VK4SG6SY\",\n      \"filename\": \"after.jpg\",\n      \"content_type\": \"image/jpeg\",\n      ...\n    },\n    ...\n  ],\n  \"has_more\": false,\n  \"offset\": 0\n}\n```",
        "tags": [
          "Files"
        ],
        "security": [
          {
            "chalkKey": [
              "files:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "files",
          "kind": "read",
          "scope": "files:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#notes"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_files_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/files/duplicates": {
      "get": {
        "operationId": "get_files_duplicates",
        "summary": "Files: duplicates",
        "description": "**Needs:** Files at read (or write).",
        "tags": [
          "Files"
        ],
        "security": [
          {
            "chalkKey": [
              "files:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "files",
          "kind": "read",
          "scope": "files:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_files_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/files/duplicates/scan": {
      "post": {
        "operationId": "post_files_duplicates_scan",
        "summary": "Files: duplicates scan",
        "description": "**Needs:** Files at write.",
        "tags": [
          "Files"
        ],
        "security": [
          {
            "chalkKey": [
              "files:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "files",
          "kind": "write",
          "scope": "files:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_files_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/files/list/{entityType}/{entityId}": {
      "get": {
        "operationId": "get_files_list_by_entityType_by_entityId",
        "summary": "Files: list, read one",
        "description": "Photos on one job or quote.\n\n**Needs:** Files at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/files/list/job/01M3JVF2D4HZ9B61Q6VK4SG6SY\n\n200\n[\n  {\n    \"id\": \"01M3JVF2K69VABZ8KCJFRR6XD9\",\n    \"tenant_id\": \"ten_flow\",\n    \"entity_type\": \"job\",\n    \"entity_id\": \"01M3JVF2D4HZ9B61Q6VK4SG6SY\",\n    \"r2_key\": \"ten_flow/job/01M3JVF2D4HZ9B61Q6VK4SG6SY/01M3JVF2K69VABZ8KCJFRR6XD9-after.jpg\",\n    \"filename\": \"after.jpg\",\n    ...\n  }\n]\n```",
        "tags": [
          "Files"
        ],
        "security": [
          {
            "chalkKey": [
              "files:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "files",
          "kind": "read",
          "scope": "files:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#notes"
        },
        "parameters": [
          {
            "name": "entityType",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entityId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_files_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/files/link": {
      "post": {
        "operationId": "post_files_link",
        "summary": "Files: link",
        "description": "**Needs:** Files at write.",
        "tags": [
          "Files"
        ],
        "security": [
          {
            "chalkKey": [
              "files:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "files",
          "kind": "write",
          "scope": "files:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_files_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/files/from-chat": {
      "post": {
        "operationId": "post_files_from_chat",
        "summary": "Files: from chat",
        "description": "**Needs:** Files at write.",
        "tags": [
          "Files"
        ],
        "security": [
          {
            "chalkKey": [
              "files:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "files",
          "kind": "write",
          "scope": "files:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_files_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/files/bulk": {
      "post": {
        "operationId": "post_files_bulk",
        "summary": "Files: bulk",
        "description": "**Needs:** Files at write.\n\n**Limit for keys:** Deleting photos everywhere is only available when signed in, not with an API key.",
        "tags": [
          "Files"
        ],
        "security": [
          {
            "chalkKey": [
              "files:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "files",
          "kind": "write",
          "scope": "files:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_files_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/files/bulk-download": {
      "post": {
        "operationId": "post_files_bulk_download",
        "summary": "Files: bulk download",
        "description": "**Needs:** Files at read (or write).",
        "tags": [
          "Files"
        ],
        "security": [
          {
            "chalkKey": [
              "files:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "files",
          "kind": "read",
          "scope": "files:read"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The file.",
            "content": {
              "application/zip": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "application/zip"
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_files_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/files/merge": {
      "post": {
        "operationId": "post_files_merge",
        "summary": "Files: merge",
        "description": "**Needs:** Files at write.",
        "tags": [
          "Files"
        ],
        "security": [
          {
            "chalkKey": [
              "files:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "files",
          "kind": "write",
          "scope": "files:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_files_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/files/{id}": {
      "get": {
        "operationId": "get_files_by_id",
        "summary": "Files: read one",
        "description": "Fetch one file.\n\n**Needs:** Files at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/files/01M3JVF2K69VABZ8KCJFRR6XD9\n\n200\n(image/jpeg, 14 bytes)\n```",
        "tags": [
          "Files"
        ],
        "security": [
          {
            "chalkKey": [
              "files:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "files",
          "kind": "read",
          "scope": "files:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#notes"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file.",
            "content": {
              "*/*": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "application/octet-stream"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_files_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "operationId": "delete_files_by_id",
        "summary": "Files: delete",
        "description": "Take a photo off. Needs files.\n\n**Needs:** Files at write.",
        "tags": [
          "Files"
        ],
        "security": [
          {
            "chalkKey": [
              "files:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "files",
          "kind": "write",
          "scope": "files:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#notes"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_files_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/files/{id}/thumb": {
      "get": {
        "operationId": "get_files_by_id_thumb",
        "summary": "Files: thumb",
        "description": "**Needs:** Files at read (or write).",
        "tags": [
          "Files"
        ],
        "security": [
          {
            "chalkKey": [
              "files:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "files",
          "kind": "read",
          "scope": "files:read"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file.",
            "content": {
              "*/*": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "application/octet-stream"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_files_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "put": {
        "operationId": "put_files_by_id_thumb",
        "summary": "Files: thumb, set",
        "description": "**Needs:** Files at write.",
        "tags": [
          "Files"
        ],
        "security": [
          {
            "chalkKey": [
              "files:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "files",
          "kind": "write",
          "scope": "files:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "The file's raw bytes, with its own Content-Type.",
          "content": {
            "*/*": {
              "schema": {
                "type": "string",
                "contentMediaType": "application/octet-stream"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_files_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/files/{id}/uses": {
      "get": {
        "operationId": "get_files_by_id_uses",
        "summary": "Files: uses",
        "description": "**Needs:** Files at read (or write).",
        "tags": [
          "Files"
        ],
        "security": [
          {
            "chalkKey": [
              "files:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "files",
          "kind": "read",
          "scope": "files:read"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_files_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/admin/prefs": {
      "get": {
        "operationId": "get_admin_prefs",
        "summary": "Admin: prefs",
        "description": "Hours, quiet hours, templates, deposits, follow-ups.\n\n**Needs:** Settings at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/admin/prefs\n\n200\n{\n  \"prefs\": {\n    \"business_phone\": \"\",\n    \"business_email\": \"\",\n    \"business_address\": \"\",\n    \"business_address_public\": \"0\",\n    \"review_link\": \"\",\n    \"day_start_hour\": 6,\n    \"default_visit_hours\": 8,\n    \"default_visit_start\": \"08:00\",\n    ...\n  },\n  \"defaults\": {\n    \"business_phone\": \"\",\n    \"business_email\": \"\",\n    \"business_address\": \"\",\n    \"business_address_public\": \"0\",\n    \"review_link\": \"\",\n    \"day_start_hour\": 6,\n    \"default_visit_hours\": 8,\n    \"default_visit_start\": \"08:00\",\n    ...\n  }\n}\n```",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/admin/settings": {
      "get": {
        "operationId": "get_admin_settings",
        "summary": "Admin: settings",
        "description": "The saved settings, secrets left out.\n\n**Needs:** Settings at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/admin/settings\n\n200\n{ \"measures_enabled\": \"1\", \"doc_show_measures\": \"1\", \"quote_expiry_days\": \"21\", ... }\n```",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "put": {
        "operationId": "put_admin_settings",
        "summary": "Admin: settings, set",
        "description": "Change hours, templates, numbering, follow-ups, `measures_enabled`. Allowlisted keys only; anything else comes back in `ignored`. Turning late fees on (`late_fee_mode` to `percent` or `flat`) also adds the fee to invoices that are already past due, not just new ones; the app asks first, a key does not.\n\n**Needs:** Settings at write.",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "write",
          "scope": "settings:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#settings"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "measures_enabled": {
                    "type": "string"
                  },
                  "quote_expiry_days": {
                    "type": "string"
                  },
                  "card_fee_percent_bp": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "measures_enabled": "1",
                "quote_expiry_days": "21",
                "card_fee_percent_bp": "300"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "ignored": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "ignored": [
                    "card_fee_percent_bp"
                  ]
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/admin/tenant": {
      "patch": {
        "operationId": "patch_admin_tenant",
        "summary": "Admin: tenant, update",
        "description": "**Needs:** Settings at write.\n\nChanging `tax_rate_bp` or `tax_label` also needs write on Payments and money.",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "write",
          "scope": "settings:write",
          "guards": [
            "tax_money"
          ]
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/admin/audit": {
      "get": {
        "operationId": "get_admin_audit",
        "summary": "Admin: audit",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/connectors/channels": {
      "get": {
        "operationId": "get_connectors_channels",
        "summary": "Connectors: channels",
        "description": "Whether text, email or neither can actually send.\n\n**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#messages"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sms": {
                      "type": "object",
                      "properties": {
                        "state": {
                          "type": "string"
                        },
                        "can_send": {
                          "type": "boolean"
                        }
                      }
                    },
                    "email": {
                      "type": "object",
                      "properties": {
                        "ready": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "sms": {
                    "state": "in_app",
                    "can_send": true
                  },
                  "email": {
                    "ready": true
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/notifications/role-defaults": {
      "put": {
        "operationId": "put_notifications_role_defaults",
        "summary": "Notifications: role defaults, set",
        "description": "**Needs:** Settings at write.",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "write",
          "scope": "settings:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/custom-fields/{id}": {
      "patch": {
        "operationId": "patch_custom_fields_by_id",
        "summary": "Custom fields: update",
        "description": "**Needs:** Settings at write.",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "write",
          "scope": "settings:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      },
      "delete": {
        "operationId": "delete_custom_fields_by_id",
        "summary": "Custom fields: delete",
        "description": "**Needs:** Settings at write.",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "write",
          "scope": "settings:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/saved-views": {
      "get": {
        "operationId": "get_saved_views",
        "summary": "Saved views: read",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "post_saved_views",
        "summary": "Saved views: create",
        "description": "**Needs:** Settings at write.",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "write",
          "scope": "settings:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/saved-views/{id}": {
      "delete": {
        "operationId": "delete_saved_views_by_id",
        "summary": "Saved views: delete",
        "description": "**Needs:** Settings at write.",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "write",
          "scope": "settings:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/saved-views/layout/{page}": {
      "get": {
        "operationId": "get_saved_views_layout_by_page",
        "summary": "Saved views: layout, read one",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "parameters": [
          {
            "name": "page",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "put": {
        "operationId": "put_saved_views_layout_by_page",
        "summary": "Saved views: layout, set",
        "description": "**Needs:** Settings at write.",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "write",
          "scope": "settings:write"
        },
        "parameters": [
          {
            "name": "page",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/onboarding": {
      "get": {
        "operationId": "get_onboarding",
        "summary": "Onboarding: read",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/help/tickets": {
      "get": {
        "operationId": "get_help_tickets",
        "summary": "Help: tickets",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "post_help_tickets",
        "summary": "Help: tickets",
        "description": "**Needs:** Settings at write.",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "write",
          "scope": "settings:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/help/tickets/{id}": {
      "get": {
        "operationId": "get_help_tickets_by_id",
        "summary": "Help: tickets, read one",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/help/tickets/{id}/messages": {
      "post": {
        "operationId": "post_help_tickets_by_id_messages",
        "summary": "Help: tickets messages",
        "description": "**Needs:** Settings at write.",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "write",
          "scope": "settings:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/assistant/actions/{id}/state": {
      "get": {
        "operationId": "get_assistant_actions_by_id_state",
        "summary": "Assistant: actions state",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant/agents": {
      "get": {
        "operationId": "get_assistant_agents",
        "summary": "Assistant: agents",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant/agents/{id}/activity": {
      "get": {
        "operationId": "get_assistant_agents_by_id_activity",
        "summary": "Assistant: agents activity",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant/agents/{id}/suggestions": {
      "get": {
        "operationId": "get_assistant_agents_by_id_suggestions",
        "summary": "Assistant: agents suggestions",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant/artifacts/{id}": {
      "get": {
        "operationId": "get_assistant_artifacts_by_id",
        "summary": "Assistant: artifacts, read one",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant/conversations": {
      "get": {
        "operationId": "get_assistant_conversations",
        "summary": "Assistant: conversations",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant/meta": {
      "get": {
        "operationId": "get_assistant_meta",
        "summary": "Assistant: meta",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant/pending": {
      "get": {
        "operationId": "get_assistant_pending",
        "summary": "Assistant: pending",
        "description": "Cards waiting for somebody's OK.\n\n**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#chalkbot"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array"
                    }
                  }
                },
                "example": {
                  "items": []
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant/schedules": {
      "get": {
        "operationId": "get_assistant_schedules",
        "summary": "Assistant: schedules",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant/settings": {
      "get": {
        "operationId": "get_assistant_settings",
        "summary": "Assistant: settings",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant/setup": {
      "get": {
        "operationId": "get_assistant_setup",
        "summary": "Assistant: setup",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant/staff": {
      "get": {
        "operationId": "get_assistant_staff",
        "summary": "Assistant: staff",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant/staff/{userId}/conversations": {
      "get": {
        "operationId": "get_assistant_staff_by_userId_conversations",
        "summary": "Assistant: staff conversations",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant/staff/{userId}/thread": {
      "get": {
        "operationId": "get_assistant_staff_by_userId_thread",
        "summary": "Assistant: staff thread",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant/tasks": {
      "get": {
        "operationId": "get_assistant_tasks",
        "summary": "Assistant: tasks",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant/team": {
      "get": {
        "operationId": "get_assistant_team",
        "summary": "Assistant: team",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant/thread": {
      "get": {
        "operationId": "get_assistant_thread",
        "summary": "Assistant: thread",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant/time-saved": {
      "get": {
        "operationId": "get_assistant_time_saved",
        "summary": "Assistant: time saved",
        "description": "Minutes ChalkBot saved this month, and all time.\n\n**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#chalkbot"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "month": {
                      "type": "integer"
                    },
                    "all": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "month": 0,
                  "all": 0
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant/usage": {
      "get": {
        "operationId": "get_assistant_usage",
        "summary": "Assistant: usage",
        "description": "Credits used this week, the included 250, and any extra bank.\n\n**Needs:** Settings at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/assistant/usage\n\n200\n{\n  \"mode\": \"stop\",\n  \"included\": 250,\n  \"included_used\": 0,\n  \"used\": 0,\n  \"bank\": 0,\n  \"payg_used\": 0,\n  \"rate_cents_per_credit\": 1,\n  \"pack_min\": 500,\n  \"pack_max\": 20000,\n  ...\n}\n```",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#chalkbot"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant/working": {
      "get": {
        "operationId": "get_assistant_working",
        "summary": "Assistant: working",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant2/actions/{id}/state": {
      "get": {
        "operationId": "get_assistant2_actions_by_id_state",
        "summary": "Assistant2: actions state",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant2/done-today": {
      "get": {
        "operationId": "get_assistant2_done_today",
        "summary": "Assistant2: done today",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant2/leash": {
      "get": {
        "operationId": "get_assistant2_leash",
        "summary": "Assistant2: leash",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant2/memory": {
      "get": {
        "operationId": "get_assistant2_memory",
        "summary": "Assistant2: memory",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant2/routines": {
      "get": {
        "operationId": "get_assistant2_routines",
        "summary": "Assistant2: routines",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant2/routines/{id}/runs": {
      "get": {
        "operationId": "get_assistant2_routines_by_id_runs",
        "summary": "Assistant2: routines runs",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant2/runs/{id}/events": {
      "get": {
        "operationId": "get_assistant2_runs_by_id_events",
        "summary": "Assistant2: runs events",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant2/settings": {
      "get": {
        "operationId": "get_assistant2_settings",
        "summary": "Assistant2: settings",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant2/staff/{userId}/thread": {
      "get": {
        "operationId": "get_assistant2_staff_by_userId_thread",
        "summary": "Assistant2: staff thread",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant2/status": {
      "get": {
        "operationId": "get_assistant2_status",
        "summary": "Assistant2: status",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant2/thread": {
      "get": {
        "operationId": "get_assistant2_thread",
        "summary": "Assistant2: thread",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant2/thread/search": {
      "get": {
        "operationId": "get_assistant2_thread_search",
        "summary": "Assistant2: thread search",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant2/uploads/{id}": {
      "get": {
        "operationId": "get_assistant2_uploads_by_id",
        "summary": "Assistant2: uploads, read one",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file.",
            "content": {
              "*/*": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "application/octet-stream"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant2/usage": {
      "get": {
        "operationId": "get_assistant2_usage",
        "summary": "Assistant2: usage",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/assistant2/waiting": {
      "get": {
        "operationId": "get_assistant2_waiting",
        "summary": "Assistant2: waiting",
        "description": "**Needs:** Settings at read (or write).",
        "tags": [
          "Settings"
        ],
        "security": [
          {
            "chalkKey": [
              "settings:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "settings",
          "kind": "read",
          "scope": "settings:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_settings_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/automations": {
      "get": {
        "operationId": "get_automations",
        "summary": "Automations: read",
        "description": "Every card, with its trigger, timing and words.\n\n**Needs:** Automations at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/automations\n\n200\n{\n  \"workflows\": [\n    {\n      \"id\": \"01M3JVF2MBZC78JDMRQJ4YBJJR\",\n      \"tenant_id\": \"ten_flow\",\n      \"builtin_key\": \"auto_archive_quotes\",\n      ...\n    },\n    ...\n  ],\n  \"groups\": [\n    {\n      \"id\": \"quotes\",\n      \"label\": \"Quotes\"\n    },\n    ...\n  ],\n  \"templates\": [\n    {\n      \"id\": \"custom\",\n      \"title\": \"Custom\",\n      \"blurb\": \"Blank When, If, and Then. You pick the trigger and write the steps.\",\n      ...\n    },\n    ...\n  ],\n  \"placeholders\": {\n    \"quote_sent\": [\n      \"first_name\",\n      ...\n    ],\n    \"invoice_due\": [\n      \"first_name\",\n      ...\n    ],\n    \"invoice_paid\": [\n      \"first_name\",\n      ...\n    ],\n    \"installment_due\": [\n      \"first_name\",\n      ...\n    ],\n    \"lead_created\": [\n      \"first_name\",\n      ...\n    ],\n    \"visit_upcoming\": [\n      \"first_name\",\n      ...\n    ],\n    ...\n  },\n  \"channels\": {\n    \"sms\": {\n      \"connected\": false,\n      \"can_send\": false,\n      \"provider\": null\n    },\n    \"email\": {\n      \"ready\": false\n    }\n  }\n}\n```",
        "tags": [
          "Automations"
        ],
        "security": [
          {
            "chalkKey": [
              "automations:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "automations",
          "kind": "read",
          "scope": "automations:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#automations"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_automations_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "post_automations",
        "summary": "Automations: create",
        "description": "Add a card of your own: `title`, `group_key`, `definition` (`trigger`, `conditions`, `actions`).\n\n**Needs:** Automations at write, and Can message customers.\n\nExample from the developer page:\n\n```\nPOST /api/automations\n{\n  \"title\": \"Thank-you text\",\n  \"group_key\": \"jobs\",\n  \"definition\": {\n    \"trigger\": {\n      \"type\": \"job_completed\",\n      \"delayDays\": 1\n    },\n    \"conditions\": [],\n    \"actions\": [],\n    \"branches\": []\n  }\n}\n\n201\n{\n  \"id\": \"01M3JVF2V660AS4Y8RBXD3KA4G\",\n  \"tenant_id\": \"ten_flow\",\n  \"builtin_key\": null,\n  \"group_key\": \"jobs\",\n  \"title\": \"Thank-you text\",\n  \"enabled\": true,\n  ...\n}\n```",
        "tags": [
          "Automations"
        ],
        "security": [
          {
            "chalkKey": [
              "automations:send"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "automations",
          "kind": "send",
          "scope": "automations:send"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#automations"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "group_key": {
                    "type": "string"
                  },
                  "definition": {
                    "type": "object",
                    "properties": {
                      "trigger": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string"
                          },
                          "delayDays": {
                            "type": "integer"
                          }
                        }
                      },
                      "conditions": {
                        "type": "array"
                      },
                      "actions": {
                        "type": "array"
                      },
                      "branches": {
                        "type": "array"
                      }
                    }
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "title": "Thank-you text",
                "group_key": "jobs",
                "definition": {
                  "trigger": {
                    "type": "job_completed",
                    "delayDays": 1
                  },
                  "conditions": [],
                  "actions": [],
                  "branches": []
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_automations_send"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/automations/{id}": {
      "get": {
        "operationId": "get_automations_by_id",
        "summary": "Automations: read one",
        "description": "One card.\n\n**Needs:** Automations at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/automations/01M3JVF2R3S7CJ1SH5JG1G2BTS\n\n200\n{\n  \"id\": \"01M3JVF2R3S7CJ1SH5JG1G2BTS\",\n  \"tenant_id\": \"ten_flow\",\n  \"builtin_key\": \"lead_received\",\n  \"group_key\": \"leads\",\n  \"title\": \"New lead auto-text\",\n  \"enabled\": true,\n  \"definition\": {\n    \"trigger\": {\n      \"type\": \"lead_created\",\n      \"delayDays\": 0,\n      \"delayHours\": 0\n    },\n    \"conditions\": [],\n    \"actions\": [\n      {\n        \"id\": \"a1\",\n        \"type\": \"notify_client\",\n        \"channel\": \"auto\",\n        \"body\": \"Hi {first_name}, we got your request at {company}. We'll be in touch shortly to talk it...\",\n        \"subject\": \"We got your request at {company}\",\n        ...\n      },\n      ...\n    ],\n    \"branches\": []\n  },\n  \"created_at\": \"2026-09-28T01:53:26.275Z\",\n  \"updated_at\": \"2026-09-28T01:53:26.275Z\",\n  ...\n}\n```",
        "tags": [
          "Automations"
        ],
        "security": [
          {
            "chalkKey": [
              "automations:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "automations",
          "kind": "read",
          "scope": "automations:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#automations"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_automations_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "patch": {
        "operationId": "patch_automations_by_id",
        "summary": "Automations: update",
        "description": "Switch a card on or off (`enabled`), rename it (`title`), or change its steps (`definition`).\n\n**Needs:** Automations at write, and Can message customers.\n\nExample from the developer page:\n\n```\nPATCH /api/automations/01M3JVF2R3S7CJ1SH5JG1G2BTS\n{\n  \"enabled\": false\n}\n\n200\n{\n  \"id\": \"01M3JVF2R3S7CJ1SH5JG1G2BTS\",\n  \"tenant_id\": \"ten_flow\",\n  \"builtin_key\": \"lead_received\",\n  \"group_key\": \"leads\",\n  \"title\": \"New lead auto-text\",\n  \"enabled\": false,\n  \"definition\": {\n    \"trigger\": {\n      \"type\": \"lead_created\",\n      \"delayDays\": 0,\n      \"delayHours\": 0\n    },\n    \"conditions\": [],\n    \"actions\": [\n      {\n        \"id\": \"a1\",\n        \"type\": \"notify_client\",\n        \"channel\": \"auto\",\n        \"body\": \"Hi {first_name}, we got your request at {company}. We'll be in touch shortly to talk it...\",\n        \"subject\": \"We got your request at {company}\",\n        ...\n      },\n      ...\n    ],\n    \"branches\": []\n  },\n  \"created_at\": \"2026-09-28T01:53:26.275Z\",\n  \"updated_at\": \"2026-09-28T01:53:26.278Z\",\n  ...\n}\n```",
        "tags": [
          "Automations"
        ],
        "security": [
          {
            "chalkKey": [
              "automations:send"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "automations",
          "kind": "send",
          "scope": "automations:send"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#automations"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "enabled": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_automations_send"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      },
      "delete": {
        "operationId": "delete_automations_by_id",
        "summary": "Automations: delete",
        "description": "Take a card off.\n\n**Needs:** Automations at write.",
        "tags": [
          "Automations"
        ],
        "security": [
          {
            "chalkKey": [
              "automations:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "automations",
          "kind": "write",
          "scope": "automations:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#automations"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_automations_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/automations/pause": {
      "get": {
        "operationId": "get_automations_pause",
        "summary": "Automations: pause",
        "description": "Whether all automations are paused, since when, by whom, and how many messages the pause has held so far.\n\n**Needs:** Automations at read (or write).",
        "tags": [
          "Automations"
        ],
        "security": [
          {
            "chalkKey": [
              "automations:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "automations",
          "kind": "read",
          "scope": "automations:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#automations"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "paused": {
                      "type": "boolean"
                    },
                    "paused_at": {
                      "type": "string"
                    },
                    "paused_by": {
                      "type": "string"
                    },
                    "held": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "paused": true,
                  "paused_at": "2026-10-14T15:00:00.000Z",
                  "paused_by": "Jordan Lee",
                  "held": 3
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_automations_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "put": {
        "operationId": "put_automations_pause",
        "summary": "Automations: pause, set",
        "description": "Pause all automations: `{ \"paused\": true }`. While paused, nothing automatic goes to a customer (cards, ChalkBot routines and Just do it sends, the invoice a finished visit would send); what comes due is marked not sent and is not sent later. Sends a person presses still go, and so do answers to the customer's own action: a payment receipt, a booking confirmation, the HELP reply. A key can pause but not resume: `{ \"paused\": false }` answers 403, and an owner or admin resumes from the app.\n\n**Needs:** Automations at write.\n\n**Limit for keys:** Automations can only be resumed from the app while signed in. An API key can pause them, not start them again.",
        "tags": [
          "Automations"
        ],
        "security": [
          {
            "chalkKey": [
              "automations:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "automations",
          "kind": "write",
          "scope": "automations:write"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#automations"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "paused": {
                    "type": "boolean"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "paused": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "paused": {
                      "type": "boolean"
                    },
                    "paused_at": {
                      "type": "string"
                    },
                    "paused_by": {
                      "type": "string"
                    },
                    "held": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "paused": true,
                  "paused_at": "2026-10-14T15:00:00.000Z",
                  "paused_by": "Jordan Lee",
                  "held": 0
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_automations_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/automations/test-to": {
      "get": {
        "operationId": "get_automations_test_to",
        "summary": "Automations: test to",
        "description": "**Needs:** Automations at read (or write).",
        "tags": [
          "Automations"
        ],
        "security": [
          {
            "chalkKey": [
              "automations:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "automations",
          "kind": "read",
          "scope": "automations:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_automations_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/automations/from-template": {
      "post": {
        "operationId": "post_automations_from_template",
        "summary": "Automations: from template",
        "description": "Add a card from one of the built-in templates: `template_id` (for example `new_lead_text`).\n\n**Needs:** Automations at write, and Can message customers.\n\nExample from the developer page:\n\n```\nPOST /api/automations/from-template\n{\n  \"template_id\": \"new_lead_text\"\n}\n\n201\n{\n  \"workflow\": {\n    \"id\": \"01M3JVF2R3S7CJ1SH5JG1G2BTS\",\n    \"tenant_id\": \"ten_flow\",\n    \"builtin_key\": \"lead_received\",\n    \"group_key\": \"leads\",\n    \"title\": \"New lead auto-text\",\n    \"enabled\": true,\n    \"definition\": {\n      \"trigger\": ...,\n      \"conditions\": ...,\n      \"actions\": ...,\n      \"branches\": ...\n    },\n    \"created_at\": \"2026-09-28T01:53:26.275Z\",\n    \"updated_at\": \"2026-09-28T01:53:26.275Z\",\n    ...\n  },\n  \"created\": true\n}\n```",
        "tags": [
          "Automations"
        ],
        "security": [
          {
            "chalkKey": [
              "automations:send"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "automations",
          "kind": "send",
          "scope": "automations:send"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#automations"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "template_id": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "template_id": "new_lead_text"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_automations_send"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/automations/{id}/wording": {
      "put": {
        "operationId": "put_automations_by_id_wording",
        "summary": "Automations: wording, set",
        "description": "Change what a built-in card says. The fields are the card's own wording settings (the `tpl_...` keys it names), so the Settings screen and the card never disagree.\n\n**Needs:** Automations at write, and Can message customers.\n\nExample from the developer page:\n\n```\nPUT /api/automations/01M3JVF2MBJCK29EMH2A3GYV3B/wording\n{\n  \"tpl_visit_reminder_sms\": \"Hi {first_name}, the crew will be at {address} tomorrow between 8 and 9.\"\n}\n\n200\n{\n  \"id\": \"01M3JVF2MBJCK29EMH2A3GYV3B\",\n  \"tenant_id\": \"ten_flow\",\n  \"builtin_key\": \"visit_reminder\",\n  \"group_key\": \"visits\",\n  \"title\": \"Remind the day before a visit\",\n  \"enabled\": true,\n  \"definition\": {\n    \"trigger\": {\n      \"type\": \"visit_upcoming\",\n      \"delayDays\": 1,\n      \"delayHours\": 0,\n      \"hour\": 12\n    },\n    \"conditions\": [\n      {\n        \"id\": \"c1\",\n        \"type\": \"client_opt_in\",\n        \"op\": \"is\",\n        \"value\": \"reminders\"\n      },\n      ...\n    ],\n    \"actions\": [\n      {\n        \"id\": \"a1\",\n        \"type\": \"notify_client\",\n        \"channel\": \"auto\",\n        \"body\": \"Hi {first_name}, the crew will be at {address} tomorrow between 8 and 9.\",\n        \"subject\": \"Reminder: {company} is coming {date}\",\n        ...\n      },\n      ...\n    ],\n    \"branches\": []\n  },\n  \"created_at\": \"2026-09-28T01:53:26.155Z\",\n  \"updated_at\": \"2026-09-28T01:53:26.281Z\",\n  ...\n}\n```",
        "tags": [
          "Automations"
        ],
        "security": [
          {
            "chalkKey": [
              "automations:send"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "automations",
          "kind": "send",
          "scope": "automations:send"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#automations"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "tpl_visit_reminder_sms": {
                    "type": "string"
                  }
                },
                "description": "The fields the developer page's example sends. Not every field Chalk accepts."
              },
              "example": {
                "tpl_visit_reminder_sms": "Hi {first_name}, the crew will be at {address} tomorrow between 8 and 9."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_automations_send"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/automations/{id}/test": {
      "post": {
        "operationId": "post_automations_by_id_test",
        "summary": "Automations: test",
        "description": "**Needs:** Automations at write, and Can message customers.\n\n**Limit for keys:** A test can only be sent from the app by the person signed in.",
        "tags": [
          "Automations"
        ],
        "security": [
          {
            "chalkKey": [
              "automations:send"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "automations",
          "kind": "send",
          "scope": "automations:send"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_automations_send"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/automations/messages/{type}/test": {
      "post": {
        "operationId": "post_automations_messages_by_type_test",
        "summary": "Automations: messages test",
        "description": "**Needs:** Automations at write, and Can message customers.\n\n**Limit for keys:** A test can only be sent from the app by the person signed in.",
        "tags": [
          "Automations"
        ],
        "security": [
          {
            "chalkKey": [
              "automations:send"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "automations",
          "kind": "send",
          "scope": "automations:send"
        },
        "parameters": [
          {
            "name": "type",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_automations_send"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/admin/run-automations": {
      "post": {
        "operationId": "post_admin_run_automations",
        "summary": "Admin: run automations",
        "description": "**Needs:** Automations at write, and Can message customers.",
        "tags": [
          "Automations"
        ],
        "security": [
          {
            "chalkKey": [
              "automations:send"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "automations",
          "kind": "send",
          "scope": "automations:send"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_automations_send"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/admin/run-automations/check": {
      "post": {
        "operationId": "post_admin_run_automations_check",
        "summary": "Admin: run automations check",
        "description": "**Needs:** Automations at write.",
        "tags": [
          "Automations"
        ],
        "security": [
          {
            "chalkKey": [
              "automations:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "automations",
          "kind": "write",
          "scope": "automations:write"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_automations_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/automation-rules": {
      "get": {
        "operationId": "get_automation_rules",
        "summary": "Automation rules: read",
        "description": "**Needs:** Automations at read (or write).",
        "tags": [
          "Automations"
        ],
        "security": [
          {
            "chalkKey": [
              "automations:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "automations",
          "kind": "read",
          "scope": "automations:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_automations_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "post_automation_rules",
        "summary": "Automation rules: create",
        "description": "**Needs:** Automations at write, and Can message customers.",
        "tags": [
          "Automations"
        ],
        "security": [
          {
            "chalkKey": [
              "automations:send"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "automations",
          "kind": "send",
          "scope": "automations:send"
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_automations_send"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/automation-rules/{id}": {
      "patch": {
        "operationId": "patch_automation_rules_by_id",
        "summary": "Automation rules: update",
        "description": "**Needs:** Automations at write, and Can message customers.",
        "tags": [
          "Automations"
        ],
        "security": [
          {
            "chalkKey": [
              "automations:send"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "automations",
          "kind": "send",
          "scope": "automations:send"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_automations_send"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      },
      "delete": {
        "operationId": "delete_automation_rules_by_id",
        "summary": "Automation rules: delete",
        "description": "**Needs:** Automations at write.",
        "tags": [
          "Automations"
        ],
        "security": [
          {
            "chalkKey": [
              "automations:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "automations",
          "kind": "write",
          "scope": "automations:write"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_automations_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/users/me": {
      "get": {
        "operationId": "get_users_me",
        "summary": "Users: me",
        "description": "Who this key acts as: the person, their role and switches, whether they may set crew pay, and the key's scopes and call cap. Check it once instead of learning your limits one 403 at a time.\n\n**Needs:** Any key, whatever its areas.\n\nExample from the developer page:\n\n```\nGET /api/users/me\n\n200\n{\n  \"user\": {\n    \"id\": \"usr_owner\",\n    \"name\": \"Sam Carter\",\n    \"role\": \"owner\",\n    \"email\": \"sam@upstatepainting.example\"\n  },\n  \"shop\": {\n    \"id\": \"ten_flow\",\n    \"name\": \"Upstate Painting Co\",\n    \"timezone\": \"America/New_York\"\n  },\n  \"perms\": {\n    \"sales\": true,\n    \"schedule\": \"all\",\n    \"schedule_write\": true,\n    \"job_prices\": true,\n    \"invoices\": \"full\",\n    \"money\": \"full\",\n    \"reports\": true,\n    \"chalkbot\": true,\n    \"messaging\": true\n  },\n  \"may_set_crew_pay\": true,\n  \"api_key\": {\n    \"id\": \"key_tour\",\n    \"name\": \"Estimator\",\n    \"prefix\": \"chk_live_key_tou\",\n    \"scopes\": [\n      \"read\",\n      ...\n    ],\n    \"created_at\": \"2026-09-28T01:53:24.834Z\",\n    \"last_used_at\": \"2026-09-28T01:53:25.066Z\",\n    \"calls_per_minute\": 240,\n    \"access\": {\n      \"areas\": {\n        \"clients\": \"write\",\n        \"sales\": \"write\",\n        \"schedule\": \"read\",\n        ...\n      },\n      \"send\": false\n    },\n    \"acts_as\": \"owner\",\n    \"expires_at\": null\n  }\n}\n```",
        "tags": [
          "Key"
        ],
        "security": [
          {
            "chalkKey": []
          }
        ],
        "x-chalk-permission": {
          "area": "any",
          "kind": "read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#board"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_any"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/users": {
      "get": {
        "operationId": "get_users",
        "summary": "Users: read",
        "description": "Who can be assigned. Creating users stays in the app.\n\n**Needs:** Team at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/users\n\n200\n[\n  {\n    \"id\": \"usr_admin\",\n    \"initials\": \"u2\",\n    \"email\": \"jess@upstatepainting.example\",\n    \"name\": \"Jess Rowe\",\n    \"phone\": null,\n    \"role\": \"admin\",\n    \"color\": \"#111\",\n    \"active\": 1,\n    ...\n  },\n  ...\n]\n```",
        "tags": [
          "Team"
        ],
        "security": [
          {
            "chalkKey": [
              "team:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "team",
          "kind": "read",
          "scope": "team:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#board"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_team_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/users/{id}": {
      "patch": {
        "operationId": "patch_users_by_id",
        "summary": "Users: update",
        "description": "**Needs:** Team at write.\n\nRefused when the person named in the path is an owner, an admin, or the person who made the key.\n\nRefused when the body makes anybody an owner or admin.\n\nRefused when the body changes a teammate's email or phone (where their sign-in links go).\n\nChanging what a teammate is paid (`pay_type`, `pay_rate_cents`, `commission_bp`, `commission_basis`, `salesperson_bp`, `pay_timing`) also needs write on Payments and money.",
        "tags": [
          "Team"
        ],
        "security": [
          {
            "chalkKey": [
              "team:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "team",
          "kind": "write",
          "scope": "team:write",
          "guards": [
            "team_target",
            "team_role",
            "team_login",
            "team_pay"
          ]
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_team_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/users/{id}/reset-pin": {
      "post": {
        "operationId": "post_users_by_id_reset_pin",
        "summary": "Users: reset pin",
        "description": "**Needs:** Team at write.\n\nRefused when the person named in the path is an owner, an admin, or the person who made the key.",
        "tags": [
          "Team"
        ],
        "security": [
          {
            "chalkKey": [
              "team:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "team",
          "kind": "write",
          "scope": "team:write",
          "guards": [
            "team_target"
          ]
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_team_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/users/{id}/unlock": {
      "post": {
        "operationId": "post_users_by_id_unlock",
        "summary": "Users: unlock",
        "description": "**Needs:** Team at write.\n\nRefused when the person named in the path is an owner, an admin, or the person who made the key.",
        "tags": [
          "Team"
        ],
        "security": [
          {
            "chalkKey": [
              "team:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "team",
          "kind": "write",
          "scope": "team:write",
          "guards": [
            "team_target"
          ]
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_team_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/team": {
      "get": {
        "operationId": "get_team",
        "summary": "Team: read",
        "description": "The team with roles and pay types. Owner or admin key. Invites stay in the app. With write on Team a key can change people below admin, never an owner, an admin or the person who made it.\n\n**Needs:** Team at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/team\n\n200\n{\n  \"people\": [\n    {\n      \"id\": \"usr_owner\",\n      \"initials\": \"u1\",\n      \"email\": \"sam@upstatepainting.example\",\n      ...\n    },\n    ...\n  ],\n  \"policy\": {\n    \"password\": \"optional\",\n    \"pin\": \"off\"\n  }\n}\n```",
        "tags": [
          "Team"
        ],
        "security": [
          {
            "chalkKey": [
              "team:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "team",
          "kind": "read",
          "scope": "team:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#board"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_team_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/team/permissions": {
      "get": {
        "operationId": "get_team_permissions",
        "summary": "Team: permissions",
        "description": "**Needs:** Team at read (or write).",
        "tags": [
          "Team"
        ],
        "security": [
          {
            "chalkKey": [
              "team:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "team",
          "kind": "read",
          "scope": "team:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_team_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "put": {
        "operationId": "put_team_permissions",
        "summary": "Team: permissions, set",
        "description": "**Needs:** Team at write.\n\nRefused when the role grid changes what the key's own role, or its maker's role, can reach.",
        "tags": [
          "Team"
        ],
        "security": [
          {
            "chalkKey": [
              "team:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "team",
          "kind": "write",
          "scope": "team:write",
          "guards": [
            "team_perms"
          ]
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_team_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/team/{id}": {
      "patch": {
        "operationId": "patch_team_by_id",
        "summary": "Team: update",
        "description": "**Needs:** Team at write.\n\nRefused when the person named in the path is an owner, an admin, or the person who made the key.\n\nRefused when the body makes anybody an owner or admin.\n\nRefused when the body changes a teammate's email or phone (where their sign-in links go).\n\nChanging what a teammate is paid (`pay_type`, `pay_rate_cents`, `commission_bp`, `commission_basis`, `salesperson_bp`, `pay_timing`) also needs write on Payments and money.",
        "tags": [
          "Team"
        ],
        "security": [
          {
            "chalkKey": [
              "team:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "team",
          "kind": "write",
          "scope": "team:write",
          "guards": [
            "team_target",
            "team_role",
            "team_login",
            "team_pay"
          ]
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_team_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      },
      "delete": {
        "operationId": "delete_team_by_id",
        "summary": "Team: delete",
        "description": "**Needs:** Team at write.\n\nRefused when the person named in the path is an owner, an admin, or the person who made the key.",
        "tags": [
          "Team"
        ],
        "security": [
          {
            "chalkKey": [
              "team:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "team",
          "kind": "write",
          "scope": "team:write",
          "guards": [
            "team_target"
          ]
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_team_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/team/{id}/sign-out": {
      "post": {
        "operationId": "post_team_by_id_sign_out",
        "summary": "Team: sign out",
        "description": "**Needs:** Team at write.\n\nRefused when the person named in the path is an owner, an admin, or the person who made the key.",
        "tags": [
          "Team"
        ],
        "security": [
          {
            "chalkKey": [
              "team:write"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "team",
          "kind": "write",
          "scope": "team:write",
          "guards": [
            "team_target"
          ]
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "A JSON object, the same fields the app sends for this command."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            },
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_team_write"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyKeyReused"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          }
        }
      }
    },
    "/api/dashboard": {
      "get": {
        "operationId": "get_dashboard",
        "summary": "Dashboard: read",
        "description": "What is open: leads, quotes waiting, jobs, money owed.\n\n**Needs:** Reports at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/dashboard\n\n200\n{\n  \"deltas\": {\n    \"revenue_pct\": null,\n    \"close_rate_pts\": null,\n    \"won_value_pct\": null\n  },\n  \"on_clock\": [],\n  \"revenue_this_month_cents\": 25000,\n  \"goals\": [],\n  \"quotes_90d\": {\n    \"count\": 2,\n    \"value_cents\": 147250\n  },\n  \"won_90d\": {\n    \"count\": 1,\n    \"value_cents\": 73625\n  },\n  \"lost_90d\": 0,\n  ...\n}\n```",
        "tags": [
          "Reports"
        ],
        "security": [
          {
            "chalkKey": [
              "reports:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "reports",
          "kind": "read",
          "scope": "reports:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#board"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_reports_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/dashboard/goals": {
      "get": {
        "operationId": "get_dashboard_goals",
        "summary": "Dashboard: goals",
        "description": "The Chalkboard's goals (money collected or work sold, jobs finished, new leads, close rate) over one period, each against its target scaled to that period: `?period=last_90` (or `last_7`, `last_30`, `this_month`, `this_quarter`, `this_year`). Left out, the period the person picked on the Chalkboard. Only the targets that are set. Money in cents, rates in basis points. Needs Reports. The key's role needs Customers and quotes, or See shop goals for a role without it (the owner and admins always read them). Money goals also need Revenue on the Chalkboard.\n\n**Needs:** Reports at read (or write).",
        "tags": [
          "Reports"
        ],
        "security": [
          {
            "chalkKey": [
              "reports:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "reports",
          "kind": "read",
          "scope": "reports:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#board"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_reports_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/dashboard/notifications": {
      "get": {
        "operationId": "get_dashboard_notifications",
        "summary": "Dashboard: notifications",
        "description": "**Needs:** Reports at read (or write).",
        "tags": [
          "Reports"
        ],
        "security": [
          {
            "chalkKey": [
              "reports:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "reports",
          "kind": "read",
          "scope": "reports:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_reports_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/dashboard/payments-received": {
      "get": {
        "operationId": "get_dashboard_payments_received",
        "summary": "Dashboard: payments received",
        "description": "**Needs:** Reports at read (or write).",
        "tags": [
          "Reports"
        ],
        "security": [
          {
            "chalkKey": [
              "reports:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "reports",
          "kind": "read",
          "scope": "reports:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_reports_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/dashboard/referrals": {
      "get": {
        "operationId": "get_dashboard_referrals",
        "summary": "Dashboard: referrals",
        "description": "Who sent work, and what those people earned.\n\n**Needs:** Reports at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/dashboard/referrals\n\n200\n{\n  \"signups\": 0,\n  \"payouts_owed_cents\": 0,\n  \"payouts_paid_cents\": 0,\n  \"won_revenue_cents\": 0,\n  \"signups_by_month\": [\n    {\n      \"month\": \"2025-10\",\n      \"signups\": 0\n    },\n    ...\n  ],\n  \"earnings_by_month\": [\n    {\n      \"month\": \"2025-10\",\n      \"paid_cents\": 0,\n      \"pending_cents\": 0\n    },\n    ...\n  ],\n  \"referrers\": [],\n  \"empty\": true\n}\n```",
        "tags": [
          "Reports"
        ],
        "security": [
          {
            "chalkKey": [
              "reports:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "reports",
          "kind": "read",
          "scope": "reports:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#board"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_reports_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/dashboard/reports": {
      "get": {
        "operationId": "get_dashboard_reports",
        "summary": "Dashboard: reports",
        "description": "The numbers, read only: money by month, who sells, lead sources, and `job_profit[]` (each finished job's revenue, costs, crew pay and profit). Needs Reports.\n\n**Needs:** Reports at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/dashboard/reports\n\n200\n{\n  \"monthly\": [\n    {\n      \"month\": \"2026-09\",\n      \"collected_cents\": 25000,\n      \"payments\": 1\n    },\n    ...\n  ],\n  \"by_salesperson\": [\n    {\n      \"name\": \"Sam Carter\",\n      \"quoted_count\": 2,\n      \"quoted_cents\": 147250,\n      \"won_count\": 1,\n      ...\n    },\n    ...\n  ],\n  \"by_source\": [\n    {\n      \"source\": \"website\",\n      \"leads\": 1,\n      \"won_jobs\": 1,\n      \"won\": 1,\n      ...\n    },\n    ...\n  ],\n  \"job_profit\": [\n    {\n      \"id\": \"01M3JVF2D4HZ9B61Q6VK4SG6SY\",\n      \"number\": 1,\n      \"title\": \"Fence staining - 200 ft, both sides\",\n      \"total_cents\": 73625,\n      ...\n    },\n    ...\n  ],\n  \"by_job_type\": [\n    {\n      \"name\": \"Not categorised\",\n      \"jobs\": 1,\n      \"total_cents\": 73625\n    },\n    ...\n  ],\n  \"expense_mix\": [\n    {\n      \"name\": \"materials\",\n      \"total_cents\": 18000,\n      \"n\": 1\n    },\n    ...\n  ],\n  \"quote_outcomes\": [\n    {\n      \"name\": \"Won\",\n      \"n\": 1,\n      \"total_cents\": 73625\n    },\n    ...\n  ],\n  \"repeat_vs_new\": [\n    {\n      \"month\": \"2026-09\",\n      \"repeat_jobs\": 0,\n      \"new_jobs\": 1\n    },\n    ...\n  ]\n}\n```",
        "tags": [
          "Reports"
        ],
        "security": [
          {
            "chalkKey": [
              "reports:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "reports",
          "kind": "read",
          "scope": "reports:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#board"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_reports_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/dashboard/to-collect": {
      "get": {
        "operationId": "get_dashboard_to_collect",
        "summary": "Dashboard: to collect",
        "description": "**Needs:** Invoices at read (or write).",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "chalkKey": [
              "invoices:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "invoices",
          "kind": "read",
          "scope": "invoices:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_invoices_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/dashboard/timesheets": {
      "get": {
        "operationId": "get_dashboard_timesheets",
        "summary": "Dashboard: timesheets",
        "description": "The week's time: every punch and each person's hours: `?week=YYYY-MM-DD`.\n\n**Needs:** Reports at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/dashboard/timesheets\n\n200\n{\n  \"week\": \"2026-09-27\",\n  \"on_ledger\": true,\n  \"wages_since\": \"2026-09-27T04:00:00.000Z\",\n  \"locked\": false,\n  \"entries\": [],\n  \"team\": [\n    {\n      \"id\": \"usr_admin\",\n      \"name\": \"Jess Rowe\",\n      \"color\": \"#111\",\n      \"role\": \"admin\",\n      ...\n    },\n    ...\n  ]\n}\n```",
        "tags": [
          "Reports"
        ],
        "security": [
          {
            "chalkKey": [
              "reports:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "reports",
          "kind": "read",
          "scope": "reports:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#pay"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_reports_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/books/month": {
      "get": {
        "operationId": "get_books_month",
        "summary": "Books: month",
        "description": "The month's books: collected, fees, spend, pay: `?month=YYYY-MM`. Needs Reports.\n\n**Needs:** Reports at read (or write).\n\nExample from the developer page:\n\n```\nGET /api/books/month?month=2026-09\n\n200\n{\n  \"timezone\": \"America/New_York\",\n  \"month\": \"2026-09\",\n  \"collected_cents\": 25000,\n  \"surcharge_cents\": 0,\n  \"fee_cents\": 0,\n  \"klarna_fee_cents\": 0,\n  \"labor_cents\": 0,\n  \"expense_cents\": 18000,\n  \"expense_n\": 1,\n  \"payouts_cents\": 25000,\n  ...\n}\n```",
        "tags": [
          "Reports"
        ],
        "security": [
          {
            "chalkKey": [
              "reports:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "reports",
          "kind": "read",
          "scope": "reports:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#pay"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_reports_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/reports/dashboard": {
      "get": {
        "operationId": "get_reports_dashboard",
        "summary": "Reports: dashboard",
        "description": "The Reports page for one period: what the finished jobs made (sold, direct costs, gross profit, overhead, profit shares, net profit), cash in and out, overhead, targets, pay per person, expenses, sales and what is owed. `?period=this_month` (or `last_month`, `this_quarter`, `last_7`, `last_30`, `last_90`, `this_year`, `last_year`, `custom` with `from` and `to` as YYYY-MM-DD), `&compare=1` for the period before. Money in cents. Needs Reports.\n\n**Needs:** Reports at read (or write).",
        "tags": [
          "Reports"
        ],
        "security": [
          {
            "chalkKey": [
              "reports:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "reports",
          "kind": "read",
          "scope": "reports:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#board"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "period": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string"
                        },
                        "fromDay": {
                          "type": "string"
                        },
                        "toDay": {
                          "type": "string"
                        },
                        "label": {
                          "type": "string"
                        }
                      }
                    },
                    "summary": {
                      "type": "object",
                      "properties": {
                        "jobs": {
                          "type": "integer"
                        },
                        "sold_cents": {
                          "type": "integer"
                        },
                        "sold_net_cents": {
                          "type": "integer"
                        },
                        "gross_cents": {
                          "type": "integer"
                        },
                        "net_cents": {
                          "type": "integer"
                        },
                        "net_margin_bp": {
                          "type": "integer"
                        }
                      }
                    },
                    "cash": {
                      "type": "object",
                      "properties": {
                        "collected_cents": {
                          "type": "integer"
                        },
                        "tax_cents": {
                          "type": "integer"
                        },
                        "leftover_cents": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "period": {
                    "key": "last_month",
                    "fromDay": "2026-09-01",
                    "toDay": "2026-10-01",
                    "label": "September 2026"
                  },
                  "summary": {
                    "jobs": 8,
                    "sold_cents": 1953100,
                    "sold_net_cents": 1953100,
                    "gross_cents": 1104200,
                    "net_cents": 812600,
                    "net_margin_bp": 4161
                  },
                  "cash": {
                    "collected_cents": 1820000,
                    "tax_cents": 0,
                    "leftover_cents": 640300
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_reports_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/team/performance": {
      "get": {
        "operationId": "get_team_performance",
        "summary": "Team: performance",
        "description": "**Needs:** Reports at read (or write).",
        "tags": [
          "Reports"
        ],
        "security": [
          {
            "chalkKey": [
              "reports:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "reports",
          "kind": "read",
          "scope": "reports:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_reports_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/inventory/summary": {
      "get": {
        "operationId": "get_inventory_summary",
        "summary": "Inventory: summary",
        "description": "Counts at a glance: items, versions, running low, tools out and overdue. `ready` is false until Inventory is set up.\n\n**Needs:** Inventory at read (or write).",
        "tags": [
          "Inventory"
        ],
        "security": [
          {
            "chalkKey": [
              "inventory:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "inventory",
          "kind": "read",
          "scope": "inventory:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#inventory"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ready": {
                      "type": "boolean"
                    },
                    "items": {
                      "type": "integer"
                    },
                    "versions": {
                      "type": "integer"
                    },
                    "low": {
                      "type": "integer"
                    },
                    "value_cents": {
                      "type": "integer"
                    },
                    "tools": {
                      "type": "integer"
                    },
                    "tools_out": {
                      "type": "integer"
                    },
                    "tools_overdue": {
                      "type": "integer"
                    },
                    "tools_repair": {
                      "type": "integer"
                    },
                    "locations_on": {
                      "type": "boolean"
                    },
                    "settings": {
                      "type": "object",
                      "properties": {
                        "cost_mode": {
                          "type": "string"
                        },
                        "on_complete": {
                          "type": "string"
                        },
                        "low_alerts": {
                          "type": "boolean"
                        },
                        "overdue_alerts": {
                          "type": "boolean"
                        },
                        "tool_due_days": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "ready": true,
                  "items": 24,
                  "versions": 41,
                  "low": 3,
                  "value_cents": 286400,
                  "tools": 9,
                  "tools_out": 2,
                  "tools_overdue": 1,
                  "tools_repair": 0,
                  "locations_on": false,
                  "settings": {
                    "cost_mode": "planned",
                    "on_complete": "ask",
                    "low_alerts": true,
                    "overdue_alerts": true,
                    "tool_due_days": 1
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_inventory_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/inventory/items": {
      "get": {
        "operationId": "get_inventory_items",
        "summary": "Inventory: items",
        "description": "The stock list. Optional `?q=` (name, SKU, supplier, version), `group=`, `low=1`, `archived=1`, `limit=` (up to 200). `total` is the whole count; pass `next_cursor` back as `cursor=` for the next page.\n\n**Needs:** Inventory at read (or write).",
        "tags": [
          "Inventory"
        ],
        "security": [
          {
            "chalkKey": [
              "inventory:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "inventory",
          "kind": "read",
          "scope": "inventory:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#inventory"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "group": {
                            "type": "string"
                          },
                          "unit": {
                            "type": "string"
                          },
                          "pack_size": {
                            "type": "integer"
                          },
                          "cost_cents": {
                            "type": "integer"
                          },
                          "price_cents": {},
                          "low_at": {
                            "type": "integer"
                          },
                          "reorder_qty": {
                            "type": "integer"
                          },
                          "sku": {},
                          "supplier": {
                            "type": "string"
                          },
                          "attributes": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "on_hand": {
                            "type": "integer"
                          },
                          "low": {
                            "type": "boolean"
                          },
                          "value_cents": {
                            "type": "integer"
                          },
                          "variants": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "item_id": {
                                  "type": "string"
                                },
                                "label": {
                                  "type": "string"
                                },
                                "values": {
                                  "type": "object",
                                  "properties": {
                                    "Color": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "is_default": {
                                  "type": "boolean"
                                },
                                "sku": {},
                                "cost_cents": {},
                                "low_at": {},
                                "on_hand": {
                                  "type": "integer"
                                },
                                "low": {
                                  "type": "boolean"
                                },
                                "archived": {
                                  "type": "boolean"
                                }
                              }
                            }
                          },
                          "starter_key": {
                            "type": "string"
                          },
                          "archived": {
                            "type": "boolean"
                          },
                          "updated_at": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "groups": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "total": {
                      "type": "integer"
                    },
                    "next_cursor": {}
                  }
                },
                "example": {
                  "items": [
                    {
                      "id": "01M3JVF2952CTWCVJEE4MYBNHW",
                      "name": "Semi-transparent deck stain",
                      "group": "Stains and sealers",
                      "unit": "gallon",
                      "pack_size": 1,
                      "cost_cents": 4050,
                      "price_cents": null,
                      "low_at": 4,
                      "reorder_qty": 10,
                      "sku": null,
                      "supplier": "Paint store",
                      "attributes": [
                        "Color"
                      ],
                      "on_hand": 9,
                      "low": true,
                      "value_cents": 36450,
                      "variants": [
                        {
                          "id": "01M3JVF295J4AXJECSQWP36B7K",
                          "item_id": "01M3JVF2952CTWCVJEE4MYBNHW",
                          "label": "Cedar",
                          "values": {
                            "Color": "Cedar"
                          },
                          "is_default": false,
                          "sku": null,
                          "cost_cents": null,
                          "low_at": null,
                          "on_hand": 3,
                          "low": true,
                          "archived": false
                        }
                      ],
                      "starter_key": "stain_semi_transparent",
                      "archived": false,
                      "updated_at": "2026-10-17T14:02:11.000Z"
                    }
                  ],
                  "groups": [
                    "Coatings",
                    "Stains and sealers",
                    "Sundries"
                  ],
                  "total": 1,
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_inventory_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/inventory/items/{id}": {
      "get": {
        "operationId": "get_inventory_items_by_id",
        "summary": "Inventory: items, read one",
        "description": "One item with its versions, its newest 50 changes and what points at it (price-book materials and common expenses).\n\n**Needs:** Inventory at read (or write).",
        "tags": [
          "Inventory"
        ],
        "security": [
          {
            "chalkKey": [
              "inventory:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "inventory",
          "kind": "read",
          "scope": "inventory:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#inventory"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_inventory_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/inventory/moves": {
      "get": {
        "operationId": "get_inventory_moves",
        "summary": "Inventory: moves",
        "description": "Every stock change, newest first. Optional `item_id=`, `variant_id=`, `job_id=`, `kind=` (received, used, returned, adjusted, counted, moved, starting, carried_over), `cursor=`.\n\n**Needs:** Inventory at read (or write).",
        "tags": [
          "Inventory"
        ],
        "security": [
          {
            "chalkKey": [
              "inventory:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "inventory",
          "kind": "read",
          "scope": "inventory:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#inventory"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_inventory_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/inventory/starters": {
      "get": {
        "operationId": "get_inventory_starters",
        "summary": "Inventory: starters",
        "description": "The starter lists for each trade, and which keys the shop already added. `/api/inventory/price-book-candidates` lists the price-book materials and what each is linked to.\n\n**Needs:** Inventory at read (or write).",
        "tags": [
          "Inventory"
        ],
        "security": [
          {
            "chalkKey": [
              "inventory:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "inventory",
          "kind": "read",
          "scope": "inventory:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#inventory"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_inventory_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/inventory/price-book-candidates": {
      "get": {
        "operationId": "get_inventory_price_book_candidates",
        "summary": "Inventory: price book candidates",
        "description": "**Needs:** Inventory at read (or write).",
        "tags": [
          "Inventory"
        ],
        "security": [
          {
            "chalkKey": [
              "inventory:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "inventory",
          "kind": "read",
          "scope": "inventory:read"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_inventory_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/inventory/export.csv": {
      "get": {
        "operationId": "get_inventory_export_csv",
        "summary": "Inventory: export csv",
        "description": "Every item and version as a spreadsheet, one row per version.\n\n**Needs:** Inventory at read (or write).",
        "tags": [
          "Inventory"
        ],
        "security": [
          {
            "chalkKey": [
              "inventory:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "inventory",
          "kind": "read",
          "scope": "inventory:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#inventory"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_inventory_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/inventory/shopping-list": {
      "get": {
        "operationId": "get_inventory_shopping_list",
        "summary": "Inventory: shopping list",
        "description": "Everything running low, grouped by supplier, with a suggested amount to buy.\n\n**Needs:** Inventory at read (or write).",
        "tags": [
          "Inventory"
        ],
        "security": [
          {
            "chalkKey": [
              "inventory:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "inventory",
          "kind": "read",
          "scope": "inventory:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#inventory"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_inventory_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/inventory/locations": {
      "get": {
        "operationId": "get_inventory_locations",
        "summary": "Inventory: locations",
        "description": "The places stock can sit, and whether more than one is switched on.\n\n**Needs:** Inventory at read (or write).",
        "tags": [
          "Inventory"
        ],
        "security": [
          {
            "chalkKey": [
              "inventory:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "inventory",
          "kind": "read",
          "scope": "inventory:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#inventory"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_inventory_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/inventory/assets": {
      "get": {
        "operationId": "get_inventory_assets",
        "summary": "Inventory: assets",
        "description": "Tools and equipment. Optional `status=` (available, out, overdue, repair, retired, archived), `q=`, `mine=1`. `/api/inventory/assets/:id` adds who had it and when.\n\n**Needs:** Inventory at read (or write).",
        "tags": [
          "Inventory"
        ],
        "security": [
          {
            "chalkKey": [
              "inventory:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "inventory",
          "kind": "read",
          "scope": "inventory:read"
        },
        "externalDocs": {
          "url": "https://www.chalkcrm.com/dev#inventory"
        },
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_inventory_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/api/inventory/assets/{id}": {
      "get": {
        "operationId": "get_inventory_assets_by_id",
        "summary": "Inventory: assets, read one",
        "description": "**Needs:** Inventory at read (or write).",
        "tags": [
          "Inventory"
        ],
        "security": [
          {
            "chalkKey": [
              "inventory:read"
            ]
          }
        ],
        "x-chalk-permission": {
          "area": "inventory",
          "kind": "read",
          "scope": "inventory:read"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "JSON. The same answer the app gets for this command."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden_inventory_read"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "chalkKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "chk_live_...",
        "description": "A Custom API key from Settings, Connectors, Custom API: `Authorization: Bearer chk_live_...`. Shown once when it is made. An operation's security lists the permission it needs as `area:kind`."
      }
    },
    "parameters": {
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string",
          "minLength": 8,
          "maxLength": 200
        },
        "description": "Any unique string, 8 to 200 characters, for this one change. Send the same key when you retry. Within 8 days, a repeat with the same key, method, path and body gets the first answer back (with `Idempotent-Replayed: true`) and the work is not done twice. The same key with a different body is a 422. Server errors, 401, 402, 408 and 429 are not kept, so a retry runs again. Each API key has its own keys, apart from the person who made it. A key shorter than 8 or longer than 200 characters is ignored."
      }
    },
    "headers": {
      "IdempotentReplayed": {
        "description": "`true` when this is the kept answer to an earlier request with the same Idempotency-Key.",
        "schema": {
          "type": "string",
          "enum": [
            "true"
          ]
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "What went wrong, in plain words."
          },
          "detail": {
            "description": "There when there is something to name, like `{ \"field\": \"line_items[0].quantity\" }`."
          }
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Something in the request is wrong or unknown. A field Chalk would not save is refused by name, in `detail.field`, never dropped quietly.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "No key, a revoked key, or a key whose maker is no longer active. An expired key says so: \"This API key has expired. An owner or admin can give it a new end date in Settings, Connectors, Custom API.\"",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "PaymentRequired": {
        "description": "The shop's Chalk subscription has lapsed. `detail.billing` says why. Help tickets still work.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "Not in this shop. An id from another shop answers the same as one that never existed.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Conflict": {
        "description": "A clash: a visit on top of another (send `force: true`), or a stale save (`base_updated_at` must be exactly the `updated_at` you read).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "More than 240 calls this minute from this key. Wait for `Retry-After` seconds.",
        "headers": {
          "Retry-After": {
            "description": "Seconds until the next minute starts.",
            "schema": {
              "type": "integer"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "IdempotencyKeyReused": {
        "description": "That Idempotency-Key was already used for a different change, so nothing was saved. `detail.code` is `idempotency_key_reused`. Use a new key.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_any": {
        "description": "The account is closed, or not on the AI plan. Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_automations_read": {
        "description": "The key does not hold Automations at read (or write): \"This API key cannot see Automations. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_automations_send": {
        "description": "The key does not hold Automations at write, and Can message customers: \"This API key cannot change Automations. An owner or admin can change that in Settings, Connectors, Custom API.\" or \"This API key cannot message customers. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_automations_write": {
        "description": "The key does not hold Automations at write: \"This API key cannot change Automations. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_clients_read": {
        "description": "The key does not hold Clients at read (or write): \"This API key cannot see Clients. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_clients_send": {
        "description": "The key does not hold Clients at write, and Can message customers: \"This API key cannot change Clients. An owner or admin can change that in Settings, Connectors, Custom API.\" or \"This API key cannot message customers. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_clients_write": {
        "description": "The key does not hold Clients at write: \"This API key cannot change Clients. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_files_read": {
        "description": "The key does not hold Files at read (or write): \"This API key cannot see Files. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_files_write": {
        "description": "The key does not hold Files at write: \"This API key cannot change Files. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_inventory_read": {
        "description": "The key does not hold Inventory at read (or write): \"This API key cannot see Inventory. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_invoices_read": {
        "description": "The key does not hold Invoices at read (or write): \"This API key cannot see Invoices. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_invoices_send": {
        "description": "The key does not hold Invoices at write, and Can message customers: \"This API key cannot change Invoices. An owner or admin can change that in Settings, Connectors, Custom API.\" or \"This API key cannot message customers. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_invoices_write": {
        "description": "The key does not hold Invoices at write: \"This API key cannot change Invoices. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_messages_read": {
        "description": "The key does not hold Messages at read (or write): \"This API key cannot see Messages. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_messages_send": {
        "description": "The key does not hold Messages at write, and Can message customers: \"This API key cannot change Messages. An owner or admin can change that in Settings, Connectors, Custom API.\" or \"This API key cannot message customers. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_messages_write": {
        "description": "The key does not hold Messages at write: \"This API key cannot change Messages. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_payments_money_money": {
        "description": "The key does not hold Payments and money at write (the money permission): \"This API key cannot move money. It needs write on Payments and money. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_payments_money_money_or_crew_pay_write": {
        "description": "The key does not hold Payments and money at write (the money permission), or Crew pay at write: \"This API key cannot add or change crew pay. It needs write on Crew pay. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_payments_money_read": {
        "description": "The key does not hold Payments and money at read (or write): \"This API key cannot see Payments and money. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_payments_money_read_or_crew_pay_read": {
        "description": "The key does not hold Payments and money at read (or write), or Crew pay at read (or write): \"This API key cannot see pay. It needs read on Crew pay or on Payments and money. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_payments_money_send": {
        "description": "The key does not hold Payments and money at write, and Can message customers: \"This API key cannot change Payments and money. An owner or admin can change that in Settings, Connectors, Custom API.\" or \"This API key cannot message customers. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_payments_money_write": {
        "description": "The key does not hold Payments and money at write: \"This API key cannot change Payments and money. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_payments_money_write_or_crew_pay_write": {
        "description": "The key does not hold Payments and money at write, or Crew pay at write: \"This API key cannot add or change crew pay. It needs write on Crew pay. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_reports_read": {
        "description": "The key does not hold Reports at read (or write): \"This API key cannot see Reports. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_sales_read": {
        "description": "The key does not hold Sales at read (or write): \"This API key cannot see Sales. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_sales_send": {
        "description": "The key does not hold Sales at write, and Can message customers: \"This API key cannot change Sales. An owner or admin can change that in Settings, Connectors, Custom API.\" or \"This API key cannot message customers. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_sales_write": {
        "description": "The key does not hold Sales at write: \"This API key cannot change Sales. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_schedule_read": {
        "description": "The key does not hold Schedule at read (or write): \"This API key cannot see Schedule. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_schedule_send": {
        "description": "The key does not hold Schedule at write, and Can message customers: \"This API key cannot change Schedule. An owner or admin can change that in Settings, Connectors, Custom API.\" or \"This API key cannot message customers. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_schedule_write": {
        "description": "The key does not hold Schedule at write: \"This API key cannot change Schedule. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_settings_read": {
        "description": "The key does not hold Settings at read (or write): \"This API key cannot see Settings. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_settings_write": {
        "description": "The key does not hold Settings at write: \"This API key cannot change Settings. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_team_read": {
        "description": "The key does not hold Team at read (or write): \"This API key cannot see Team. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden_team_write": {
        "description": "The key does not hold Team at write: \"This API key cannot change Team. An owner or admin can change that in Settings, Connectors, Custom API.\" Also a 403 when the person the key acts as cannot do this in the app, or when a check in the operation's description refuses it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "IdempotencyInProgress": {
        "description": "An earlier request with the same Idempotency-Key is still running. `detail.code` is `idempotency_in_progress`. Try again in a moment.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    }
  }
}
