{
  "openapi": "3.1.0",
  "info": {
    "title": "NFS Workshop API",
    "version": "1.0.0",
    "description": "Read-only access to one workshop's own data in NFS Workshop.\n\n**Keys.** The shop's owner or admin creates a key in Workshop settings and chooses its scopes. Send it on every request as `Authorization: Bearer nfs_live_...`. A key reads its own shop only; the shop is decided by the key, never by the request.\n\n**Scopes.** `jobs:read`, `invoices:read`, `parts:read` (part lines and stock), `time:read`, `staff:read`, `bookings:read`. Two scopes add fields to the others instead of opening an endpoint: without `costs:read` every cost, cost price, markup and margin field is null; without `contacts:read` every customer phone and e-mail is null. National ID codes, notes, VINs and staff contact details are never returned under any scope.\n\n**Paging.** Lists are cursor paged. Each answer is `{ \"data\": [...], \"nextCursor\": \"...\" }`; pass `nextCursor` back as `cursor` until it is null. Cursors are opaque: do not build or edit them. `limit` is 1 to 200 (default 50).\n\n**Incremental sync.** Jobs, invoices, part lines and stock are sorted by when they last changed and take `updated_since`. Keep the largest `updatedAt` you have stored and ask for what changed since. Time and bookings take a date window (`from`, `to`) instead.\n\n**Deleted jobs vanish.** A deleted job is gone from every list; no tombstone is sent. If you mirror jobs, do a full pass (no `updated_since`) now and then and drop what is no longer there.\n\n**Money** is in cents. Unit prices may carry fractional cents (for example 3225.81, a net price derived from a gross one), exactly as stored; totals are whole cents.\n\n**Limits.** 5000 requests per key per UTC day, and a per-minute limit. Over a limit the answer is 429 with `Retry-After` in seconds. A request the database cannot answer in time is 503 with `Retry-After`; try again later.\n\n**Every answer** carries `X-Request-Id`; quote it when you contact support. Responses are never cached (`Cache-Control: no-store`). The API is meant for server-to-server use and sends no CORS headers."
  },
  "servers": [
    {
      "url": "https://api.needforservice.app"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "paths": {
    "/v1/jobs": {
      "get": {
        "summary": "List jobs",
        "description": "Every document of the shop: estimates, repair orders, invoices, credit notes and prepayments, by (updatedAt, id).\n\nScope: `jobs:read`.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "updated_since",
            "in": "query",
            "required": false,
            "description": "Only rows changed at or after this instant. Use the largest updatedAt you have seen, for incremental sync.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "nextCursor from the previous page, passed back unchanged.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Rows per page, 1 to 200. Default 50.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "nextCursor"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Job"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass back as cursor for the next page. Null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "A malformed parameter or cursor, or a window whose end is before its start.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a malformed, unknown, revoked or expired key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks this endpoint's scope, or the shop is not active.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: this minute, or today's 5000. See Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "An error on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "A slow request was cut off, or the API is switched off for the moment. See Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/jobs/{number}": {
      "get": {
        "summary": "Get one job with its lines",
        "description": "One job by its number in the shop, with its lines.\n\nScope: `jobs:read`.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "number",
            "in": "path",
            "required": true,
            "description": "The job's number.",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The job.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/JobDetail"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "A malformed parameter or cursor, or a window whose end is before its start.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a malformed, unknown, revoked or expired key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks this endpoint's scope, or the shop is not active.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No job with that number in this shop.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: this minute, or today's 5000. See Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "An error on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "A slow request was cut off, or the API is switched off for the moment. See Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/invoices": {
      "get": {
        "summary": "List invoices",
        "description": "Issued documents (invoiced or paid; credit notes and prepayments included) with their payments, by (updatedAt, id).\n\nScope: `invoices:read`.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "updated_since",
            "in": "query",
            "required": false,
            "description": "Only rows changed at or after this instant. Use the largest updatedAt you have seen, for incremental sync.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "nextCursor from the previous page, passed back unchanged.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Rows per page, 1 to 200. Default 50.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "nextCursor"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Invoice"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass back as cursor for the next page. Null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "A malformed parameter or cursor, or a window whose end is before its start.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a malformed, unknown, revoked or expired key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks this endpoint's scope, or the shop is not active.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: this minute, or today's 5000. See Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "An error on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "A slow request was cut off, or the API is switched off for the moment. See Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/part-lines": {
      "get": {
        "summary": "List part lines",
        "description": "Part lines on jobs. Paged by job: limit counts jobs that hold part lines, so a page can hold more rows than limit.\n\nScope: `parts:read`.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "updated_since",
            "in": "query",
            "required": false,
            "description": "Only rows changed at or after this instant. Use the largest updatedAt you have seen, for incremental sync.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "nextCursor from the previous page, passed back unchanged.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Rows per page, 1 to 200. Default 50.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "nextCursor"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PartLine"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass back as cursor for the next page. Null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "A malformed parameter or cursor, or a window whose end is before its start.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a malformed, unknown, revoked or expired key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks this endpoint's scope, or the shop is not active.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: this minute, or today's 5000. See Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "An error on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "A slow request was cut off, or the API is switched off for the moment. See Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/stock": {
      "get": {
        "summary": "List stock on hand",
        "description": "Stock on hand per product and warehouse, by product.\n\nScope: `parts:read`.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "updated_since",
            "in": "query",
            "required": false,
            "description": "Only rows changed at or after this instant. Use the largest updatedAt you have seen, for incremental sync.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "nextCursor from the previous page, passed back unchanged.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Rows per page, 1 to 200. Default 50.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "nextCursor"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/StockItem"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass back as cursor for the next page. Null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "A malformed parameter or cursor, or a window whose end is before its start.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a malformed, unknown, revoked or expired key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks this endpoint's scope, or the shop is not active.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: this minute, or today's 5000. See Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "An error on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "A slow request was cut off, or the API is switched off for the moment. See Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/time": {
      "get": {
        "summary": "List labour time",
        "description": "Labour hours per technician per job. limit counts jobs. The window is at most 92 days; a longer one is cut to 92.\n\nScope: `time:read`.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "First day. Default: to minus 6 days.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Last day. Default: today (shop time).",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "nextCursor from the previous page, passed back unchanged.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Rows per page, 1 to 200. Default 50.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "nextCursor"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TimeEntry"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass back as cursor for the next page. Null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "A malformed parameter or cursor, or a window whose end is before its start.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a malformed, unknown, revoked or expired key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks this endpoint's scope, or the shop is not active.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: this minute, or today's 5000. See Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "An error on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "A slow request was cut off, or the API is switched off for the moment. See Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/staff": {
      "get": {
        "summary": "List staff",
        "description": "The roster: name, roles and whether active. Never contact details.\n\nScope: `staff:read`.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "One page.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "nextCursor"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/StaffMember"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass back as cursor for the next page. Null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "A malformed parameter or cursor, or a window whose end is before its start.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a malformed, unknown, revoked or expired key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks this endpoint's scope, or the shop is not active.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: this minute, or today's 5000. See Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "An error on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "A slow request was cut off, or the API is switched off for the moment. See Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/bookings": {
      "get": {
        "summary": "List bookings",
        "description": "Bookings in a window of at most 31 days, by (date, id). A longer window is cut to 31 days.\n\nScope: `bookings:read`.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "First day. Default: today (shop time).",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Last day. Default: from plus 6 days.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "nextCursor from the previous page, passed back unchanged.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Rows per page, 1 to 200. Default 50.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "nextCursor"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Booking"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass back as cursor for the next page. Null on the last page."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "A malformed parameter or cursor, or a window whose end is before its start.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a malformed, unknown, revoked or expired key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks this endpoint's scope, or the shop is not active.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: this minute, or today's 5000. See Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "An error on our side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "A slow request was cut off, or the API is switched off for the moment. See Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "nfs_live_ followed by 48 hex characters."
      }
    },
    "schemas": {
      "VehicleRef": {
        "type": "object",
        "required": [
          "id",
          "plate",
          "make",
          "model"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": [
              "string",
              "null"
            ]
          },
          "plate": {
            "type": [
              "string",
              "null"
            ]
          },
          "make": {
            "type": [
              "string",
              "null"
            ]
          },
          "model": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "CustomerRef": {
        "type": "object",
        "required": [
          "id",
          "name",
          "kind",
          "phone",
          "email",
          "phones",
          "emails"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ],
            "description": "The name on the document, else the customer's name."
          },
          "kind": {
            "type": [
              "string",
              "null"
            ],
            "description": "person or company.",
            "enum": [
              "person",
              "company",
              null
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ],
            "description": "The customer's first phone number. Null without the contacts:read scope."
          },
          "email": {
            "type": [
              "string",
              "null"
            ],
            "description": "The customer's first e-mail address. Null without the contacts:read scope."
          },
          "phones": {
            "type": [
              "array",
              "null"
            ],
            "description": "Every phone number of the customer. Null without the contacts:read scope.",
            "items": {
              "type": "string"
            }
          },
          "emails": {
            "type": [
              "array",
              "null"
            ],
            "description": "Every e-mail address of the customer. Null without the contacts:read scope.",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "BookingCustomer": {
        "type": "object",
        "required": [
          "id",
          "name",
          "phone",
          "email",
          "phones",
          "emails"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ],
            "description": "The name on the document, else the customer's name."
          },
          "phone": {
            "type": [
              "string",
              "null"
            ],
            "description": "The customer's first phone number. Null without the contacts:read scope."
          },
          "email": {
            "type": [
              "string",
              "null"
            ],
            "description": "The customer's first e-mail address. Null without the contacts:read scope."
          },
          "phones": {
            "type": [
              "array",
              "null"
            ],
            "description": "Every phone number of the customer. Null without the contacts:read scope.",
            "items": {
              "type": "string"
            }
          },
          "emails": {
            "type": [
              "array",
              "null"
            ],
            "description": "Every e-mail address of the customer. Null without the contacts:read scope.",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "Job": {
        "type": "object",
        "required": [
          "id",
          "number",
          "kind",
          "status",
          "createdAt",
          "updatedAt",
          "invoiceNumber",
          "invoiceDate",
          "closedOn",
          "paidOn",
          "vehicle",
          "mileage",
          "customer",
          "services",
          "netCents",
          "vatCents",
          "grossCents",
          "costCents"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "number": {
            "type": "integer",
            "description": "The job's number in the shop."
          },
          "kind": {
            "type": "string",
            "description": "estimate, repair_order, credit_note or prepayment.",
            "enum": [
              "estimate",
              "repair_order",
              "credit_note",
              "prepayment"
            ]
          },
          "status": {
            "type": "string",
            "description": "draft, sent, invoiced, paid or closed."
          },
          "createdAt": {
            "type": "string",
            "description": "When the job was opened.",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "description": "When the job last changed. Sort key of the list.",
            "format": "date-time"
          },
          "invoiceNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "invoiceDate": {
            "type": [
              "string",
              "null"
            ],
            "description": "The invoice date.",
            "format": "date"
          },
          "closedOn": {
            "type": [
              "string",
              "null"
            ],
            "description": "The day the job was closed.",
            "format": "date"
          },
          "paidOn": {
            "type": [
              "string",
              "null"
            ],
            "description": "The day the job was marked paid.",
            "format": "date"
          },
          "vehicle": {
            "$ref": "#/components/schemas/VehicleRef"
          },
          "mileage": {
            "type": [
              "integer",
              "null"
            ]
          },
          "customer": {
            "$ref": "#/components/schemas/CustomerRef"
          },
          "services": {
            "type": "array",
            "description": "The names of the job's services, in order.",
            "items": {
              "type": "string"
            }
          },
          "netCents": {
            "type": "integer",
            "description": "Total before VAT. In cents."
          },
          "vatCents": {
            "type": "integer",
            "description": "VAT. In cents."
          },
          "grossCents": {
            "type": "integer",
            "description": "Total with VAT. In cents."
          },
          "costCents": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The typed cost of the job's lines (cost price times quantity). In cents. Null without the costs:read scope."
          }
        }
      },
      "JobLine": {
        "type": "object",
        "required": [
          "id",
          "position",
          "service",
          "kind",
          "description",
          "code",
          "productId",
          "qty",
          "unit",
          "unitPriceCents",
          "discountPct",
          "vatPct",
          "netCents",
          "billed",
          "technicianId",
          "technicianName",
          "vehicleId",
          "costPriceCents",
          "markupPct"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "position": {
            "type": [
              "integer",
              "null"
            ]
          },
          "service": {
            "type": [
              "string",
              "null"
            ],
            "description": "The name of the service the line belongs to."
          },
          "kind": {
            "type": [
              "string",
              "null"
            ],
            "description": "labor, part or another line kind."
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "code": {
            "type": [
              "string",
              "null"
            ]
          },
          "productId": {
            "type": [
              "string",
              "null"
            ]
          },
          "qty": {
            "type": [
              "number",
              "null"
            ]
          },
          "unit": {
            "type": [
              "string",
              "null"
            ]
          },
          "unitPriceCents": {
            "type": [
              "number",
              "null"
            ],
            "description": "Net unit price in cents, as stored: may carry fractional cents (totals are whole cents)."
          },
          "discountPct": {
            "type": [
              "number",
              "null"
            ]
          },
          "vatPct": {
            "type": [
              "number",
              "null"
            ]
          },
          "netCents": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Line total before VAT, in cents."
          },
          "billed": {
            "type": "boolean",
            "description": "False when the line's service is excluded from the invoice or was declined."
          },
          "technicianId": {
            "type": [
              "string",
              "null"
            ]
          },
          "technicianName": {
            "type": [
              "string",
              "null"
            ]
          },
          "vehicleId": {
            "type": [
              "string",
              "null"
            ]
          },
          "costPriceCents": {
            "type": [
              "number",
              "null"
            ],
            "description": "Unit cost in cents, as stored: may carry fractional cents. Null without the costs:read scope."
          },
          "markupPct": {
            "type": [
              "number",
              "null"
            ],
            "description": "Markup percent. Null without the costs:read scope."
          }
        }
      },
      "JobDetail": {
        "type": "object",
        "required": [
          "id",
          "number",
          "kind",
          "status",
          "createdAt",
          "updatedAt",
          "invoiceNumber",
          "invoiceDate",
          "closedOn",
          "paidOn",
          "vehicle",
          "mileage",
          "customer",
          "services",
          "netCents",
          "vatCents",
          "grossCents",
          "costCents",
          "lines"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "number": {
            "type": "integer",
            "description": "The job's number in the shop."
          },
          "kind": {
            "type": "string",
            "description": "estimate, repair_order, credit_note or prepayment.",
            "enum": [
              "estimate",
              "repair_order",
              "credit_note",
              "prepayment"
            ]
          },
          "status": {
            "type": "string",
            "description": "draft, sent, invoiced, paid or closed."
          },
          "createdAt": {
            "type": "string",
            "description": "When the job was opened.",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "description": "When the job last changed. Sort key of the list.",
            "format": "date-time"
          },
          "invoiceNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "invoiceDate": {
            "type": [
              "string",
              "null"
            ],
            "description": "The invoice date.",
            "format": "date"
          },
          "closedOn": {
            "type": [
              "string",
              "null"
            ],
            "description": "The day the job was closed.",
            "format": "date"
          },
          "paidOn": {
            "type": [
              "string",
              "null"
            ],
            "description": "The day the job was marked paid.",
            "format": "date"
          },
          "vehicle": {
            "$ref": "#/components/schemas/VehicleRef"
          },
          "mileage": {
            "type": [
              "integer",
              "null"
            ]
          },
          "customer": {
            "$ref": "#/components/schemas/CustomerRef"
          },
          "services": {
            "type": "array",
            "description": "The names of the job's services, in order.",
            "items": {
              "type": "string"
            }
          },
          "netCents": {
            "type": "integer",
            "description": "Total before VAT. In cents."
          },
          "vatCents": {
            "type": "integer",
            "description": "VAT. In cents."
          },
          "grossCents": {
            "type": "integer",
            "description": "Total with VAT. In cents."
          },
          "costCents": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The typed cost of the job's lines (cost price times quantity). In cents. Null without the costs:read scope."
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobLine"
            }
          }
        }
      },
      "Payment": {
        "type": "object",
        "required": [
          "id",
          "paidAt",
          "amountCents",
          "method"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": [
              "string",
              "null"
            ]
          },
          "paidAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "amountCents": {
            "type": "integer",
            "description": "Amount. In cents."
          },
          "method": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "Invoice": {
        "type": "object",
        "required": [
          "id",
          "jobNumber",
          "invoiceNumber",
          "kind",
          "status",
          "invoiceDate",
          "dueDate",
          "paid",
          "paidOn",
          "creditOf",
          "prepaymentOf",
          "customer",
          "vehiclePlate",
          "netCents",
          "vatCents",
          "grossCents",
          "paidCents",
          "costCents",
          "marginCents",
          "payments",
          "updatedAt"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "jobNumber": {
            "type": "integer",
            "description": "The number of the job the invoice was issued from."
          },
          "invoiceNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "type": "string",
            "description": "estimate, repair_order, credit_note or prepayment.",
            "enum": [
              "estimate",
              "repair_order",
              "credit_note",
              "prepayment"
            ]
          },
          "status": {
            "type": "string",
            "description": "invoiced or paid."
          },
          "invoiceDate": {
            "type": [
              "string",
              "null"
            ],
            "description": "The invoice date.",
            "format": "date"
          },
          "dueDate": {
            "type": [
              "string",
              "null"
            ],
            "description": "The due date.",
            "format": "date"
          },
          "paid": {
            "type": "boolean"
          },
          "paidOn": {
            "type": [
              "string",
              "null"
            ],
            "description": "The day it was marked paid.",
            "format": "date"
          },
          "creditOf": {
            "type": [
              "string",
              "null"
            ],
            "description": "For a credit note: what it credits."
          },
          "prepaymentOf": {
            "type": [
              "string",
              "null"
            ],
            "description": "For a prepayment invoice: what it prepays."
          },
          "customer": {
            "$ref": "#/components/schemas/CustomerRef"
          },
          "vehiclePlate": {
            "type": [
              "string",
              "null"
            ]
          },
          "netCents": {
            "type": "integer",
            "description": "Total before VAT. In cents."
          },
          "vatCents": {
            "type": "integer",
            "description": "VAT. In cents."
          },
          "grossCents": {
            "type": "integer",
            "description": "Total with VAT. In cents."
          },
          "paidCents": {
            "type": "integer",
            "description": "Sum of the payments. In cents."
          },
          "costCents": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Typed cost of the lines. In cents. Null without the costs:read scope."
          },
          "marginCents": {
            "type": [
              "integer",
              "null"
            ],
            "description": "netCents minus costCents. In cents. Null without the costs:read scope."
          },
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Payment"
            }
          },
          "updatedAt": {
            "type": "string",
            "description": "When the invoice last changed. Sort key of the list.",
            "format": "date-time"
          }
        }
      },
      "PartLine": {
        "type": "object",
        "required": [
          "jobId",
          "jobNumber",
          "jobKind",
          "jobStatus",
          "jobUpdatedAt",
          "lineId",
          "position",
          "productId",
          "code",
          "description",
          "supplier",
          "qty",
          "unit",
          "unitPriceCents",
          "netCents",
          "costPriceCents",
          "costCents"
        ],
        "additionalProperties": false,
        "properties": {
          "jobId": {
            "type": "string",
            "format": "uuid"
          },
          "jobNumber": {
            "type": "integer"
          },
          "jobKind": {
            "type": "string",
            "description": "estimate, repair_order, credit_note or prepayment.",
            "enum": [
              "estimate",
              "repair_order",
              "credit_note",
              "prepayment"
            ]
          },
          "jobStatus": {
            "type": "string"
          },
          "jobUpdatedAt": {
            "type": "string",
            "description": "When the job last changed. Sort key of the list.",
            "format": "date-time"
          },
          "lineId": {
            "type": "string"
          },
          "position": {
            "type": [
              "integer",
              "null"
            ]
          },
          "productId": {
            "type": [
              "string",
              "null"
            ]
          },
          "code": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "supplier": {
            "type": [
              "string",
              "null"
            ]
          },
          "qty": {
            "type": [
              "number",
              "null"
            ]
          },
          "unit": {
            "type": [
              "string",
              "null"
            ]
          },
          "unitPriceCents": {
            "type": [
              "number",
              "null"
            ],
            "description": "Net unit price in cents, as stored: may carry fractional cents (totals are whole cents)."
          },
          "netCents": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Line total before VAT, in cents."
          },
          "costPriceCents": {
            "type": [
              "number",
              "null"
            ],
            "description": "Unit cost in cents, as stored: may carry fractional cents. Null without the costs:read scope."
          },
          "costCents": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Cost price times quantity. In cents. Null without the costs:read scope."
          }
        }
      },
      "StockItem": {
        "type": "object",
        "required": [
          "productId",
          "warehouseId",
          "code",
          "name",
          "brand",
          "unit",
          "onHand",
          "reorderPoint",
          "priceCents",
          "costCents",
          "archived",
          "updatedAt"
        ],
        "additionalProperties": false,
        "properties": {
          "productId": {
            "type": [
              "string",
              "null"
            ]
          },
          "warehouseId": {
            "type": [
              "string",
              "null"
            ]
          },
          "code": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "brand": {
            "type": [
              "string",
              "null"
            ]
          },
          "unit": {
            "type": [
              "string",
              "null"
            ]
          },
          "onHand": {
            "type": [
              "number",
              "null"
            ]
          },
          "reorderPoint": {
            "type": [
              "number",
              "null"
            ]
          },
          "priceCents": {
            "type": [
              "number",
              "null"
            ],
            "description": "Sell price before VAT, in cents, as stored: may carry fractional cents."
          },
          "costCents": {
            "type": [
              "number",
              "null"
            ],
            "description": "Cost price in cents, as stored: may carry fractional cents. Null without the costs:read scope."
          },
          "archived": {
            "type": "boolean"
          },
          "updatedAt": {
            "type": "string",
            "description": "When the stock row last changed.",
            "format": "date-time"
          }
        }
      },
      "TimeEntry": {
        "type": "object",
        "required": [
          "jobId",
          "jobNumber",
          "jobKind",
          "jobStatus",
          "day",
          "daySource",
          "technicianId",
          "technicianName",
          "hours",
          "labourLines"
        ],
        "additionalProperties": false,
        "properties": {
          "jobId": {
            "type": "string",
            "format": "uuid"
          },
          "jobNumber": {
            "type": "integer"
          },
          "jobKind": {
            "type": "string",
            "description": "estimate, repair_order, credit_note or prepayment.",
            "enum": [
              "estimate",
              "repair_order",
              "credit_note",
              "prepayment"
            ]
          },
          "jobStatus": {
            "type": "string"
          },
          "day": {
            "type": "string",
            "description": "The day the job was sold, else the day it was opened (shop time).",
            "format": "date"
          },
          "daySource": {
            "type": "string",
            "enum": [
              "sold",
              "opened"
            ]
          },
          "technicianId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Null for labour lines without a technician."
          },
          "technicianName": {
            "type": [
              "string",
              "null"
            ]
          },
          "hours": {
            "type": "number",
            "description": "Hours on the technician's labour lines of the job."
          },
          "labourLines": {
            "type": "integer"
          }
        }
      },
      "StaffMember": {
        "type": "object",
        "required": [
          "id",
          "name",
          "roles",
          "active"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "roles": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "active": {
            "type": "boolean"
          }
        }
      },
      "Booking": {
        "type": "object",
        "required": [
          "id",
          "date",
          "startMinute",
          "endMinute",
          "status",
          "employeeId",
          "employeeName",
          "jobNumber",
          "vehicle",
          "customer",
          "updatedAt"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "date": {
            "type": [
              "string",
              "null"
            ],
            "description": "The booking's day.",
            "format": "date"
          },
          "startMinute": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Minutes from midnight, shop time."
          },
          "endMinute": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Minutes from midnight, shop time."
          },
          "status": {
            "type": "string",
            "enum": [
              "booked",
              "requested",
              "cancelled"
            ]
          },
          "employeeId": {
            "type": [
              "string",
              "null"
            ]
          },
          "employeeName": {
            "type": [
              "string",
              "null"
            ]
          },
          "jobNumber": {
            "type": [
              "integer",
              "null"
            ]
          },
          "vehicle": {
            "$ref": "#/components/schemas/VehicleRef"
          },
          "customer": {
            "$ref": "#/components/schemas/BookingCustomer"
          },
          "updatedAt": {
            "type": "string",
            "description": "When the booking last changed.",
            "format": "date-time"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "additionalProperties": false,
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message",
              "requestId"
            ],
            "additionalProperties": false,
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "unauthorized",
                  "forbidden",
                  "bad_request",
                  "not_found",
                  "rate_limited",
                  "daily_limit_reached",
                  "unavailable",
                  "disabled",
                  "internal_error"
                ]
              },
              "message": {
                "type": "string"
              },
              "requestId": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}