{
  "schemes": [
    "https"
  ],
  "swagger": "2.0",
  "info": {
    "description": "Streaming endpoints for ServiceKeel operations.",
    "title": "ServiceKeel Streaming API",
    "contact": {},
    "version": "1.0"
  },
  "host": "stream.servicekeel.com",
  "basePath": "/",
  "paths": {
    "/field_service/routing/apply": {
      "post": {
        "description": "Applies a reviewed route proposal with resumable progress. Shared tenant JWT and owner/admin required. Progress and errors are SSE events.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Routing"
        ],
        "summary": "Stream Field Service RoutingApply",
        "parameters": [
          {
            "description": "Reviewed operation input",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE status, result or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_routing_apply"
      }
    },
    "/field_service/routing/geocode": {
      "post": {
        "description": "Geocodes a saved tenant service address. Shared tenant JWT and owner/admin required. Progress and errors are SSE events.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Routing"
        ],
        "summary": "Stream Field Service RoutingGeocode",
        "parameters": [
          {
            "description": "Reviewed operation input",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE status, result or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_routing_geocode"
      }
    },
    "/field_service/routing/propose": {
      "post": {
        "description": "Builds a Google Maps route proposal without changing visits. Shared tenant JWT and owner/admin required. Progress and errors are SSE events.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Routing"
        ],
        "summary": "Stream Field Service RoutingPropose",
        "parameters": [
          {
            "description": "Reviewed operation input",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE status, result or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_routing_propose"
      }
    },
    "/field_service/payments/customers/{id}/wallet": {
      "post": {
        "description": "Requires a shared owner/admin session to read masked customer methods.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Payments"
        ],
        "summary": "Stream Field Service StaffWallet",
        "parameters": [
          {
            "description": "Operation input",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE result or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_payments_customers_id_wallet"
      }
    },
    "/field_service/payments/estimates/{id}/cancel-checkout": {
      "post": {
        "description": "Verifies provider cancellation before unlocking a document.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Payments"
        ],
        "summary": "Stream Field Service PaymentCancelCheckout",
        "parameters": [
          {
            "description": "Operation input",
            "name": "payload",
            "in": "body",
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE payment, done or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_payments_estimates_id_cancel_checkout"
      }
    },
    "/field_service/payments/estimates/{id}/charge": {
      "post": {
        "description": "Requires owner/admin, confirmed amount/version, active customer consent, and verified payment ownership.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Payments"
        ],
        "summary": "Stream Field Service SavedMethodCharge",
        "parameters": [
          {
            "description": "Operation input",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE result or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_payments_estimates_id_charge"
      }
    },
    "/field_service/payments/estimates/{id}/checkout": {
      "post": {
        "description": "Creates or resumes tenant-owned connected-account Checkout.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Payments"
        ],
        "summary": "Stream Field Service PaymentCheckout",
        "parameters": [
          {
            "description": "Operation input",
            "name": "payload",
            "in": "body",
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE checkout, done or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_payments_estimates_id_checkout"
      }
    },
    "/field_service/payments/invoices/{id}/cancel-checkout": {
      "post": {
        "description": "Verifies provider cancellation before unlocking a document.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Payments"
        ],
        "summary": "Stream Field Service PaymentCancelCheckout",
        "parameters": [
          {
            "description": "Operation input",
            "name": "payload",
            "in": "body",
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE payment, done or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_payments_invoices_id_cancel_checkout"
      }
    },
    "/field_service/payments/invoices/{id}/charge": {
      "post": {
        "description": "Requires owner/admin, confirmed amount/version, active customer consent, and verified payment ownership.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Payments"
        ],
        "summary": "Stream Field Service SavedMethodCharge",
        "parameters": [
          {
            "description": "Operation input",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE result or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_payments_invoices_id_charge"
      }
    },
    "/field_service/payments/invoices/{id}/checkout": {
      "post": {
        "description": "Creates or resumes tenant-owned connected-account Checkout.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Payments"
        ],
        "summary": "Stream Field Service PaymentCheckout",
        "parameters": [
          {
            "description": "Operation input",
            "name": "payload",
            "in": "body",
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE checkout, done or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_payments_invoices_id_checkout"
      }
    },
    "/field_service/marketing/workspace/{module}/{id}/action": {
      "post": {
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "description": "Owner/admin and Core required. Shared tenant authentication. Generate returns editable draft text; action supports version-checked provider sync and exact saved Google review reply publication. Secrets remain server-side. No SMS, voice, postal, or ad-spend actions are automatically enabled.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Marketing workspace"
        ],
        "summary": "Generate marketing copy or synchronize a connected marketing provider",
        "parameters": [
          {
            "type": "string",
            "description": "agents, direct-mail, reputation, ads",
            "name": "module",
            "in": "path",
            "required": true
          },
          {
            "type": "string",
            "description": "Record ID",
            "name": "id",
            "in": "path",
            "required": true
          },
          {
            "description": "Generate: prompt; action: version and action (sync or publish)",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE status, draft or result, done, error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_marketing_workspace_module_id_action"
      }
    },
    "/field_service/marketing/workspace/{module}/{id}/generate": {
      "post": {
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "description": "Owner/admin and Core required. Shared tenant authentication. Generate returns editable draft text; action supports version-checked provider sync and exact saved Google review reply publication. Secrets remain server-side. No SMS, voice, postal, or ad-spend actions are automatically enabled.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Marketing workspace"
        ],
        "summary": "Generate marketing copy or synchronize a connected marketing provider",
        "parameters": [
          {
            "type": "string",
            "description": "agents, direct-mail, reputation, ads",
            "name": "module",
            "in": "path",
            "required": true
          },
          {
            "type": "string",
            "description": "Record ID",
            "name": "id",
            "in": "path",
            "required": true
          },
          {
            "description": "Generate: prompt; action: version and action (sync or publish)",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE status, draft or result, done, error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_marketing_workspace_module_id_generate"
      }
    },
    "/field_service/marketing/workspace/reputation/sync": {
      "post": {
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "description": "Owner/admin and Core required. Shared tenant authentication. Generate returns editable draft text; action supports version-checked provider sync and exact saved Google review reply publication. Secrets remain server-side. No SMS, voice, postal, or ad-spend actions are automatically enabled.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Marketing workspace"
        ],
        "summary": "Generate marketing copy or synchronize a connected marketing provider",
        "parameters": [
          {
            "description": "Generate: prompt; action: version and action (sync or publish)",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE status, draft or result, done, error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_marketing_workspace_reputation_sync"
      }
    },
    "/field_service/quickbooks/export": {
      "post": {
        "description": "Exports exactly a reviewed payload with durable claim and no blind retries. Shared tenant JWT and owner/admin required. Progress and errors are SSE events.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "QuickBooks"
        ],
        "summary": "Stream Field Service QuickBooksExport",
        "parameters": [
          {
            "description": "Reviewed operation input",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE status, result or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_quickbooks_export"
      }
    },
    "/field_service/quickbooks/options": {
      "post": {
        "description": "Reads QuickBooks company accounting options. Shared tenant JWT and owner/admin required. Progress and errors are SSE events.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "QuickBooks"
        ],
        "summary": "Stream Field Service QuickBooksOptions",
        "parameters": [
          {
            "description": "Reviewed operation input",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE status, result or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_quickbooks_options"
      }
    },
    "/field_service/quickbooks/preview": {
      "post": {
        "description": "Builds a saved QuickBooks export preview without remote writes. Shared tenant JWT and owner/admin required. Progress and errors are SSE events.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "QuickBooks"
        ],
        "summary": "Stream Field Service QuickBooksPreview",
        "parameters": [
          {
            "description": "Reviewed operation input",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE status, result or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_quickbooks_preview"
      }
    },
    "/field_service/quickbooks/reconcile": {
      "post": {
        "description": "Verifies a remote record ID against an interrupted export. Shared tenant JWT and owner/admin required. Progress and errors are SSE events.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "QuickBooks"
        ],
        "summary": "Stream Field Service QuickBooksReconcile",
        "parameters": [
          {
            "description": "Reviewed operation input",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE status, result or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_quickbooks_reconcile"
      }
    },
    "/field_service/gusto/export": {
      "post": {
        "description": "Exports approved, reviewed shift data without submitting payroll. Shared tenant JWT and owner/admin required. Progress and errors are SSE events.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Gusto"
        ],
        "summary": "Stream Field Service GustoExport",
        "parameters": [
          {
            "description": "Reviewed operation input",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE status, result or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_gusto_export"
      }
    },
    "/field_service/gusto/mapping": {
      "post": {
        "description": "Confirms a shared team member matches an external Gusto employee and job. Shared tenant JWT and owner/admin required. Progress and errors are SSE events.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Gusto"
        ],
        "summary": "Stream Field Service GustoMapping",
        "parameters": [
          {
            "description": "Reviewed operation input",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE status, result or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_gusto_mapping"
      }
    },
    "/field_service/gusto/payrolls": {
      "post": {
        "description": "Lists unprocessed regular payroll periods for reviewed reimbursement export.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Gusto"
        ],
        "summary": "Stream Field Service GustoPayrolls",
        "parameters": [
          {
            "description": "Operation input",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE payrolls, done or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_gusto_payrolls"
      }
    },
    "/field_service/gusto/reimbursements/export": {
      "post": {
        "description": "Exports one approved reviewed reimbursement with provider version checks and durable reconciliation. Does not submit payroll.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Gusto"
        ],
        "summary": "Stream Field Service GustoReimbursementExport",
        "parameters": [
          {
            "description": "Operation input",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE export, done or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_gusto_reimbursements_export"
      }
    },
    "/field_service/gusto/reimbursements/preview": {
      "post": {
        "description": "Requires explicit prepare confirmation and builds a versioned reimbursement preview. Preparation can update payroll dates and invalidate provider calculations; no payroll is submitted.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Gusto"
        ],
        "summary": "Stream Field Service GustoReimbursementPreview",
        "parameters": [
          {
            "description": "Operation input",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE preview, done or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_gusto_reimbursements_preview"
      }
    },
    "/field_service/gusto/roster": {
      "post": {
        "description": "Reads active employees and jobs from the connected Gusto company. Shared tenant JWT and owner/admin required. Progress and errors are SSE events.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Gusto"
        ],
        "summary": "Stream Field Service GustoRoster",
        "parameters": [
          {
            "description": "Reviewed operation input",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE status, result or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_gusto_roster"
      }
    },
    "/field_service/public/hub/{token}/autopay/{job_id}": {
      "post": {
        "description": "Full customer-hub capability, active Core plan, selected customer-consented method and explicit reviewed per-job schedule/maximum consent. No staff or document-scoped capability may authorize. Review and disable remain available without Core. Only subsequently issued and due recurring invoices qualify.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Customer portal"
        ],
        "summary": "Stream customer recurring payment authorization",
        "parameters": [
          {
            "type": "string",
            "description": "Full customer-hub capability",
            "name": "token",
            "in": "path",
            "required": true
          },
          {
            "type": "string",
            "description": "Recurring job ID",
            "name": "job_id",
            "in": "path",
            "required": true
          },
          {
            "description": "action review, enable or disable; enable requires consent true, consent_version, payment_method_id, expected_job_version and exact max_amount_cents",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE autopay, done or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_public_hub_token_autopay_job_id"
      }
    },
    "/field_service/public/hub/{token}/checkout/estimates/{id}": {
      "post": {
        "description": "Creates customer Checkout after revocable customer capability authorization.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Customer portal"
        ],
        "summary": "Stream Field Service CustomerCheckout",
        "parameters": [
          {
            "description": "Operation input",
            "name": "payload",
            "in": "body",
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE checkout, done or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_public_hub_token_checkout_estimates_id"
      }
    },
    "/field_service/public/hub/{token}/checkout/invoices/{id}": {
      "post": {
        "description": "Creates customer Checkout after revocable customer capability authorization.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Customer portal"
        ],
        "summary": "Stream Field Service CustomerCheckout",
        "parameters": [
          {
            "description": "Operation input",
            "name": "payload",
            "in": "body",
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE checkout, done or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_public_hub_token_checkout_invoices_id"
      }
    },
    "/field_service/public/hub/{token}/wallet": {
      "post": {
        "description": "Reads masked saved methods after customer capability authorization.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Customer portal"
        ],
        "summary": "Stream Field Service CustomerWallet",
        "parameters": [
          {
            "description": "Operation input",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE result or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_public_hub_token_wallet"
      }
    },
    "/field_service/public/hub/{token}/wallet/remove": {
      "post": {
        "description": "Revokes customer consent and detaches the authorized payment method.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Customer portal"
        ],
        "summary": "Stream Field Service CustomerWalletRemove",
        "parameters": [
          {
            "description": "Operation input",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE result or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_public_hub_token_wallet_remove"
      }
    },
    "/field_service/public/hub/{token}/wallet/setup": {
      "post": {
        "description": "Requires explicit consent before connected-account payment-method setup.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Customer portal"
        ],
        "summary": "Stream Field Service CustomerWalletSetup",
        "parameters": [
          {
            "description": "Operation input",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE result or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_public_hub_token_wallet_setup"
      }
    },
    "/field_service/assistant/confirm": {
      "post": {
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "description": "Unavailable during support impersonation (403): support assistant access is read-only.\nServer-issued approval ID is bound to tenant/user, conversation/version, command, record and recipient dependencies. Model responses cannot approve. Domain actions require this endpoint; marketing generation additionally accepts the exact version-bound phrase documented on the message endpoint. Changed or expired proposals require fresh review.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Assistant"
        ],
        "summary": "Confirm an exact reviewed Field Service assistant action",
        "parameters": [
          {
            "description": "conversation_id, version, request_id, approval_id",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE stream",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_assistant_confirm"
      }
    },
    "/field_service/assistant/message": {
      "post": {
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "description": "Unavailable during support impersonation (403). Support access only lists and reads existing client chats through the REST history endpoints; messages, new chats and every other assistant mutation are blocked.\nOn the first user message in an empty or welcome-only chat, Create a customer or Create a new customer replies Please provide me with the customer details; Create an estimate replies Which customer should I create an estimate for?; Schedule a job replies Which customer should I create a job for?; Send an invoice replies Would you like to create a new invoice, or look for an existing invoice to send? These plain-message shortcuts ignore casing and surrounding whitespace, skip model analysis, and reply after a simulated one-second delay. All other messages use the normal flow.\nWhen sending finds no matching invoice or known job/estimate source, the assistant offers to create a new invoice or search again. Accepting creation retains the send request and its delivery parameters, collects missing invoice details, and requires separate approvals to create and send. Existing customer matches are tenant-scoped; ambiguous customers require selection.\nInformation questions use contract-declared read capabilities for tenant/role-scoped searches, exact counts and numeric totals. Chat lists contain at most 10 records with links and resumable pagination; counts/totals aggregate the entire matching set. Named filters define business terms such as outstanding invoices. Information replies preserve the current task, draft and pending approval, mark their message answer_type=information, and do not navigate or mutate resources. Explicit open-page requests navigate separately. Unsupported filters/metrics require clarification instead of fabricated results.\nEdits to declared linked records preserve the current task and remaining workflow. The assistant prepares the linked record update using the supplied values, requires its own review, and resumes the original task with fresh validation afterward. Invoice/estimate recipient email belongs to the linked customer; changing it refreshes the send review and never sends automatically.\nrefresh_review=true with the current pending_id quietly renews a resource review, reloads authorized dependencies, and reports changed field labels. It preserves the draft, never invokes a model or executes the action, and issues a fresh approval for explicit confirmation. Failed renewal keeps the draft with refresh_error.\nMarketing reels reuse tenant-owned service jobs and shared marketing projects, brand kits and durable narration/render workers. Image selection uses current pending_id plus edits.asset_ids and explicit edits.rights_confirmed=true. Poll script/rendering stages with edits.refresh=true. After reading the generated script, voice and credits, reply exactly Generate this reel with the current marketing_review pending_id and conversation version; the server requires the unexpired exact manifest/brand review. Generic acknowledgements and model output cannot approve generation. Publishing remains a final human action in Marketing Projects.\nShared session, tenant membership and Core required. Streams status, assistant_state, resource_changed, assistant_navigation and done. Explicit open-page requests navigate while preserving the current task; record choices and missing details are clarified through chat. Ordered workflows retain all requested steps and later-step details across reviewed prerequisites and reloads; each Field Service domain mutation requires its own approval. The model proposes operations; the server validates and executes them. Field Service domain mutations return an unsaved form proposal and require separate explicit human review. Marketing drafts save conversationally before their exact generation review. Dynamic reply suggestions are not generated. History is never silently truncated: new message turns emit an SSE error with code conversation_full at 500 messages or approximately 3 MiB; confirmations and history access remain available. Linked steps inherit unambiguous resolved relationship context through resource contracts, and every planned step can bind tenant-verified saved conversation references. Explicit different records and ambiguous associations still require lookup/clarification.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Assistant"
        ],
        "summary": "Converse with the Field Service assistant",
        "parameters": [
          {
            "description": "conversation_id, version, request_id, message or choice_id/pending_id or edits or refresh_review/pending_id, optional context",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE stream",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_assistant_message"
      }
    },
    "/field_service/assistant/voice/message": {
      "post": {
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "description": "Unavailable during support impersonation (403).\nSame auth, conversation ownership, version and request-id replay protection as assistant/message. Only a plain message and optional context are accepted. Approvals, choice IDs, edits, pending IDs and review refreshes are rejected. Marketing generation reviews must be approved on screen. Streams status, assistant_state, resource_changed, assistant_navigation, done or error.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Assistant"
        ],
        "summary": "Delegate a spoken request to the Field Service assistant",
        "parameters": [
          {
            "description": "conversation_id, version, request_id, message, optional context",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE stream",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_assistant_voice_message"
      }
    },
    "/field_service/assistant/voice/session": {
      "post": {
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "description": "Unavailable during support impersonation (403).\nShared tenant/user and assistant entitlement required. Validates conversation ownership, role and version. Returns status, voice_session with sdp and conversation_id, done or error. Uses the existing OpenAI credentials with fixed scope instructions, no saved history or internal capability metadata. WebRTC carries audio directly; permanent credentials never reach the browser.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Assistant"
        ],
        "summary": "Start a Field Service assistant voice session",
        "parameters": [
          {
            "description": "conversation_id, version, sdp",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE stream",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_assistant_voice_session"
      }
    },
    "/field_service/ai/draft": {
      "post": {
        "description": "Uses reviewed transcript plus tenant-authorized selected context. Does not save, schedule, send or charge. Field Service Core and write permission required. Returns SSE draft with server-computed totals and clarification questions; errors are SSE error events.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "AI tools"
        ],
        "summary": "Stream an editable Field Service draft",
        "parameters": [
          {
            "description": "transcript, kind, optional customer_id, record_id and instructions",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE stream",
            "schema": {
              "type": "string"
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          }
        },
        "operationId": "post_field_service_ai_draft"
      }
    },
    "/field_service/ai/expenses/extract": {
      "post": {
        "description": "Owner/admin and Field Service Core only. Uses completed tenant private PDF upload; one bounded document per stream. Clients process batches up to25 sequentially. Emits persisted editable expense_draft without creating or approving an expense.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "AI tools"
        ],
        "summary": "Stream supplier PDF invoice extraction",
        "parameters": [
          {
            "description": "import_id and asset_id",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE status, delta, expense_draft, done or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_ai_expenses_extract"
      }
    },
    "/field_service/ai/transcribe": {
      "post": {
        "description": "Uses the shared JWT/session and tenant. Field Service Core and write permission required. Returns SSE status, transcript and done, or error. Audio is base64 encoded, maximum 8 MB.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "AI tools"
        ],
        "summary": "Stream Field Service voice transcription",
        "parameters": [
          {
            "description": "audio_base64 and mime_type",
            "name": "payload",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE stream",
            "schema": {
              "type": "string"
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          }
        },
        "operationId": "post_field_service_ai_transcribe"
      }
    },
    "/field_service/files/{asset_id}/complete": {
      "post": {
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "description": "Shared authentication and current tenant/role checks. Verifies S3 metadata and PDF bytes for a server-bound source before returning file metadata. Upload uses the existing private storage signer.",
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Files"
        ],
        "summary": "Validate a Field Service PDF upload with progress",
        "parameters": [
          {
            "type": "string",
            "description": "Upload ID",
            "name": "asset_id",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "SSE file, done or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_files_asset_id_complete"
      }
    },
    "/field_service/billing/cancel": {
      "post": {
        "description": "Cancels Field Service Core at period end without changing the existing product subscription.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Account billing"
        ],
        "summary": "Stream Field Service BillingCancel",
        "parameters": [
          {
            "description": "Operation input",
            "name": "payload",
            "in": "body",
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE billing, done or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_billing_cancel"
      }
    },
    "/field_service/billing/checkout": {
      "post": {
        "description": "Creates a custom Field Service Core Checkout session for the in-app Payment Element using the existing shared Stripe customer. The checkout event returns client_secret and session_id.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Account billing"
        ],
        "summary": "Stream Field Service BillingCheckout",
        "parameters": [
          {
            "description": "Operation input",
            "name": "payload",
            "in": "body",
            "schema": {
              "type": "object",
              "additionalProperties": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSE checkout, done or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_billing_checkout"
      }
    },
    "/field_service/billing/confirm": {
      "post": {
        "description": "Verifies the stored checkout and subscription with Stripe before refreshing tenant entitlement. Owner only; no caller-supplied Stripe identifiers. Includes purchase {transaction_id, value, currency} only for a completed, paid, positive-value live USD subscription checkout; transaction_id is the stable Checkout Session ID, value is its actual total in dollars. Repeated confirmations return the same receipt; clients must deduplicate. Ordinary billing reads never include a purchase.",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/event-stream"
        ],
        "tags": [
          "Account billing"
        ],
        "summary": "Stream Field Service subscription verification",
        "responses": {
          "200": {
            "description": "SSE billing, done or error",
            "schema": {
              "type": "string"
            }
          }
        },
        "operationId": "post_field_service_billing_confirm"
      }
    }
  },
  "definitions": {},
  "x-tagGroups": [
    {
      "name": "Field Service",
      "tags": [
        "Routing"
      ]
    },
    {
      "name": "Finance",
      "tags": [
        "Payments"
      ]
    },
    {
      "name": "Marketing",
      "tags": [
        "Marketing workspace"
      ]
    },
    {
      "name": "Integrations",
      "tags": [
        "QuickBooks",
        "Gusto"
      ]
    },
    {
      "name": "Customer access",
      "tags": [
        "Customer portal"
      ]
    },
    {
      "name": "Assistant and files",
      "tags": [
        "Assistant",
        "AI tools",
        "Files"
      ]
    },
    {
      "name": "Administration",
      "tags": [
        "Account billing"
      ]
    }
  ],
  "tags": [
    {
      "name": "Routing"
    },
    {
      "name": "Payments"
    },
    {
      "name": "Marketing workspace"
    },
    {
      "name": "QuickBooks"
    },
    {
      "name": "Gusto"
    },
    {
      "name": "Customer portal"
    },
    {
      "name": "Assistant"
    },
    {
      "name": "AI tools"
    },
    {
      "name": "Files"
    },
    {
      "name": "Account billing"
    }
  ]
}
